CreateGroup#
The method is aimed for creating a group chat.
Request#
To create a group chat, you have to execute a request at:
POST https://api.green-api.com/waInstance{{idInstance}}/CreateGroup/{{apiTokenInstance}}
For idInstance
and apiTokenInstance
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
groupName | string | Yes | New group chat name |
chatIds | array | Yes | Collection of group participants Ids |
Request body example#
{
"groupName": "Group created by Green API",
"chatIds": [
"79001234568@c.us",
"79001234569@c.us"
]
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
created | boolean | Group creation flag |
chatId | string | Group chat Id |
groupInviteLink | string | Group invitation link |
Response body example#
{
"created": true,
"chatId": "11001234567-1587570015@g.us",
"groupInviteLink": "https://chat.whatsapp.com/xxxxxxxxxxxxxxxxxxxxxx"
}
CreateGroup errors#
For a list of errors common to all methods, refer to Common errors section
Python request example#
import requests
url = "https://api.green-api.com/waInstance{{idInstance}}/createGroup/{{apiTokenInstance}}"
payload = "{\r\n\t\"groupName\": \"Group created by Green API\",\r\n \"chatIds\": [\r\n \"11001234567@c.us\",\r\n \"79001234568@c.us\"\r\n ]\r\n}\r\n"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))