[go: up one dir, main page]

Skip to content

GetOutgoingStatuses#

Test Postman

Beta version

The functionality is in beta mode. Features are subject to change and may also work unstably. There may be additional charges for functionality in the future.
You can request access to the functionality via Green API support

The method returns the outgoing statuses of the account. In the default mode the outgoing status messages for 24 hours are returned.

To receive the journal of messages sent from the phone, you need to enable the Receive webhooks on sent messages statuses setting using the SetSettings method or through the console (Messages received before enabling this setting will not be included in the outgoing message journal).

It may take up to 5 minutes for the settings to take effect.

Statuses can only be received from numbers in the contact list.

The contact list is fetched using the GetContacts method based on the contactName field. To get an updated contact list, you need to rename a contact and re-authorize by rescanning the QR code.

Statuses are sent only to the first 1024 contacts from the GetContacts method with a valid contactName field.

Request#

To get outgoing statuses, you have to execute a request at:

GET
{{apiUrl}}/waInstance{{idInstance}}/getOutgoingStatuses/{{apiTokenInstance}}?minutes={{minutes_count}}

For apiUrl, idInstance and apiTokenInstance request parameters, refer to Before you start section.

URL request parameters#

Parameter Type Mandatory Description
minutes integer No time in minutes for which the status messages should be displayed (default is 1440 minutes)

Response#

Response parameters#

Array of objects with parameters:

Parameter Type Description
type string Message type, outgoing - outgoing message
idMessage string Outgoing message Id
timestamp integer Time of the last action on a message in UNIX format
statusMessage string Outgoing message status, possible variants:
pending - is sent
sent - sent
delivered - delivered
read - read/seen/heard
sendByApi boolean Is the message sent through API
typeMessage string Message type, possible variants:
extendedTextMessage - extended text message
imageMessage - image message
videoMessage - video message
audioMessage - audio message
chatId string Message sender chat Id
participants array An array of strings with contact IDs for whom the status will be available. If the field value is empty,"participants": [], the status will be available to all contacts. Defaults to [] if "sendByApi" = false
textMessage string Text message, if typeMessage = textMessage
downloadUrl string Link to download a file, if if typeMessage = imageMessage/videoMessage/audioMessage
caption string File caption, if typeMessage = imageMessage/videoMessage
fileName string File name, if typeMessage = imageMessage/videoMessage/audioMessage. The field is generated automatically
jpegThumbnail string base64-coded image preview, if typeMessage = imageMessage/videoMessage
mimeType string File type according to the Media Types, if typeMessage = imageMessage/videoMessage/audioMessage
extendedTextMessage object Text message object (advanced), if typeMessage = extendedTextMessage

Parameters of extendedTextMessage object:

Parameter Type Description
text string Message text
backgroundColor string Background color. Default value: #FFFFFF. Example site for getting the background color value
font string Text font. Accepts values:
SERIF - Here is how your text will look
SANS_SERIF - Here is how your text will look
NORICAN_REGULAR - Here is how your text will look
The font is used only for Latin letters
BRYNDAN_WRITE - Here is how your text will look
OSWALD_HEAVY - Here is how your text will look
participants array An array of strings with contact IDs for whom the status will be available. If the field value is empty,"participants": [], the status will be available to all contacts. Defaults to [] if "sendByApi" = false

Response body example#

[
    {
        "type": "outgoing",
        "idMessage": "BAE5018000000000",
        "timestamp": 1710134811,
        "typeMessage": "extendedTextMessage",
        "chatId": "70000000001@c.us",
        "textMessage": "I use Green-API to send this Status!",
        "extendedTextMessage": {
            "text": "I use Green-API to send this Status!",
            "backgroundColor": "#228B22",
            "font": "SERIF",
            "participants": [ 
                "70000000001@c.us",
                "70000000002@c.us" // status will be available only to the specified contacts
            ]
        },
        "statusMessage": "read",
        "sendByApi": true
    },
    {
        "type": "outgoing",
        "idMessage": "BAE5207000000000",
        "timestamp": 1710134814,
        "typeMessage": "imageMessage", // "videoMessage" / "audioMessage"
        "chatId": "70000000001@c.us",
        "participants": [], // status available for everyone
        "downloadUrl": "https://sw-media.storage.greenapi.net/1101000000/dcf81410-bdbc-4aed-bf23-d1845c000000.jpg",
        "caption": "I use Green-API to send this Status!",
        "fileName": "dcf81410-bdbc-4aed-bf23-d1845cd74754.jpg",
        "jpegThumbnail": "/9j/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJ",
        "mimeType": "image/jpeg",
        "statusMessage": "read",
        "sendByApi": true
    }
]

GetOutgoingStatuses errors#

For a list of errors common to all methods, refer to Common errors section

HTTP code Error identifier Description
403 Forbidden There is no access to the functionality of the beta version of the status methods. You can request access to the functionality via Green API support

Request examples#

import requests

url = "{{apiUrl}}/waInstance{{idInstance}}/getOutgoingStatuses/{{apiTokenInstance}}"

payload = {}
headers= {}

response = requests.request("GET", url, headers=headers, data = payload)

print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getOutgoingStatuses/{{apiTokenInstance}}?minutes=3240'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
    .append({{apiUrl}})
    .append("/waInstance").append({{idInstance}})
    .append("/getOutgoingStatuses/")
    .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("/getOutgoingStatuses/")
    .append({{apiTokenInstance}});

var response = Unirest.get(requestUrl.toString())
    .header("Content-Type", "application/json")
    .asString();

System.out.println(response);