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/sendPoll/sendFileByUrl/sendLocation/sendContact/sendLink | 
| messagesIDs | array | Array of message IDs, if type=ForwardMessages | 
| type | string | Request type: | 
| sendMessage- text message | ||
| sendPoll- message with poll | ||
| sendFileByUrl- message with file (messages sent by sendFileByUrl, sendFileByUpload) | ||
| sendLocation- message with location | ||
| sendContact- message with contact | ||
| sendLink- message with link (deprecated) | ||
| ForwardMessages- messages to be forwarded | ||
| 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/sendPoll/sendFileByUrl/sendLocation/sendContact/sendLink | 
| messages | array | Array of forwarded messages, if type=ForwardMessages | 
| linkPreview | boolean | The parameter includes displaying a preview and a description of the link, if type=sendMessage | 
| quotedMessageId | string | Quoted message ID, if type=sendMessage/sendPoll/sendFileByUrl/sendLocation/sendContact/sendLink | 
| options | array | Array of poll options, if type=sendPoll | 
| 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 | 
| latitude | string | The latitude of the location, if type=sendLocation | 
| longitude | string | The longitude of the location, if type=sendLocation | 
| nameLocation | string | Location name, if type=sendLocation | 
| address | string | Location address, if type=sendLocation | 
| contact | object | A data object about a message with a contact, if type=contactMessage | 
| urlLink | string | URL of the link, if type=sendLink(deprecated) | 
| chatIdFrom | string | Chat ID from which the message is being forwarded | 
Fields of the options array:
| Parameter | Type | Description | 
|---|---|---|
| optionName | string | Poll choice option text | 
Fields of the contact object:
| Field | Type | Description | 
|---|---|---|
| phoneContact | string | Contact phone number in international format (without +) 11 or 12 digits | 
| firstName | string | Contact first name | 
| lastName | string | Contact last name | 
| middleName | string | Contact middle name | 
| company | string | Contact company name | 
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
        }
    },
    {
        "messageID": "BAE1234567123",
        "type": "sendMessage",
        "body": {
            "chatId": "11001234567@c.us",
            "message": "Hello",
            "quotedMessageId": "BAE123456789",
            "linkPreview": true
        }
    },
    {
        "messageID": "BAE5DE8CA912345",
        "type": "sendPoll",
        "body": {
            "chatId": "11001234567@c.us",
            "message": "Please choose the color:",
            "options": [
                {
                    "optionName": "green"
                },
                {
                    "optionName": "red"
                }
            ]
        }
    },
    {
        "messageID": "BAE1234567789",
        "type": "sendFileByUrl",
        "body": {
            "fileName": "test.jpg",
            "chatId": "11001234567@c.us",
            "quotedMessageId": "BAE1234567159",
            "caption": "caption",
            "archive": false,
            "urlFile": "https://sw-media-out.storage.yandexcloud.net/1101123456/5005fe15-23ee-43ef-8535-35e1dff8315c.jpg"
        }
    },
    {
        "messageID": "BAE1234561230",
        "type": "sendLocation",
        "body": {
            "chatId": "11001234567@c.us",
            "latitude": 44.9370129,
            "longitude": 89.8728409,
            "nameLocation": "I'm here, come",
            "address": "613123, Perm"
        }
    },
    {
        "messageID": "BAE1234567456",
        "type": "sendContact",
        "body": {
            "chatId": "11001234567@c.us",
            "contact": {
                "phoneContact": 79001234568,
                "firstName": "Harry",
                "lastName": "Aben",
                "middleName": "Paris",
                "company": "Bicycles"
            }
        }
    },
    {
        "messageID": "BAE1234567891234",
        "type": "sendLink",
        "body": {
            "chatId": "11001234567@c.us",
            "urlLink": "https://GREEN-API.com/en/docs/api/sending/SendLink/"
        }
    },
    {
        "messagesIDs": [
            "BAE1234561256",
            "BAE1234561278"
        ],
        "type": "ForwardMessages",
        "body": {
            "chatId": "11001234567@g.us",
            "chatIdFrom": "12036304684212345@g.us",
            "messages": [
                "BAE1234561296",
                "BAE1234561205"
            ]
        }
    }
]
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