[go: up one dir, main page]

Skip to content

GetStatusStatistic#

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 an array of recipients marked sent/delivered/read for a given status.

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.

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.

Request#

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

GET
{{apiUrl}}/waInstance{{idInstance}}/getStatusStatistic/{{apiTokenInstance}}?idMessage={{id_Message}}

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

URL request parameters#

Parameter Type Mandatory Description
idMessage string Yes Status message ID

Response#

Response parameters#

Array of objects with parameters:

Parameter Type Description
participant array Contact ID
timestamp integer Message acceptance time in UNIX format
status string Outgoing message status, possible variants:
sent - sent
delivered - delivered
read - read/seen/heard

Response body example#

[
    {
        "timestamp": 1587129319,
        "participant": "11001234567@c.us",
        "status": "read",
    },
    {
        "timestamp": 1587129319,
        "participant": "71234567891@c.us",
        "status": "read",
    },
]

GetStatusStatistic 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}}/getStatusStatistic/{{apiTokenInstance}}"

payload = {}
headers= {}

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

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

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

System.out.println(response);