Skip to content

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. Messages sending rate is managed by Messages sending delay parameter.

Request#

To get a messages queue, you have to execute a request at:

GET {{APIUrl}}/waInstance{{idInstance}}/showMessagesQueue/{{apiTokenInstance}}

For getting APIUrl, idInstance and apiTokenInstance 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/sendTextStatus/sendMediaStatus/sendVoiceStatus
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
sendVoiceStatus - voice status
sendMediaStatus - video or image status
sendTextStatus - text status
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/sendTextStatus
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/sendTextStatus
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/sendMediaStatus/sendVoiceStatus
caption string Description under the file, if type = sendFileByUrl/sendMediaStatus
urlFile string Link to uploaded file type = sendFileByUrl/sendMediaStatus/sendVoiceStatus
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
backgroundColor string Message background, if type = sendTextStatus/sendVoiceStatus
font string Text font, if type = sendTextStatus
participants array<string> An array of strings with contact IDs for whom the status will be available, if type = sendTextStatus/sendMediaStatus/sendVoiceStatus
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.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"
            }
        }
    },
    {
        "messagesIDs": [
            "BAE1234561256",
            "BAE1234561278"
        ],
        "type": "ForwardMessages",
        "body": {
            "chatId": "11001234567@g.us",
            "chatIdFrom": "12036304684212345@g.us",
            "messages": [
                "BAE1234561296",
                "BAE1234561205"
            ]
        }
    },
    {
        "messageID": "BAE583864C6D427F",
        "type": "sendTextStatus",
        "body": {
            "message": "I use Green-API to send this Status!",
            "backgroundColor": "#228B22",
            "font": "SERIF",
            "participants": [ //status will be available only to the specified contacts
                "70000001234@c.us",
                "70000001235@c.us"
            ],
            "linkPreview": true
        }
    },
    {
        "messageID": "BAE514E5B2E4B22D",
        "type": "sendVoiceStatus",
        "body": {
            "urlFile": "https://my.site.com/audio/music.mp3",
            "fileName": "music.mp3",
            "backgroundColor": "#228B22",
            "participants": [] // status available for everyone
        }
    },
    {
        "messageID": "BAE5D81B7C3EED1C",
        "type": "sendMediaStatus",
        "body": {
            "urlFile": "https://my.site.com/img/horse.png",
            "fileName": "horse.png",
            "caption": "Little horse",
            "participants": [] // status available for everyone
        }
    }
]

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("https://api.greenapi.com")
    .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("https://api.greenapi.com")
    .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