I gruppi WhatsApp sono essenziali per le aziende che vogliono connettersi con i loro team, clienti o comunità. Tuttavia, gestirli manualmente può richiedere molto tempo. E se potessi automatizzare la creazione e l'invio di messaggi nei gruppi WhatsApp? Con Wassenger e PHP, è semplice 🤖
🤩 🤖 Wassenger è una soluzione API completa per WhatsApp. Iscriviti per una prova gratuita di 7 giorni e inizia in pochi minuti!
In questa guida ti mostreremo come:
✅ Creare un gruppo WhatsApp
✅ Inviare messaggi a un gruppo WhatsApp
✅ Automatizzare i messaggi di gruppo per aggiornamenti e annunci
Perché automatizzare i messaggi nei gruppi WhatsApp? 🤔
Gestire e inviare messaggi manualmente nei gruppi WhatsApp può essere un fastidio. Automatizzare il processo ti permette di:
✅ Risparmiare tempo — Basta inviare messaggi individuali a più gruppi.
✅ Aumentare l'engagement — Mantieni i tuoi team o i clienti aggiornati in tempo reale.
✅ Migliorare la coerenza — Assicurati che i messaggi vengano inviati al momento giusto senza perdere aggiornamenti.
✅ Scalare la comunicazione — Raggiungi più persone senza sforzo con la messaggistica automatica.
📢 Vuoi iniziare? Iscriviti a Wassenger ora! 🚀
Requisiti
- Avere un numero WhatsApp già collegato alla piattaforma e online.
- ID del gruppo (WID) che può essere trovato in due modi:
- Sul pannello di gestione del tuo numero WhatsApp, vai su “Groups”. Da lì vedrai i gruppi a cui il tuo numero ha accesso.
- Usando l'API, interroga i gruppi disponibili sul tuo dispositivo per questo endpoint.
Prepara la richiesta
URL API di destinazione usando il metodo POST per creare un group
http://api.wassenger.com/v1/devices/{deviceId}/groups
URL API di destinazione usando il metodo POST per inviare messaggi a un group
https://api.wassenger.com/v1/messages
Intestazioni HTTPS richieste > Ottieni la tua chiave API qui
Content-Type: application/json
Token: $API_TOKEN
🤩 🤖 Wassenger è una soluzione API completa per WhatsApp. Iscriviti per una prova gratuita di 7 giorni e inizia in pochi minuti!
Sei uno sviluppatore?
Scopri come usare il codice nel tuo browser senza installare software.
Inoltre, puoi trovare diversi linguaggi che puoi testare su Replit.com:
1. Come creare un gruppo WhatsApp usando PHP
Creare un gruppo WhatsApp tramite l'API di Wassenger è semplice. Ecco come farlo in PHP:
Crea un gruppo con PHP (Guzzle)
// This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP. // Install it first following these instructions: // https://docs.guzzlephp.org/en/stable/overview.html#installation
request('POST', 'https://api.wassenger.com/v1/devices/device.id/groups', \[ 'body' => '{"name":"Group name","description":"This is a group sample description","participants":\[{"phone":"+1234567890","admin":true},{"phone":"+1234567890","admin":false}\],"permissions":{"edit":"admins","send":"all","invite":"admins","approval":false}}', 'headers' => \[ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', \], \]); echo $response\->getBody(); **Crea un gruppo con PHP (http2)** // This code example requires to have installed pecl\_http package, a simple and elegant HTTP client for PHP. // Install it by running: pecl install pecl\_http // More information: https://mdref.m6w6.name/http append(json\_encode(\[ 'name' => 'Group name', 'description' => 'This is a group sample description', 'participants' => \[ \[ 'phone' => '+1234567890', 'admin' => null \], \[ 'phone' => '+1234567890', 'admin' => null \] \], 'permissions' => \[ 'edit' => 'admins', 'send' => 'all', 'invite' => 'admins', 'approval' => null \] \])); $request\->setRequestUrl('https://api.wassenger.com/v1/devices/device.id/groups'); $request\->setRequestMethod('POST'); $request\->setBody($body); $request\->setHeaders(\[ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE' \]); $client\->enqueue($request)->send(); $response = $client\->getResponse(); echo $response\->getBody(); **Crea un gruppo con PHP (curl)** ```php 'https://api.wassenger.com/v1/devices/{{device.id}}/groups', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'name' => 'Group name', 'description' => 'This is a group sample description', 'participants' => [ [ 'phone' => '+1234567890', 'admin' => null, ], [ 'phone' => '+1234567890', 'admin' => null, ], ], 'permissions' => [ 'edit' => 'admins', 'send' => 'all', 'invite' => 'admins', 'approval' => null, ], ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Token: ENTER API KEY HERE', ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo 'cURL Error #:' . $err; } else { echo $response; } ``` ✅ **Questo crea un nuovo gruppo WhatsApp** chiamato “Customer Support Group” e aggiunge due partecipanti. > *🤩 🤖* [***Wassenger***](https://wassenger.com/) *è una piattaforma di comunicazione completa e una soluzione API per WhatsApp.* [***Esplora più di 100 casi d'uso API e automatizza qualsiasi cosa su WhatsApp***](https://wassenger.com/) *iscrivendoti* [*per una prova gratuita e iniziando in pochi minuti****!***](https://wassenger.com/register) ### 2\. Come inviare messaggi ai gruppi WhatsApp usando PHP Una volta creato il gruppo, puoi inviargli messaggi usando l'ID univoco del gruppo: **Invia un messaggio di testo con PHP (Guzzle)** ```php // This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP. // Install it first following these instructions: // https://docs.guzzlephp.org/en/stable/overview.html#installation request('POST', 'https://api.wassenger.com/v1/messages', [ 'body' => '{"group":"group_id@g.us", "message":"Sample group message"}', 'headers' => [ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', ], ]); echo $response->getBody(); ``` **Invia un messaggio di testo con PHP (http2)** ```php // This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP. // Install it by running: pecl install pecl_http // More information: https://mdref.m6w6.name/http append( json_encode([ 'group' => 'group_id@g.us', 'message' => 'Sample group message', ]) ); $request->setRequestUrl('https://api.wassenger.com/v1/messages'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setHeaders([ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', ]); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` **Invia un messaggio di testo con PHP (curl)** ```php 'https://api.wassenger.com/v1/messages', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'group' => 'group_id@g.us', 'message' => 'Sample group message', ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Token: ENTER API KEY HERE', ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo 'cURL Error #:' . $err; } else { echo $response; } ``` Puoi anche aggiungere media ai tuoi messaggi: **Invia messaggi multimediali con PHP (Guzzle)** ```php // This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP. // Install it first following these instructions: // https://docs.guzzlephp.org/en/stable/overview.html#installation request('POST', 'https://api.wassenger.com/v1/messages', [ 'body' => '{"group":"group_id@g.us", "message":"This is a caption for an image message", "media":{"url":"https://picsum.photos/seed/picsum/600/400", "viewOnce":false}}', 'headers' => [ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', ], ]); echo $response->getBody(); ``` **Invia messaggi multimediali con PHP (http2)** ```php // This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP. // Install it by running: pecl install pecl_http // More information: https://mdref.m6w6.name/http append( json_encode([ 'group' => 'group_id@g.us', 'message' => 'This is a caption for an image message', 'media' => [ 'url' => 'https://picsum.photos/seed/picsum/600/400', 'viewOnce' => null, ], ]) ); $request->setRequestUrl('https://api.wassenger.com/v1/messages'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setHeaders([ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', ]); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` **Invia messaggi multimediali con PHP (curl)** ```php 'https://api.wassenger.com/v1/messages', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'group' => 'group_id@g.us', 'message' => 'This is a caption for an image message', 'media' => [ 'url' => 'https://picsum.photos/seed/picsum/600/400', 'viewOnce' => null, ], ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Token: ENTER API KEY HERE', ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo 'cURL Error #:' . $err; } else { echo $response; } ``` ✅ **Questo invia automaticamente un messaggio al gruppo WhatsApp specificato.** > ***È stato utile***? Trova altri esempi nel nostro *[***API Live Tester***](https://app.wassenger.com/help/api-tester)* *🤖* ### 3\. Come programmare messaggi in un gruppo WhatsApp usando PHP La programmazione dei messaggi ti permette di inviare aggiornamenti al momento giusto: **Programma un messaggio con PHP (Guzzle)** ```php // This code example requires to have installed Guzzle package, a flexible and elegant HTTP client for PHP. // Install it first following these instructions: // https://docs.guzzlephp.org/en/stable/overview.html#installation request('POST', 'https://api.wassenger.com/v1/messages', [ 'body' => '{"group":"group_id@g.us", "message":"This is a scheduled message to be sent tomorrow to a group chat.Date format is based on ISO 8601 format with default UTC time zone", "deliverAt":"2025-03-07T10:23:53.810Z"}', 'headers' => [ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', ], ]); echo $response->getBody(); ``` **Programma un messaggio con PHP (http2)** ```php // This code example requires to have installed pecl_http package, a simple and elegant HTTP client for PHP. // Install it by running: pecl install pecl_http // More information: https://mdref.m6w6.name/http append( json_encode([ 'group' => 'group_id@g.us', 'message' => 'This is a scheduled message to be sent tomorrow to a group chat.Date format is based on ISO 8601 format with default UTC time zone', 'deliverAt' => '2025-03-07T10:23:53.810Z', ]) ); $request->setRequestUrl('https://api.wassenger.com/v1/messages'); $request->setRequestMethod('POST'); $request->setBody($body); $request->setHeaders([ 'Content-Type' => 'application/json', 'Token' => 'ENTER API KEY HERE', ]); $client->enqueue($request)->send(); $response = $client->getResponse(); echo $response->getBody(); ``` **Programma un messaggio con PHP (curl)** ```php 'https://api.wassenger.com/v1/messages', CURLOPT_RETURNTRANSFER => true, CURLOPT_ENCODING => '', CURLOPT_MAXREDIRS => 10, CURLOPT_TIMEOUT => 30, CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode([ 'group' => 'group_id@g.us', 'message' => 'This is a scheduled message to be sent tomorrow to a group chat.Date format is based on ISO 8601 format with default UTC time zone', 'deliverAt' => '2025-03-07T10:23:53.810Z', ]), CURLOPT_HTTPHEADER => [ 'Content-Type: application/json', 'Token: ENTER API KEY HERE', ], ]); $response = curl_exec($curl); $err = curl_error($curl); curl_close($curl); if ($err) { echo 'cURL Error #:' . $err; } else { echo $response; } ``` ✅ **Questo programma automaticamente un messaggio da inviare in un momento successivo.** > ***È stato utile***? Trova altri esempi nel nostro *[***API Live Tester***](https://app.wassenger.com/help/api-tester)* *🤖*  [Prova il nostro API-Live tester ora](https://app.wassenger.com/help/api-tester)! ### Domande frequenti (FAQ) 🤔 #### 1\. Posso usare l'API di Wassenger per rimuovere utenti da un gruppo WhatsApp? Questa guida si concentra sulla messaggistica, ma l'API di Wassenger fornisce opzioni di gestione dei gruppi, inclusi aggiungere o rimuovere utenti. 📢 **Hai bisogno di più aiuto?** Visita il [Wassenger Help Center](https://app.wassenger.com/help) per documentazione dettagliata e supporto! #### 2\. Posso inviare immagini, video o documenti ai gruppi WhatsApp usando l'API di Wassenger? Assolutamente! L'API di Wassenger ti permette di inviare contenuti multimediali come immagini, video, PDF e altro ai tuoi gruppi WhatsApp. #### 3\. Come posso verificare se il mio messaggio è stato consegnato correttamente a un gruppo WhatsApp? Puoi usare l'API di Wassenger per recuperare gli aggiornamenti di stato dei messaggi, assicurandoti che i tuoi messaggi siano consegnati e letti. #### 4\. Posso menzionare utenti specifici in un messaggio di gruppo WhatsApp? Sì! Puoi menzionare partecipanti specifici includendo i loro numeri di telefono nel payload del messaggio. > *📌* ***Pronto ad automatizzare la tua messaggistica WhatsApp?*** [*Inizia la tua prova gratuita oggi!*](https://app.wassenger.com/register) *🚀* Con [**Wassenger**](https://wassenger.com) **e PHP**, puoi creare, inviare e programmare messaggi ai gruppi WhatsApp senza sforzo, rendendo la comunicazione più fluida ed efficiente.





