ClearMessagesQueue#
The method is intended for clearing the queue of messages to be sent.
Messages to be sent are stored in the queue for 24 hours.
Messages are sent only when the instance status is Authorized.
The rate at which messages are sent from the queue is regulated by the Message sending interval parameter.
After a number is blocked and a new one is connected, the queue must be cleared. This is because the messages remaining in the queue may be sent, which can lead to the new number being blocked.
The method uses limits on the request rate per second.
Request#
To clear the message queue, you need to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/clearMessagesQueue/{{apiTokenInstance}}
To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Response#
Response fields#
| Field | Type | Description |
|---|---|---|
isCleared | boolean | Flag that the message queue is cleared |
Response body example#
{
"isCleared": true
}
Errors#
For the list of errors common to all methods, see the Common errors section
Code examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/clearMessagesQueue/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/clearMessagesQueue/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/clearMessagesQueue/")
.append({{apiTokenInstance}});
var response = restTemplate.exchange(requestUrl.toString(), HttpMethod.GET, null, String.class);
System.out.println(response);
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/clearMessagesQueue/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub ClearMessagesQueue()
Dim url As String
Dim http As Object
Dim response As String
' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
url = "{{apiUrl}}/waInstance{{idInstance}}/clearMessagesQueue/{{apiTokenInstance}}"
Set http = CreateObject("MSXML2.XMLHTTP")
http.Open "GET", url, False
http.Send
response = http.responseText
Debug.Print response
' Outputting the answer to the desired cell
' Range("A1").Value = response
Set http = Nothing
End Sub