Gruppi
Gestisci i gruppi WhatsApp tramite l’API Wappfy. Puoi creare gruppi, gestire i partecipanti, gestire i link di invito e altro ancora.
Tutti gli endpoint dei gruppi sono associati a un’istanza specifica:
/api/instances/{instanceId}/groups/...
Creare un gruppo
Crea un nuovo gruppo WhatsApp con i partecipanti iniziali.
curl -X POST https://api.wappfy.io/api/instances/inst_abc123/groups \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Project Alpha",
"participants": [
"5511999998888@s.whatsapp.net",
"5511888887777@s.whatsapp.net"
]
}'
Risposta:
{
"data": {
"group_id": "120363012345678901@g.us",
"name": "Project Alpha",
"participants": [
{
"id": "5511999998888@s.whatsapp.net",
"is_admin": false
},
{
"id": "5511888887777@s.whatsapp.net",
"is_admin": false
}
]
}
}
Elencare i gruppi
Recupera tutti i gruppi di cui l’istanza e membro.
curl https://api.wappfy.io/api/instances/inst_abc123/groups \
-H "X-Api-Key: YOUR_API_KEY"
Risposta:
{
"data": [
{
"group_id": "120363012345678901@g.us",
"name": "Project Alpha",
"participant_count": 5
},
{
"group_id": "120363098765432109@g.us",
"name": "Support Team",
"participant_count": 12
}
]
}
Recupera informazioni dettagliate su un gruppo specifico.
curl https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us \
-H "X-Api-Key: YOUR_API_KEY"
Risposta:
{
"data": {
"group_id": "120363012345678901@g.us",
"name": "Project Alpha",
"description": "Team workspace for Project Alpha",
"owner": "5511999998888@s.whatsapp.net",
"created_at": "2026-01-15T10:00:00Z",
"participants": [
{
"id": "5511999998888@s.whatsapp.net",
"is_admin": true,
"is_super_admin": true
},
{
"id": "5511888887777@s.whatsapp.net",
"is_admin": false,
"is_super_admin": false
}
]
}
}
Aggiornare un gruppo
Aggiorna il nome o la descrizione del gruppo. Devi essere un amministratore del gruppo per eseguire questa azione.
curl -X PATCH https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Project Alpha v2",
"description": "Updated workspace for Project Alpha"
}'
Solo gli amministratori del gruppo possono aggiornare il nome e la descrizione. Se l’istanza non e un amministratore, verra restituito un errore 403.
Abbandonare un gruppo
Rimuovi l’istanza da un gruppo.
curl -X POST https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us/leave \
-H "X-Api-Key: YOUR_API_KEY"
Dopo aver abbandonato un gruppo, sara necessario un link di invito o che un altro amministratore ti aggiunga nuovamente.
Partecipanti
Elencare i partecipanti
Ottieni tutti i partecipanti di un gruppo.
curl https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us/participants \
-H "X-Api-Key: YOUR_API_KEY"
Risposta:
{
"data": [
{
"id": "5511999998888@s.whatsapp.net",
"is_admin": true,
"is_super_admin": true
},
{
"id": "5511888887777@s.whatsapp.net",
"is_admin": false,
"is_super_admin": false
},
{
"id": "5511777776666@s.whatsapp.net",
"is_admin": true,
"is_super_admin": false
}
]
}
Aggiungere partecipanti
Aggiungi uno o piu partecipanti a un gruppo. Devi essere un amministratore del gruppo.
curl -X POST https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us/participants \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"participants": [
"5511666665555@s.whatsapp.net",
"5511555554444@s.whatsapp.net"
]
}'
Rimuovere partecipanti
Rimuovi uno o piu partecipanti da un gruppo. Devi essere un amministratore del gruppo.
curl -X DELETE https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us/participants \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"participants": [
"5511666665555@s.whatsapp.net"
]
}'
Codici di invito
Ottenere il codice di invito
Genera o recupera il link di invito del gruppo. Devi essere un amministratore del gruppo.
curl https://api.wappfy.io/api/instances/inst_abc123/groups/120363012345678901@g.us/invite-code \
-H "X-Api-Key: YOUR_API_KEY"
Risposta:
{
"data": {
"invite_code": "https://chat.whatsapp.com/AbCdEfGhIjKlMn"
}
}
Unirsi tramite codice di invito
Unisciti a un gruppo utilizzando un codice di invito.
curl -X POST https://api.wappfy.io/api/instances/inst_abc123/groups/join \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"invite_code": "AbCdEfGhIjKlMn"
}'
Passa solo la parte del codice, non l’URL completo. Per https://chat.whatsapp.com/AbCdEfGhIjKlMn, passa AbCdEfGhIjKlMn.
Inviare messaggi ai gruppi
Per inviare un messaggio a un gruppo, usa l’endpoint standard di invio messaggi con l’ID chat del gruppo:
curl -X POST https://api.wappfy.io/api/instances/inst_abc123/messages/send \
-H "X-Api-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"chat_id": "120363012345678901@g.us",
"type": "text",
"text": "Hello team!"
}'
Gli ID chat dei gruppi terminano sempre con @g.us.
Riferimento degli endpoint
| Metodo | Endpoint | Descrizione |
|---|
POST | /api/instances/{id}/groups | Crea un nuovo gruppo |
GET | /api/instances/{id}/groups | Elenca tutti i gruppi |
GET | /api/instances/{id}/groups/{groupId} | Ottieni informazioni sul gruppo |
PATCH | /api/instances/{id}/groups/{groupId} | Aggiorna nome/descrizione del gruppo |
POST | /api/instances/{id}/groups/{groupId}/leave | Abbandona un gruppo |
GET | /api/instances/{id}/groups/{groupId}/participants | Elenca i partecipanti |
POST | /api/instances/{id}/groups/{groupId}/participants | Aggiungi partecipanti |
DELETE | /api/instances/{id}/groups/{groupId}/participants | Rimuovi partecipanti |
GET | /api/instances/{id}/groups/{groupId}/invite-code | Ottieni il codice di invito |
POST | /api/instances/{id}/groups/join | Unisciti tramite codice di invito |
Gestione degli errori
| Codice di stato | Descrizione |
|---|
403 | Non sei un amministratore di questo gruppo. |
404 | Gruppo non trovato o l’istanza non e un membro. |
409 | Il partecipante e gia nel gruppo (in caso di aggiunta) o non e nel gruppo (in caso di rimozione). |
422 | Formato del partecipante non valido. Usa {phone}@s.whatsapp.net. |