List groups
GET
/v1/whatsapp/sessions/{sessionId}/groupsReturns the groups the number is in.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
limit | integer | Maximum groups to return, from 1 to 1000. Defaults to 1000. |
offset | integer | Number of groups to skip, for paging. |
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
[
{
"id": "[email protected]",
"name": "Delivery team"
}
]Create a group
POST
/v1/whatsapp/sessions/{sessionId}/groupsCreates a group with the given participants.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
namerequired | string | The group name. |
participantsrequired | string[] | Chat ids of the people to add. |
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups" \
-H "X-API-Key: $TUSK_WA_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Delivery team",
"participants": [
"[email protected]",
"[email protected]"
]
}'201 Created
{
"id": "[email protected]",
"name": "Delivery team",
"participantsCount": 3,
"isAdmin": true
}Get a group
GET
/v1/whatsapp/sessions/{sessionId}/groups/{groupId}Returns group details and participants.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
groupIdrequired | path | The group id, ending in @g.us. |
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups/[email protected]" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
{
"id": "[email protected]",
"name": "Delivery team",
"description": "Daily dispatch",
"participants": [
{
"id": "[email protected]",
"number": "254700000002",
"isAdmin": true,
"isSuperAdmin": true
}
],
"isAnnounce": false,
"memberAddMode": "all"
}Add participants
POST
/v1/whatsapp/sessions/{sessionId}/groups/{groupId}/participantsAdds people to a group. The response reports the outcome for each person.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
groupIdrequired | path | The group id. |
participantsrequired | string[] | Chat ids to add. |
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups/[email protected]/participants" \
-H "X-API-Key: $TUSK_WA_KEY" \
-H "Content-Type: application/json" \
-d '{
"participants": [
"[email protected]"
]
}'200 OK
{
"success": true,
"message": "Participants updated",
"results": [
{
"id": "[email protected]",
"success": true,
"status": 200
}
]
}Remove participants
DELETE
/v1/whatsapp/sessions/{sessionId}/groups/{groupId}/participantsRemoves people from a group.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
groupIdrequired | path | The group id. |
participantsrequired | string[] | Chat ids to remove. |
curl -X DELETE "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups/[email protected]/participants" \
-H "X-API-Key: $TUSK_WA_KEY" \
-H "Content-Type: application/json" \
-d '{
"participants": [
"[email protected]"
]
}'200 OK
{
"success": true,
"message": "Participants updated",
"results": [
{
"id": "[email protected]",
"success": true,
"status": 200
}
]
}Leave a group
POST
/v1/whatsapp/sessions/{sessionId}/groups/{groupId}/leaveMakes the number leave the group.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
groupIdrequired | path | The group id. |
curl -X POST "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups/[email protected]/leave" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
{
"success": true,
"message": "Left group"
}Get the invite link
GET
/v1/whatsapp/sessions/{sessionId}/groups/{groupId}/invite-codeReturns the group's invite code and link.
| Name | Type | Description |
|---|---|---|
sessionIdrequired | path | The session id from the sessions endpoints. |
groupIdrequired | path | The group id. |
curl "https://api.tuskmail.africa/v1/whatsapp/sessions/$SESSION_ID/groups/[email protected]/invite-code" \
-H "X-API-Key: $TUSK_WA_KEY"200 OK
{
"inviteCode": "AbCdEfGhIjK",
"inviteLink": "https://chat.whatsapp.com/AbCdEfGhIjK"
}