Callback Functions

The callback functions described in this article are only intended for SME.

Notifications about Changing Message Delivery Status

This method allows you to make a callback request that will send notification to your server about changing status of the message. The server address for callback requests can be defined in your profile in edna dashboard.

Request Endpoint

A POST request is made to the URL you specified during registration or in your personal account in the profile section. Only the HTTPS protocol must be used.

Request Format

The request body contains a JSON object with data about the message delivery (similar to the response body of the imOutMessage request).

{
 "imOutMessageId":"test-001",
 "dlvStatus":"read",
 "dlvStatusAt":"2020-01-10T19:03:52.355+0300",
 "dlvError": null,
 "rate":null,
 "reserveSms":null
 }

Request Parameters

ParameterTypeDescription
imOutMessageIdstringMessage ID
dlvStatusstringMessage delivery status, refer to the Available status codes article for more details.
dlvStatusAtstringTime of recent status update. The time format is YYYY-MM-DDTHH:mm:ss.SSS+TZ (for example, 2020-01-29T13:05:07.000+0300), where date and time values are separated with “T”. “07.000” is for seconds and milliseconds.
dlvErrorstring (optional)Message delivery error, refer to the Available status codes article for more details.
ratestringCost of a fallback SMS message delivery (if it was sent).
reserveSmsstringDelivery status of the fallback SMS

Response Format

A successful response contains only the 200 status code.

Transmitting Messages Sent by User to Client server

This method allows sending an incoming user message to the client server. The client’s Callback URL must be registered in the personal account in edna dashboard and must start with HTTPS. The callback function should be used if HSM messages with chat-buttons are sent. In this case, the request body will contain the button’s payload code. This is the code of the button that the user clicked/tapped in the messenger. The code is specified when creating the HSM template.

Request endpoint

A POST request is made to the URL you specified during registration or in your personal account in the profile section. Only the HTTPS protocol must be used.

Request format

The request body contains a JSON object with an incoming message (similar to the request body of the imOutMessageDlvStatusCallback request).

{
    "id": 43407125,
    "imSubject": "subject",
    "address": "79XXXXXXXXX",
    "receivedAt": "2021-10-20T08:42:51.354+0000",
    "imType": "whatsapp",
    "contentType": "text",
    "text": "Hello edna",
    "caption": null,
    "attachmentUrl": null,
    "attachmentName": null,
    "longitude": null,
    "latitude": null,
    "locationAddress": null,
    "userName": "Joe",
    "firstName": null,
    "lastName": null,
    "avatarUrl": null,
    "apiKeyId": 121,
    "historyMessages": [
        null
    ],
    "imSubjectId": 864
}

Request Parameters

ParameterTypeDescription
idstringMessage ID
imsubjectstringSubject of the message
addressstringWhatsApp number in the 79ХХХХХХХХХ format
receivedAtstringTime of the received message
imTypestringThe channel that is used for the message delivery
contentTypestringType of the message content. It can be a button, text, image, document or video.
textstringMessage text
attachmentUrlstringURL of the attached image/document/video
attachmentNamestring (optional)The name of the attached image/document/video
longitudestringLongitude of the location
latitudestringLatitude of the location
locationAddressstringGeolocation of the address
captionstringName of the geolocation address
userNamestringClient’s user name in WhatsApp
firstNamestringClient’s first name in WhatsApp
lastNamestringClient’s last name in WhatsApp
avatarUrlstringURL of the sender’s avatar
payloadstringButton code
apiKeyIdstringAccount’s key

Response Format

A successful response contains only the 200 status code.