RemoveGroupParticipant#
The method removes a participant from a group chat.
Request#
To remove a participant from a group chat, you have to execute a request at:
POST https://api.greenapi.com/waInstance{{idInstance}}/removeGroupParticipant/{{apiTokenInstance}}
For idInstance
and apiTokenInstance
request parameters, refer to Before you start section.
Request parameters#
Parameter | Type | Mandatory | Description |
---|---|---|---|
groupId | string | Yes | Group chat Id |
participantChatId | string | Yes | Id of a participant removed from a group |
Request body example#
Group chat participant removal:
{
"groupId": "11001234567-1587570015@g.us",
"participantChatId": "79001234565@c.us"
}
Response#
Response parameters#
Parameter | Type | Description |
---|---|---|
removeParticipant | boolean | Group participant removal flag |
Response body example#
{
"removeParticipant": true
}
RemoveGroupParticipant 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}}/removeGroupParticipant/{{apiTokenInstance}}"
payload = "{\r\n \"groupId\": \"11001234567-1587570015@g.us\",\r\n \"participantChatId\": \"79001234568@c.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}}/removeGroupParticipant/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"groupId": "120363169960827018@g.us",
"participantChatId": "79851150769@c.us"
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append("https://api.greenapi.com")
.append("/waInstance").append({{idInstance}})
.append("/removeGroupParticipant/")
.append({{apiTokenInstance}});
var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
var jsonBody = "{\"groupId\": \"111111112222222333333@g.us\",\"participantChatId\": \"12345678910@c.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("/removeGroupParticipant/")
.append({{apiTokenInstance}});
var response = Unirest.post(requestUrl.toString())
.header("Content-Type", "application/json")
.body("{\"groupId\": \"111111112222222333333@g.us\",\"participantChatId\": \"12345678910@c.us\"}")
.asString();
System.out.println(response);