ShowMessagesQueue#
The method is aimed for getting a list of messages in the queue to be sent. Messages will be kept for 24 hours in the queue until account will be authorized.
Request#
To get a messages queue, you have to execute a request at:
GET {{apiUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}
For getting idInstance, apiTokenInstance and apiUrl request parameters, refer to section Before you start.
Response#
Response parameters#
Array of objects with parameters:
| Field | Type | Description |
|---|---|---|
messageID | string | Message ID, if type = sendMessage/ sendFileByUrl |
type | string | Request type: |
sendMessage - text message | ||
sendFileByUrl - message with file (messages sent by sendFileByUrl, sendFileByUpload) | ||
body | object | Queue message data object |
Fields of the body object:
| Field | Type | Description |
|---|---|---|
chatId | string | Chat ID to which the message will be sent |
message | string | Message text, if type = sendMessage /sendFileByUrl |
linkPreview | boolean | The parameter includes displaying a preview and a description of the link, if type = sendMessage |
fileName | string | The name of the file to send, if type = sendFileByUrl |
caption | string | Description under the file, if type = sendFileByUrl |
urlFile | string | Link to uploaded file type = sendFileByUrl |
archive | string | The field is deprecated, if type = sendFileByUrl |
chatIdFrom | string | Chat ID from which the message is being forwarded |
Example of response body#
[
{
"messageID": "BAE123456789",
"type": "sendMessage",
"body": {
"chatId": "11001234567@c.us",
"message": "I use GREEN-API to send this message to you!",
"linkPreview": true
}
}
]
ShowMessagesQueue errors#
For a list of errors common to all methods, refer to 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 idInstance and apiTokenInstance values are available in your account, 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