GetMessagesCount#
The method is intended for getting the number of messages in the sending queue.
Each message is stored in the queue for 24 hours.
The method uses limits on the request rate per second.
The information in the
GetMessagesCountmethod is updated once every 10 seconds.
Request#
To get the number of messages in the queue, you need to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/getMessagesCount/{{apiTokenInstance}}
To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Response#
Response fields#
An array of objects with the fields:
| Field | Type | Description |
|---|---|---|
count | count | Number of messages in the outgoing queue |
Response body example#
{
"count" : 0
}
Errors#
For the list of errors common to all methods, see the Common errors section
Code examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/getMessagesCount/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getMessagesCount/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/getMessagesCount/")
.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("/getMessagesCount/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub GetMessagesCount()
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}}/getMessagesCount/{{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