SetSettings#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method sets the settings of an instance.
The settings are applied within 5 minutes after the method is called.
The method uses the limits on the number of requests per second.
Request#
To set the instance settings, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/setSettings/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request parameters#
The parameters can be specified selectively: the parameters that are not passed keep their current values.
| Parameter | Type | Mandatory | Description |
|---|---|---|---|
webhookUrl | string | No | The address for sending notifications. An empty string turns the sending off |
webhookUrlToken | string | No | The token for the authorization on your notification server |
delaySendMessagesMilliseconds | integer | No | The message sending delay in milliseconds: from 500 to 60000. A value outside the bounds is brought to the nearest bound |
markIncomingMessagesReaded | string | No | Mark incoming messages as read on receipt: yes, no |
markIncomingMessagesReadedOnReply | string | No | Mark incoming messages as read when sending a message via the API: yes, no. Takes precedence over markIncomingMessagesReaded |
outgoingWebhook | string | No | Receive notifications about the statuses of sent messages: yes, no |
outgoingMessageWebhook | string | No | Receive notifications about messages sent not via the API: yes, no |
outgoingAPIMessageWebhook | string | No | Receive notifications about messages sent via the API: yes, no |
outgoingCommentWebhook | string | No | Receive notifications about comments left not via the API: yes, no |
outgoingAPICommentWebhook | string | No | Receive notifications about comments sent via the API: yes, no |
outgoingCommentStatusWebhook | string | No | Receive notifications about the statuses of comments via the API - sending, editing, deletion and like: yes, no. The failed status always arrives |
outgoingAPIPostWebhook | string | No | Receive notifications about posts created via the API: yes, no |
outgoingPostStatusWebhook | string | No | Receive notifications about the statuses of posts via the API - creation, editing and deletion: yes, no. The failed status always arrives |
incomingWebhook | string | No | Receive notifications about incoming messages: yes, no |
incomingCommentWebhook | string | No | Receive notifications about incoming comments: yes, no |
incomingLikeWebhook | string | No | Receive notifications about likes on posts, Reels and comments of the account: yes, no |
incomingMessageStatusWebhook | string | No | Receive notifications about incoming messages being read: yes, no |
stateWebhook | string | No | Receive notifications about the instance state change: yes, no |
editedMessageWebhook | string | No | Receive notifications about edited messages: yes, no |
deletedMessageWebhook | string | No | Receive notifications about deleted messages: yes, no |
pollMessageWebhook | string | No | Receive notifications about polls and votes in them: yes, no |
The settings only govern the sending of notifications
A disabled setting cancels the notification but not the writing of the message to the journal. The messages no notifications came about stay available by the LastIncomingMessages, LastOutgoingMessages and GetChatHistory methods.
Request body example#
{
"webhookUrl": "https://mysite.com/webhook/",
"incomingWebhook": "yes",
"outgoingMessageWebhook": "yes",
"outgoingAPIMessageWebhook": "yes",
"stateWebhook": "yes"
}
Response#
Response parameters#
| Field | Type | Description |
|---|---|---|
saveSettings | boolean | The flag of the settings being saved |
Response body example#
{
"saveSettings": true
}
SetSettings errors#
For a list of errors common to all methods, refer to the Common errors section
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/setSettings/{{apiTokenInstance}}"
payload = {
"webhookUrl": "https://mysite.com/webhook/",
"incomingWebhook": "yes",
"outgoingMessageWebhook": "yes",
"outgoingAPIMessageWebhook": "yes",
"stateWebhook": "yes"
}
headers = {'Content-Type': 'application/json'}
response = requests.post(url, json=payload, headers=headers)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/setSettings/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"webhookUrl": "https://mysite.com/webhook/",
"incomingWebhook": "yes",
"outgoingMessageWebhook": "yes",
"outgoingAPIMessageWebhook": "yes",
"stateWebhook": "yes"
}'