GetGroupData#
The method gets group chat data.
Request#
To get group chat data, you have to execute a request at:
POST https://api.greenapi.com/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}
For idInstance
and apiTokenInstance
, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
groupId | string | Yes | Group chat Id |
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 |
Participants
array 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
Request examples#
import requests
url = "https://api.greenapi.com/waInstance{{idInstance}}/getGroupData/{{apiTokenInstance}}"
payload = "{\r\n\t\"groupId\": \"11001234567-1587570015@g.us\"\r\n}"
headers = {
'Content-Type': 'application/json'
}
response = requests.request("POST", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location 'https://api.green-api.com/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("https://api.greenapi.com")
.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("https://api.greenapi.com")
.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);