Skip to content

GetGroupData#

Test Postman Apidog

The method gets group chat data.

Request#

To get group chat data, you have to execute a request at:

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

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

Request parameters#

Parameter Type Mandatory Description
groupId string Yes Group chat Id

Note

If the user is not an administrator or the group owner, the method will return code 200 and an empty groupInviteLink field. To resolve this issue, make requests from the group owner or give administrator rights to the user with the instance.

Request body example#

{
    "groupId": "11001234567-1587570015@g.us"
}

Response#

Response parameters#

Parameter Type Description
groupId string Group chat Id
owner string Group owner Id
subject string Group name
creation integer Group creation time in Unix format
participants array Group participants collection
subjectTime integer Group name creation time in Unix format
subjectOwner string User Id who created the group name
groupInviteLink string Group invitation link

Participantsarray subjects parameters

Parameter Type Description
id string Group chat participant Id
isAdmin boolean Flag whether the user is a group administrator
isSuperAdmin boolean Flag whether the user is a group super administrator

Response body example#

{
    "groupId": "11001234567-1587570015@g.us",
    "owner": "11001234567@c.us",
    "subject": "Green API Group",
    "creation": 1587570015,
    "participants": [
        {
            "id": "11001234567@c.us",
            "isAdmin": true,
            "isSuperAdmin": true
        },
        {
            "id": "79001234568@c.us",
            "isAdmin": true,
            "isSuperAdmin": false
        },
        {
            "id": "79001234569@c.us",
            "isAdmin": false,
            "isSuperAdmin": false
        }
    ],
    "subjectTime": 1587737715,
    "subjectOwner": "11001234567@c.us",
    "groupInviteLink": "https://chat.whatsapp.com/xxxxxxxxxxxxxxxxxxxxxx"
}

GetGroupData errors#

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

HTTP code Error iD 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: 'groupId' must be the next formats: 'group_id@g.us
Invalid format of field groupId, field is specified in format group_id@g.us

Request examples#

import requests

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

payload = {(
    "groupId": "11011234567@g.us")
}
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 '{
    "groupId": "11111111111111111@g.us"
}'
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 = "{\"groupId\": \"11111111111111111@g.us\"}";

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("{\"groupId\": \"11111111111111111@g.us\"}")
    .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}}"

    ' groupId - group chat identifier
    RequestBody = "{""groupId"":""120123400367448864@g.us""}"

    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