Skip to main content

Get notification

Receives one notification from the queue

Function GetNotification(Val AccessParameters, Val Timeout = 5) Export

ParameterCLI optionTypeRequiredDescription
AccessParameters--accessStructure Of KeyAndValueAccess parameters. See FormAccessParameters
Timeout--timeoutNumberTimeout for waiting for new messages when the queue is empty

Returns: Map Of KeyAndValue - serialized JSON response from Green API


tip

Once the notification has been successfully accepted, you must remove it from the queue using the DeleteNotificationFromQueue method

Method at API documentation: ReceiveNotification


1C:Enterprise/OneScript code example
    ApiUrl           = "https://7105.api.greenapi.com";
MediaUrl = "https://7105.media.greenapi.com";
IdInstance = "71051...";
ApiTokenInstance = "425010d90e114aa6b78f0969e...";

AccessParameters = OPI_GreenAPI.FormAccessParameters(ApiUrl, MediaUrl, IdInstance, ApiTokenInstance);
Result = OPI_GreenAPI.GetNotification(AccessParameters);
    oint greenapi GetNotification \
--access "{'apiUrl':'***','mediaUrl':'https://7105.media.greenapi.com','idInstance':'7105187566','apiTokenInstance':'***'}"
Result
{
"receiptId": 1,
"body": {
"typeWebhook": "outgoingAPIMessageReceived",
"instanceData": {
"idInstance": 7105187566,
"wid": "1234567890@c.us",
"typeInstance": "whatsapp"
},
"timestamp": 1757919952,
"idMessage": "BAE5EF42B6D1A485",
"senderData": {
"chatId": "120363410406221140@g.us",
"chatName": "Основная тестовая группа",
"sender": "1234567890@c.us",
"senderName": "",
"senderContactName": ""
},
"messageData": {
"typeMessage": "quotedMessage",
"extendedTextMessageData": {
"text": "New message",
"stanzaId": "BAE55E709C547A29",
"participant": "1234567890@c.us"
},
"quotedMessage": {
"stanzaId": "BAE55E709C547A29",
"participant": "1234567890@c.us",
"typeMessage": "extendedTextMessage",
"textMessage": "New message",
"extendedTextMessage": {
"text": "New message",
"description": "",
"title": "",
"previewType": "None",
"jpegThumbnail": "",
"forwardingScore": 0,
"isForwarded": false
}
}
}
}
}