Skip to content

GetGroupData#

Postman Test

The method gets the data of a group chat.

The method uses limits on the request rate per second.

Request#

To get the data of a group chat, you need to execute a request at:

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

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

Request parameters#

Parameter Type Required Description
chatId string Yes Group chat identifier

Request body example#

{
    "chatId": "-10000000000000"
}

Response#

Response fields#

Field Type Description
chatId string Group chat identifier
owner string Identifier of the group owner
subject string Group name
description string Group description (may be an empty string)
creation integer Group creation time in Unix format
groupInviteLink string Group invitation link.
If the "Invite by link" setting is disabled in the group, the field will be empty
isSupergroup boolean Supergroup flag, true / false
isChannel boolean Channel flag, true / false
allowParticipantsSendMessages boolean Permission for participants to send text messages, true / false
allowParticipantsSendMedia boolean Permission for participants to send media files (photos, videos), true / false
allowParticipantsSendPolls boolean Permission for participants to send polls, true / false
allowParticipantsSendOtherMessages boolean Permission for participants to send other messages (stickers, GIFs), true / false
allowParticipantsAddWebPagePreviews boolean Permission for participants to add link previews in messages (Rich Link Previews), true / false
allowParticipantsEditGroupSettings boolean Permission for participants to change the group settings, true / false
allowParticipantsAddMembers boolean Permission for participants to add other participants to the group, true / false
allowParticipantsPinMessages boolean Permission for participants to pin messages in the group, true / false
size integer Number of participants in the group
participants array Collection of group participants

Fields of the objects from the participants array

Field Type Description
chatId string Identifier of the group chat participant
name string Name of the group participant
isAdmin boolean Group administrator flag
isSuperAdmin boolean Group super administrator flag

Response body example#

{
    "chatId": "-10000000000000",
    "owner": "10000001",
    "subject": "GREEN-API Group",
    "description": "Description of the group",
    "creation": 1755774955,
    "groupInviteLink": "https://t.me/+AbCdEfGhIjKlMnOp",
    "isSupergroup": true,
    "isChannel": false,
    "allowParticipantsSendMessages": true,
    "allowParticipantsSendMedia": true,
    "allowParticipantsSendPolls": true,
    "allowParticipantsSendOtherMessages": true,
    "allowParticipantsAddWebPagePreviews": true,
    "allowParticipantsEditGroupSettings": false,
    "allowParticipantsAddMembers": true,
    "allowParticipantsPinMessages": false,
    "size": 2,
    "participants": [
        {
            "chatId": "10000000",
            "name": "Vasilisa",
            "isAdmin": false,
            "isSuperAdmin": false
        },
        {
            "chatId": "10000001",
            "name": "Ivan",
            "isAdmin": true,
            "isSuperAdmin": true
        }
    ]
}

Errors#

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

HTTP code Error identifier Description
200 Error: forbidden You are not a member of the group
200 Error: item-not-found The group does not exist
400 Bad Request
Validation failed
Validation error
400 Bad Request
Validation failed.
Details: 'chatId' must be the next formats:
Incorrect format of the chatId field, the field is specified in the -10000000000000 format

Code examples#

import requests

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

payload = {
    "chatId": "-10000000000000"
}
headers = {'Content-Type': 'application/json'}

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

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
    "chatId": "-10000000000000"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getGroupData/")
    .append({{apiTokenInstance}});

var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);

var jsonBody = "{\"chatId\": \"-10000000000000\"}";

var requestEntity = new HttpEntity<>(jsonBody, headers);

var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.POST, requestEntity, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getGroupData/")
    .append({{apiTokenInstance}});

var response = Unirest.post(requestUrl.toString())
    .header("Content-Type", "application/json")
    .body("{\"chatId\": \"-10000000000000\"}")
    .asString();

System.out.println(response);
Sub GetGroupData()
    Dim url As String
    Dim RequestBody As String
    Dim http As Object
    Dim response As String

    ' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
    url = "{{apiUrl}}/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}"

    RequestBody = "{""chatId"":""-10000000000000""}"

    Set http = CreateObject("MSXML2.XMLHTTP")

    With http
        .Open "POST", url, False
        .setRequestHeader "Content-Type", "application/json"
        .Send RequestBody
    End With

    response = http.responseText

    Debug.Print response

    ' Outputting the answer to the desired cell
    Range("A1").Value = response

    Set http = Nothing
End Sub