Messages sending delay#
When sending messages or files, all data are put in the send queue. All messages are sent from the queue sequentially in the order they come in the FIFO queue. This sets the message sending delay from the queue. To change the messages sending delay, use SetSettings method and delaySendMessagesMilliseconds
parameter. The interval is counted from the moment the previous message is sent from the queue. Accordingly, if more time has passed than the interval value, the message will be sent without delay.
The minimum message sending delay is 500 msec.
If the interval is set to more than 86400000 msec, the message will not be sent. The message will be stored in the queue for no more than 24 hours.
To check the current sending delay, use GetSettings method, delaySendMessagesMilliseconds
parameter.
Messages sending delay change#
To change messages sending delay, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/setSettings/{{apiTokenInstance}}
For apiUrl
, idInstance
and apiTokenInstance
request parameters, please refer to Before you start section.
You have to specify the only parameter delaySendMessagesMilliseconds
in the request body.
Request body example to set 5-second messages sending delay#
{
"delaySendMessagesMilliseconds": 5000
}
Request examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/SetSettings/{{apiTokenInstance}}"
payload = "{\r\n\t\"delaySendMessagesMilliseconds\": 5000\r\n}\r\n"
headers = {
'Content-Type': 'application/json'
}
response = requests.post(url, json=payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/setSettings/{{apiTokenInstance}}' \
--header 'Content-Type: application/json' \
--data '{
"delaySendMessagesMilliseconds": 5000
}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/setSettings/")
.append({{apiTokenInstance}});
var headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_JSON);
var jsonBody = "{\"delaySendMessagesMilliseconds\": 15000}";
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("/setSettings/")
.append({{apiTokenInstance}});
var response = Unirest.post(requestUrl.toString())
.header("Content-Type", "application/json")
.body("{\"delaySendMessagesMilliseconds\": 15000}")
.asString();
System.out.println(response);