Skip to content

CreateGroup#

Beta version

The functionality is in beta. Features may change and may also work unstably.

The method creates a group chat in Instagram Direct.

Accounts from chatIds that are not found in Instagram or are deactivated are left out, and the group is created with the rest of the participants. The response does not list the left-out accounts. If less than two participants remain, the group is not created.

The method uses the limits on the number of requests per second.

Request#

To create a group, you have to execute a request at:

POST
{{apiUrl}}/waInstance{{idInstance}}/createGroup/{{apiTokenInstance}}

For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.

Request parameters#

Parameter Type Mandatory Description
groupName string Yes The name of the group. The maximum length is 100 characters
chatIds array Yes The participants: the numeric identifier or a username with the @ prefix for each, at least two. The instance account itself and duplicates in the list are not counted

Request body example#

{
    "groupName": "Work group",
    "chatIds": [
        "49547665464",
        "25025320"
    ]
}

Participants by nicknames:

{
    "groupName": "Work group",
    "chatIds": [
        "@green_api",
        "@instagram"
    ]
}

Response#

Response parameters#

Field Type Description
created boolean The flag of the group being created
chatId string The identifier of the created group chat
groupInviteLink string The invite link to the group. An empty string means the group has no link

Response body example#

{
    "created": true,
    "chatId": "340282366841710300949128174631143137232",
    "groupInviteLink": "https://ig.me/j/AbCdEfGhIjKlMnOp"
}

CreateGroup errors#

For a list of errors common to all methods, refer to the Common errors section

HTTP code Error ID Description
400 Bad Request
Validation failed
Validation error
400 Validation failed. Details:
'groupName' is required
The name of the group is not passed
400 Validation failed. Details:
'groupName' is not allowed to be empty
An empty name of the group is passed
400 Validation failed. Details:
'groupName' length must be less than or equal to 100 characters long
The name is longer than 100 characters
400 Validation failed. Details:
'chatIds' is required
The participants are not passed
400 Validation failed. Details:
'chatIds' must contain at least 2 items
Less than two participants are passed
400 Validation failed. Details:
'chatIds' must contain at least 2 accounts other than the instance itself
The list holds less than two participants once the instance account itself and the duplicates are removed from it
200 "created": false, "chatId": "", "groupInviteLink": "" The group is not created: Instagram rejected the request, for example less than two chatIds accounts are found in Instagram and active, or a participant is blocked

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/createGroup/{{apiTokenInstance}}"

payload = {
    "groupName": "Work group",
    "chatIds": ["49547665464", "25025320"]
}
headers = {'Content-Type': 'application/json'}

response = requests.post(url, json=payload, headers=headers)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/createGroup/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "groupName": "Work group",
    "chatIds": ["49547665464", "25025320"]
}'