Skip to content

ClearMessagesQueue#

Beta version

The functionality is in beta. Features may change and may also work unstably.

The method is used to clear the queue of messages to be sent. A message is kept for 24 hours in the queue and is sent right after the instance is authorized. The messages sending rate is managed by the Messages sending delay parameter.

After an account is blocked and a new one is connected, you have to clear the queue: otherwise the messages remaining in it will be sent from the new account and may lead to its blocking.

The method uses the limits on the number of requests per second.

Request#

To clear the messages queue, you have to execute a request at:

GET
{{apiUrl}}/waInstance{{idInstance}}/clearMessagesQueue/{{apiTokenInstance}}

For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.

Response#

Response parameters#

Parameter Type Description
isCleared boolean Messages queue clearing flag

Response body example#

{
    "isCleared": true
}

ClearMessagesQueue errors#

For a list of errors common to all methods, refer to the Common errors section

Request 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