ShowMessagesQueue#
Beta version
The functionality is in beta. Features may change and may also work unstably.
The method is used to get the list of messages that are in the queue for sending. 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.
The method returns the first 500 messages added to the queue for sending.
The method uses the limits on the number of requests per second.
Request#
To get the list of messages, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}
For apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Response#
Response parameters#
An array of objects with the fields:
| Field | Type | Description |
|---|---|---|
messageID | string | The identifier of the sending job. Assigned by the system |
type | string | The type of the request: |
- sendMessage - a text message | ||
- sendFileByUrl - an image, a video or a voice message by a link | ||
- sendReaction - a reaction to a message | ||
- deleteMessage - deleting a message | ||
- editMessage - editing a message | ||
- forwardMessages - forwarding messages | ||
- sendComment - a comment to a post | ||
- editComment - editing a comment | ||
- deleteComment - deleting a comment | ||
- sendLikeToComment - liking a comment or removing the like | ||
- sendTyping - a typing notification | ||
- sendPostByUrl - publishing a post | ||
- sendAlbumPostByUrl - publishing a carousel | ||
- sendReelByUrl - publishing a Reel | ||
- editPost - editing a post | ||
- editReel - editing a Reel | ||
- deletePost - deleting a post | ||
- deleteReel - deleting a Reel | ||
body | object | The object of data about the message in the queue |
Fields of the body object:
| Field | Type | Description |
|---|---|---|
chatId | string | The chat identifier the message will be sent to - the numeric identifier. A username with the @ prefix is supported as well |
message | string | The text of the message or of the comment only for type = sendMessage, editMessage, sendComment and editComment |
urlFile | string | The link to the file only for type = sendFileByUrl, sendPostByUrl and sendReelByUrl |
sendAsVoice | boolean | Send the file as a voice message only for type = sendFileByUrl |
urlFiles | array | The links to the carousel files only for type = sendAlbumPostByUrl |
caption | string | The caption of the post only for type = sendPostByUrl, sendAlbumPostByUrl, sendReelByUrl, editPost and editReel |
disableComments | boolean | Publish with the comments closed or close the comments only for type = sendPostByUrl, sendAlbumPostByUrl, sendReelByUrl, editPost and editReel |
postId | string | The post: the one a comment is left, edited, deleted or liked under, or the post being edited or deleted only for type = sendComment, editComment, deleteComment, sendLikeToComment, editPost, editReel, deletePost and deleteReel |
parentCommentId | string | The comment a reply is sent to only for type = sendComment |
commentId | string | The comment being edited, deleted or liked only for type = editComment, deleteComment and sendLikeToComment |
like | boolean | true - set the like, false - remove itonly for type = sendLikeToComment |
quotedMessageId | string | The message a reply is sent to only for type = sendMessage and sendFileByUrl |
idMessage | string | The message a reaction is set to, or the message being deleted or edited only for type = sendReaction, deleteMessage and editMessage |
chatIdFrom | string | The chat the messages are forwarded from only for type = forwardMessages |
messages | array | The identifiers of the forwarded messages only for type = forwardMessages |
reaction | string | The reaction emoji. An empty value removes the reaction only for type = sendReaction |
linkPreview | boolean | Send a link from the text as a link with a preview only for type = sendMessage |
Response body example#
[
{
"messageID": "b1e0c2f8-3f0e-4a1e-9c1a-9f0f8b1c2d3e",
"type": "sendMessage",
"body": {
"chatId": "49547665464",
"message": "test"
}
}
]
ShowMessagesQueue errors#
For a list of errors common to all methods, refer to the Common errors section
Request 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("/waInstance").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