UpdateGroupSettings#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method changes the settings of a group chat.
The method uses the limits on the number of requests per second.
Limitations with the browser session authorization
On an instance authorized through a browser session, the settings of the group are not changed.
The response of the method in this case is 200 with "updateGroupSettings": false without the reason field.
Request#
To change the settings of a group, you have to execute a request at:
POST
{{apiUrl}}/waInstance{{idInstance}}/updateGroupSettings/{{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 |
allowParticipantsAddMembers | boolean | No | - true - the participants add people themselves,- false - adding requires an admin approval |
Request body example#
Allow the participants to add people:#
{
"chatId": "340282366841710300949128174631143137232",
"allowParticipantsAddMembers": true
}
Require an admin approval:#
{
"chatId": "340282366841710300949128174631143137232",
"allowParticipantsAddMembers": false
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
updateGroupSettings | boolean | The flag of the group settings being changed |
reason | string | The reason the setting is not changed: NO_SETTINGS_TO_UPDATE, FORBIDDEN or NOT_ENOUGH_RIGHTS. It is passed only with "updateGroupSettings": false |
Response body example#
The setting has been changed:#
{
"updateGroupSettings": true
}
The setting has not been changed:#
{
"updateGroupSettings": false,
"reason": "NOT_ENOUGH_RIGHTS"
}
UpdateGroupSettings 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 | Validation failed. Details: 'allowParticipantsAddMembers' must be a boolean | The setting is passed as a non-boolean value |
| 400 | Validation failed. Details: 'allowParticipantsPinMessages' is not allowed | A setting that Instagram Direct groups do not have is passed |
| 200 | "updateGroupSettings": false, "reason": "NO_SETTINGS_TO_UPDATE" | The allowParticipantsAddMembers setting is not passed or is passed as null: there is nothing to change |
| 200 | "updateGroupSettings": false, "reason": "FORBIDDEN" | The setting is not changed: the group is not found |
| 200 | "updateGroupSettings": false, "reason": "NOT_ENOUGH_RIGHTS" | The setting is not changed: Instagram rejected the request, for example the instance account has no rights for this action in the group |
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/updateGroupSettings/{{apiTokenInstance}}"
payload = {
"chatId": "340282366841710300949128174631143137232",
"allowParticipantsAddMembers": True
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/updateGroupSettings/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"chatId": "340282366841710300949128174631143137232",
"allowParticipantsAddMembers": true
}'