Skip to main content

Create a WhatsApp group

With this endpoint, you will be able to create a new WhatsApp group in your account.

Parameters

These parameters should be sent as a JSON payload in the request body.

FieldDescriptionExample values
from_numberYour WhatsApp number that you connected to 2Chat+18647351567
group.nameA name for the group you are trying to createMy cool WhatsApp group
group.participantsA list of phone numbers you want to add to the group[ "+18647351567", "+17137157533"]
info

You can create the group with up to 10 participants. If you want to add more than this limit, you can call the Add Participant endpoint after the group is created.

Invocation

curl -X POST --location 'https://api.p.2chat.io/open/whatsapp/group/create' \
--header 'Content-Type: application/json' \
--header 'X-User-API-Key: your_api_key_here' \
--data '{
"from_number": "+595981048477",
"group": {
"name": "My cool WhatsApp group",
"participants": [
"+17137157533",
"+18647351567"
]
}
}'

Response

info

After the group is created, it can take a few minutes for 2Chat to be able to see it and list it.

caution

Seeing unaccepted_numbers in the reply means that the numbers listed couldn't be added, either because they are invalid or because they don't have a WhatsApp account.

{
"success": true,
"group": {
"name": "My cool WhatsApp group",
"wa_group_id": "120363777777777777@g.us",
"participants":
{
"+595981048477": {
"statusCode": 200,
"message": "The participant was added successfully",
"isGroupCreator": true,
"isInviteV4Sent": false
},
"+17137157533": {
"statusCode": 200,
"message": "The participant was added successfully",
"isGroupCreator": false,
"isInviteV4Sent": false
},
"+18647351567": {
"statusCode": 200,
"message": "The participant was added successfully",
"isGroupCreator": false,
"isInviteV4Sent": false
}
},
"accepted_numbers": [
"+17137157533",
"+18647351567"
],
"unaccepted_numbers": [],
"uuid": "WAG62598186-d2bd-4946-86c6-30f8a3c849c6"
}
}