GetGroupData#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method returns the data of a group chat: the name, the invite link, the settings, the number and the list of participants with the username and the admin flag.
A personal chat is not a group: the method responds to its identifier with a 400 error.
The method uses the limits on the number of requests per second.
Request#
To get the data of a group, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
chatId | string | Yes | The identifier of the group chat |
Request body example#
{
"chatId": "340282366841710300949128174631143137232"
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
chatId | string | The identifier of the group chat |
type | string | The type of the chat. Always group: there are no channels in Instagram Direct |
subject | string | The name of the group |
groupInviteLink | string | The invite link to the group. An empty string means the invitation by link is disabled for the group |
allowParticipantsAddMembers | boolean | The participants add people without an admin approval. It is changed by the UpdateGroupSettings method. On an instance authorized via a browser session it is always false |
size | integer | The number of participants, including the account of the instance itself |
participants | array | The participants of the group, including the account itself. The format of an item is the participant object |
Fields of the participant object#
| Field | Type | Description |
|---|---|---|
chatId | string | The numeric identifier of the participant |
name | string | The name of the participant from the Instagram profile. If the profile has no name - the username without @ |
username | string | The username of the participant with the @ prefix |
isAdmin | boolean | The participant is an admin of the group |
Response body example#
{
"chatId": "340282366841710300949128174631143137232",
"type": "group",
"subject": "Work group",
"groupInviteLink": "https://ig.me/j/AbCdEfGhIjKlMnOp",
"allowParticipantsAddMembers": true,
"size": 3,
"participants": [
{
"chatId": "49547665464",
"name": "GREEN-API",
"username": "@green_api",
"isAdmin": true
},
{
"chatId": "25025320",
"name": "Instagram",
"username": "@instagram",
"isAdmin": false
},
{
"chatId": "74857974059",
"name": "GREEN-API EN",
"username": "@green_api_eng",
"isAdmin": false
}
]
}
GetGroupData 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 | chatId '49547665464' is not a group chat | The specified chat is not a group one |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}"
payload = {"chatId": "340282366841710300949128174631143137232"}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{"chatId": "340282366841710300949128174631143137232"}'