ShowMessagesQueue#
The method is intended for getting the list of messages that are in the sending queue.
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.
The method returns the first 500 messages added to the sending queue.
The method uses limits on the request rate per second.
Request#
To get the list of messages, you need to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{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 |
|---|---|---|
idMessage | string | Message ID |
type | string | Request type: sendMessage/sendFileByUrl/sendLocation/sendPoll |
body | object | Object with data about the message in the queue |
Fields of the body object:
| Field | Type | Description |
|---|---|---|
chatId | string | Chat identifier the message will be sent to |
message | string | Message text |
Response body example#
[
{
"idMessage": "1762333029830",
"type": "sendMessage",
"body": {
"chatId": "10000000",
"message": "test"
}
}
]
Errors#
For the list of errors common to all methods, see the Common errors section
Code examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waaInstance").append({{idInstance}})
.append("/showMessagesQueue/")
.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("/showMessagesQueue/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub ShowMessagesQueue()
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}}/showMessagesQueue/{{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