GetIncomingStatuses#
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 incoming status messages of the instance. In the default mode the incoming status messages for 24 hours are returned.
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.
Request#
To get incoming statuses, you have to execute a request at:
{{apiUrl}}/waInstance{{idInstance}}/getIncomingStatuses/{{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, incoming - incoming message |
idMessage | string | Incoming message Id |
timestamp | integer | Message acceptance time in UNIX format |
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 |
senderId | string | Message sender Id |
senderName | string | Message sender name |
senderContactName | string | Message sender name according to the contact list of the current account |
textMessage | string | Text message, if typeMessage = extendedTextMessage |
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 (extended), 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 | ||
BRYNDAN_WRITE - Here is how your text will look | ||
OSWALD_HEAVY - Here is how your text will look |
Response body example#
[
{
"type": "incoming",
"idMessage": "1E1A12D337F2BFA5FC0000000000000",
"timestamp": 1710232595,
"typeMessage": "extendedTextMessage",
"chatId": "70000000001@c.us",
"textMessage": "Good day!",
"extendedTextMessage": {
"text": "Good day!",
"backgroundColor": "#228B22",
"font": "SANS_SERIF"
},
"senderId": "70000000001@c.us",
"senderName": "Reachel",
"senderContactName": "Reachel's whatsapp",
},
{
"type": "incoming",
"idMessage": "38E322274FDEBA56047000000000000",
"timestamp": 1710232636,
"typeMessage": "imageMessage", // "videoMessage" / "audioMessage"
"chatId": "70000000001@c.us",
"downloadUrl": "https://sw-media.storage.greenapi.net/1101000000/dcf81410-bdbc-4aed-bf23-d1845c000000.jpg",
"caption": "Good day!",
"fileName": "dcf81410-bdbc-4aed-bf23-d1845cd74754.jpg",
"jpegThumbnail": "/9j/2wCEABALDA4MChAODQ4SERATGCgaGBYWGDEjJ",
"mimeType": "image/jpeg",
"senderId": "70000000001@c.us",
"senderName": "Reachel",
"senderContactName": "Reachel's whatsapp",
}
]
GetIncomingStatuses 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}}/getIncomingStatuses/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/getIncomingStatuses/{{apiTokenInstance}}?minutes=3240'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/getIncomingStatuses/")
.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("/getIncomingStatuses/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);