LastOutgoingMessages#
The method returns the latest sent messages of the account. By default, the messages for the last 24 hours are returned.
The method uses limits on the request rate per second.
Request#
To get sent messages, you need to execute a request at:
GET
{{apiUrl}}/waInstance{{idInstance}}/lastOutgoingMessages/{{apiTokenInstance}}
To get the apiUrl, idInstance and apiTokenInstance request parameters, refer to the Before you start section.
Request URL parameters#
| Parameter | Type | Required | Description |
|---|---|---|---|
minutes | integer | no | Time in minutes for which the messages need to be shown (by default it is 1440 minutes) |
Response#
Response fields#
| Field | Type | Description |
|---|---|---|
type | string | Message kind: outgoing - an outgoing message |
idMessage | string | Identifier of the incoming message |
timestamp | integer | Time the message was received in UNIX format |
statusMessage | string | Status of the outgoing message. Possible values: - delivered - delivered- read - read/viewed/listened to |
sendByApi | boolean | Flag indicating sending through the API. |
typeMessage | string | Message type, possible values: textMessage/imageMessage/videoMessage /documentMessage/ audioMessage/pollMessage/locationMessage |
chatId | string | Chat identifier the message was received in. |
chatType | string | Chat type. Possible values: "user", "group", "supergroup", "channel", "bot" |
isForwarded | boolean | Flag of a forwarded message, true/false |
forwardingScore | integer | Number of times the message has been forwarded |
textMessage | string | Message text, if typeMessage=textMessage |
downloadUrl | string | Link to download the file, if typeMessage = imageMessage /videoMessage/documentMessage/audioMessage |
caption | string | File caption, if typeMessage = imageMessage/videoMessage /documentMessage/ audioMessage |
fileName | string | File name, if typeMessage = imageMessage/videoMessage /documentMessage / audioMessage |
jpegThumbnail | string | Image preview in base64 encoding, if typeMessage = imageMessage/videoMessage/documentMessage , audioMessage |
mimeType | string | File type, according to the Media Types classification, if typeMessage = imageMessage/videoMessage/documentMessage/ audioMessage |
isAnimated | boolean | Flag of an animated file, true/false.Present if typeMessage = imageMessage/videoMessage/documentMessage/audioMessage |
Response body example#
[
{
"type": "outgoing",
"idMessage": "1769676078000",
"timestamp": 1754999812,
"typeMessage": "textMessage",
"chatId": "10000000",
"chatType": "user",
"textMessage": "I use GREEN-API to send this message!",
"statusMessage": "delivered",
"sendByApi": true,
"deletedMessageId": "",
"editedMessageId": "",
"isEdited": false,
"isDeleted": false
},
{
"type": "outgoing",
"idMessage": "1769676078000",
"timestamp": 1754987080,
"typeMessage": "textMessage",
"chatId": "10000000",
"chatType": "user",
"textMessage": "I use GREEN-API to send this message!",
"statusMessage": "read",
"sendByApi": true,
"deletedMessageId": "",
"editedMessageId": "",
"isEdited": false,
"isDeleted": false
}
]
Errors#
For the list of errors common to all methods, see the Common errors section
Code examples#
import requests
url = "{{apiUrl}}/waInstance{{idInstance}}/lastOutgoingMessages/{{apiTokenInstance}}"
payload = {}
headers= {}
response = requests.request("GET", url, headers=headers, data = payload)
print(response.text.encode('utf8'))
curl --location '{{apiUrl}}/waInstance{{idInstance}}/lastOutgoingMessages/{{apiTokenInstance}}?minutes=3240'
var restTemplate = new RestTemplate();
var requestUrl = new StringBuilder();
requestUrl
.append({{apiUrl}})
.append("/waInstance").append({{idInstance}})
.append("/lastOutgoingMessages/")
.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("/lastOutgoingMessages/")
.append({{apiTokenInstance}});
var response = Unirest.get(requestUrl.toString())
.header("Content-Type", "application/json")
.asString();
System.out.println(response);
Sub LastOutgoingMessages()
Dim url As String
Dim http As Object
Dim response As String
' The apiUrl, idInstance and apiTokenInstance values are available in console, double brackets must be removed
url = "{{apiUrl}}/waInstance{{idInstance}}/lastOutgoingMessages/{{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