Skip to main content

Sending Messages

Last updated: 8 April 2025

The api/cascade/schedule method is used to send messages to WhatsApp and Viber channels.

warning

If you have two WhatsApp templates registered with the same content, differing only in the Track clicks on link buttons parameter, we don’t recommend sending messages with such content via the API. Use your edna Pulse account to send.

Otherwise, we cannot guarantee the correct display of link button click statistics.

warning

You cannot send a duplicate message within 20 minutes. Duplicate messages will be canceled.

Messages are sent through a cascade, a sequential distribution scenario in several channels. When registering a channel, a cascade is created automatically for it.

You can create a cascade of several channels in your personal edna Pulse account.

File IconCascade Operation Principles File IconHow to Create a Cascade
info

You can test sending messages to a test phone number using edna API for the WhatsApp channel without having to register your channel.

File IconTesting WhatsApp Channel API

Calling api/cascade/schedule

To call theapi/cascade/schedule method, send a POST request to the URL https://app.edna.io/api/cascade/schedule . The request is executed through the public API with API key authorization.

After executing the request, the program receives a task to send a message via cascade according to the parameters in the request body.

If the request is accepted, the server returns a response with the code 200 containing a JSON object with the request ID. In case of unsuccessful verification of the request, a response with an error code is returned.

Information about the result of sending a message is sent to the installed webhook.

File IconReceiving Message Statuses

If the message is successfully sent, the status is returned as sent, followed by delivered, read or undelivered (depending on the channel). The status of the message failed means that the message was processed with an error and not sent.

tip

If the server doesn't return the status of the message, send a request to edna support.

Request Format

The request body contains a set of cascade parameters for which you want to send a message.


{
"requestId": "string",
"cascadeId": 0,
"subscriberFilter": {
"address": "string",
"type": "EDNA_ID"
},
"startTime": "2023-09-27T12:06:29Z",
"ttl": "PT1M",
"content": {
"whatsappContent": {
"contentType": "TEXT",
"text": "string",
"attachment": {
"url": "string",
"name": "string"
},
"location": {
"longitude": 0,
"latitude": 0,
"address": "string",
"name": "string"
},
"comment": "string",
"caption": "string",
"action": "string",
"header": {
"text": "string",
"imageUrl": "string",
"documentUrl": "string",
"documentName": "string",
"videoUrl": "string",
"videoName": "string"
},
"footer": {
"text": "string"
},
"keyboard": {
"rows": [
{
"buttons": [
{
"text": "string",
"url": "string",
"urlPostfix": "string",
"phone": "string",
"payload": "string",
"type": "PHONE",
"otpType": "COPY_CODE",
"color": "string",
"requestContact": true,
"requestLocation": true,
"autofillText": "string",
"packageName": "string",
"hash": "string",
"appId": 0,
"ownerId": 0
}
]
}
]
},
"listPicker": {
"button": "string",
"sections": [
{
"title": "string",
"items": [
{
"identifier": "string",
"title": "string",
"subtitle": "string"
}
]
}
]
},
"catalog": {
"id": "string",
"product": {
"id": "string"
},
"sections": [
{
"title": "string",
"products": [
{
"id": "string"
}
]
}
]
},
"order": {
"catalogId": "string",
"products": [
{
"id": "string",
"quantity": 0,
"price": 0,
"currency": "USD"
}
]
},
"messageMatcherId": 0
},
"viberContent": {
"contentType": "TEXT",
"text": "string",
"attachment": {
"url": "string",
"name": "string"
},
"location": {
"longitude": 0,
"latitude": 0,
"address": "string"
},
"comment": "string",
"caption": "string",
"action": "string",
"header": {
"text": "string",
"imageUrl": "string",
"documentUrl": "string",
"documentName": "string",
"videoUrl": "string",
"videoName": "string"
},
"footer": {
"text": "string"
},
"keyboard": {
"rows": [
{
"buttons": [
{
"text": "string",
"url": "string",
"urlPostfix": "string",
"phone": "string",
"payload": "string",
"type": "PHONE",
"otpType": "COPY_CODE",
"color": "string",
"requestContact": true,
"requestLocation": true,
"autofillText": "string",
"packageName": "string",
"hash": "string",
"appId": 0,
"ownerId": 0
}
]
}
]
}
}
}
}

Request Parameters

General Parameters

ParameterData typeCharacterDescription
requestIdstringRequiredThe message ID. It is generated by your system, after which the value must be passed to the request. The maximum string length is 256 characters.
commentstringOptionalThe text comment in the message. The parameter value is displayed in the detailed report.
cascadeIdstringRequiredThe cascade ID. When creating a channel, a cascade is automatically created to send messages through this channel. To find out the cascade ID, use the API method to get information about cascades (the id field).

File IconReceiving Cascade Information
subscriberFilterobjectRequiredThe recipient of the message: ID in edna Pulse, the client's phone number, as well as other IDs for push messages.

subscriberFilter includes the following parameters:

- address — a value that depends on type;

- type — see the type parameter

If type is PHONE, then address is the customer's phone number.
addressstringRequiredThe value of the identifier of the specified type is type.
typestringRequiredThe type of the client's ID. Possible values are indicated in uppercase:

- INSTAGRAM_ID — The customer's identifier in Instagram of 16 numeric characters. Facebook instantiates this identifier* when the customer interacts with the business' Instagram account for the first time. This value may be different and vary for the same Instagramclient.

- FACEBOOK_ID is the ID of the client in Facebook.

- DEVICE_APP_ID is the ID of the client's push device.

- EDNA_ID is the client ID in the edna database, which is created automatically when creating a client in edna. It is displayed on the User edit page in the URL bar, for example:

> 3314 in the https://app.edna.io/audience/3314/edit .

- PHONE — The client's phone number in the format 37500000000.

- EMAIL

- UTM

- COOKIE_ID

- TELEGRAM_ID

- GOOGLE_ID

- APPLE_ID

- YANDEX_ID

- EXT_USER_ID
startTimestringOptionalThe date and time in ISO 8601 format (for example, `2024-07-01T00:00:00Z'), before which the message will not be sent. Used for delayed delivery.

ISO 8601 - Convention
contentobjectRequiredContains the whatsappContent object.
ttlstringOptionalThe time after which you need to proceed to the described step if the message was not delivered in the previous step. The time period is specified in the ISO 8601 format (for example, `PT1M').

ISO 8601 - Convention
errorIfNotMatchedbooleanOptionalA deprecated parameter. It is used to enable the verification of the message template. If there are no matches, an error is returned.
prioritystringOptionalIs used to indicate the priority of messages. Possible values:

- DEFAULT — standard priority, equivalent to no additional priority settings;

- LOW — low priority;

- NORMAL — medium priority;

- HIGH — high priority;

- REALTIME — real-time delivery.

whatsappContent Parameters

ParameterData typeCharacterDescription
contentTypestringRequiredThe type of message content. Possible values are indicated in uppercase:

- TEXT — text message;

- IMAGE — image;

- DOCUMENT — document attached to the message;

- VIDEO— message containing a video;

- AUDIO — a message containing sound;

- LOCATION — a message with coordinates, address and description of the place. The coordinates are converted into a Google maps snapshot;

- LIST_PICKER — WhatsApp interactive menu buttons;

- AUTHENTICATION — a message with a one-time password and a copy button;

- FLOW — a message containing WhatsApp Flows.

File IconWhatsApp Flows
textstringRequired if contentType = TEXT, AUTHENTICATION or FLOW- The text of the message if contentType = TEXT.

- The text of the message in which Flow will be embedded if ContentType = FLOW.

- One-time password if ContentType = AUTHENTICATION.
flowIdintegerRequired if ContentType = FLOWThe Flow ID that is assigned in WhatsApp Manager at the time Flow is created.
screenstringOptionalThe ID of the screen that will be displayed first in Flow.
captionstringRequired if ContentType = FLOWThe text of the button that starts Flow after clicking on it.
actionstringOptionalThe Flow interaction type.

Possible values:

- navigate — Flow does not make a request to the endpoint. The default value.

- data_exchange — Flow makes a request to the endpoint.

developers.facebook.com
attachmentobjectRequiredContains information about the attachment.

If the attachment field is specified when sending a WhatsApp chat message, the text field is ignored and only the attachment is sent.
attachment.urlstringRequired if the attachment object is not emptyThe link to the attachment is an image, file, video, or audio.
attachment.namestringRequiredThe name of the image, file, video or audio. The maximum length is 70 characters.
headerobjectRequiredThe message title. You can select one of the following header options: text, image, document. For the text header, you need to specify the header text itself, the header can contain one variable. The title itself is displayed in bold text before the message. For a multimedia header, you can specify a link to a document or an image.
footerstringRequiredThe signature. It is displayed under the message in a muted text color.
locationobjectRequiredContains geolocation information. Sending a geolocation message is only available as part of a 24-hour dialog.
location.longitudestringRequiredCoordinates (longitude). The range of values is from -180 to 180.
location.latitudestringRequiredCoordinates (latitude). The range of values is from -90 to 90.
location.addressstringOptionalThe address on the map.
location.name stringOptionalThe name of the object whose address is being transmitted.
header.textstringRequired for the text headerThe header text.
header.imageUrl stringRequired for the title is the imageA link to the image in the title.
header.documentURLstringRequired for the document headerA link to the document in the header.
header.documentNamestringRequired for the document headerThe document name in the header. It will be displayed to the recipient of the message.
header.videoUrlstringRequired for the title is the videoA link to the video in the title.
header.videoNamestringRequired for the title is the videoThe video title in the title. It will be displayed to the recipient of the message.
buttonsobjectRequiredAn array of objects, each of which defines a button.
buttons.textstringRequiredThe button text. The maximum length is 20 characters.
buttons.urlstringRequired for the button is the linkThe URL that opens when the button is clicked.
buttons.urlPostfixstringRequired if there is a dynamic link in the template or it is a non-zeroThe dynamic part of the link of the button URL.
buttons.phonestringRequired for the call buttonThe phone number that is dialed when the button is pressed.
buttons.typestringRequiredThe button type:

- URL — opens the specified link;

- PHONE — dials the specified phone number;

- QUICK_REPLY — sends a ready response;

- OTP — copies the one-time password.

There can be either no more than three QUICK_REPLY buttons in one message, or no more than one for each of the URL and PHONE buttons. The QUICK_REPLY buttons cannot be in communication with other buttons.

Possible options:

- QUICK_REPLY

- QUICK_REPLY QUICK_REPLY

- QUICK_REPLY QUICK_REPLY QUICK_REPLY

- URL

- PHONE

- URL of the PHONE button.
buttons.otpTypebooleanOptionalThe button type in the WhatsApp authorization message. Only for the WhatsApp authorization template message.

Possible values:

- COPY_CODE — copy the code;

- ONE_TAP — auto-fill button.
buttons.autofillTextstringOptionalThe Auto-fill button text. Only for the auto-fill buttons in the WhatsApp authorization template message. The maximum number of characters is 25.
buttons.packageNamestringOptionalThe Android application package name in the WhatsApp authorization message. Only for the auto-fill buttons in the WhatsApp authorization template message.
listPickerobjectRequiredThe item list object. It contains the button parameter and the sections object, which contains the section objects.
listPicker.buttonstringRequired if the ListPicker object is not emptyThe name of the button for the interactive list.
listPicker.sections.titlestringRequired if the ListPicker object is not emptyThe header of the section with elements that is displayed to the user.
listPicker.sections.itemsarray of objectsOptionalThe list of item objects.
listPicker.sections.items.titlestringRequired if the ListPicker object is not emptyThe end-to-end element ID for the entire message will be returned in the user's reply message.
listPicker.sections.items.subtitlestringRequired if the ListPicker object is not emptyThe subtitle of the element. The maximum length is 24 characters, including spaces.
messageMatcherIdintegerRequired if ContentType = AUTHENTICATIONThe ID of the template for this authorization message.

viberContent Parameters

ParameterData typeCharacterDescription
contentTypestringRequiredThe type of message content. Possible values are indicated in uppercase:

- TEXT — text message;

- IMAGE — image;

- DOCUMENT — document attached to the message;

- VIDEO— message containing a video;

- AUDIO — a message containing sound;

- BUTTON — a button;

- LIST_PICKER — buttons of the WhatsApp interactive menu;

- LOCATION — a message with coordinates, address, and description of the location. The coordinates are converted to a Google maps snapshot.
footerobjectOptionalThe signature. It is displayed under the message in a muted text color.
textstringOptionalThe message text.
headerobjectOptionalThe message title. You can select one of the following header options: text, image, document. For the text header, you need to specify the header text itself, the header can contain one variable. The title itself is displayed in bold text before the message. For a multimedia header, you can specify a link to a document or an image.
attachmentobjectOptionalContains information about the attachment.
attachment.urlstringRequiredA link to attachment: image, file, video or audio.
attachment.namestringOptionalThe name of the image, file, video, or audio. The maximum length is 25 characters.
locationobjectOptionalContains location information.
location.longitudestringRequiredCoordinates (longitude).
location.latitudestringRequiredCoordinates (latitude).
location.addressstringOptionalThe address on the map.
captionstringOptionalThe button name.
actionstringOptionalA link for the button.

Quotation Marks in the Text

The quotation marks or must be separated by a \ in the message being sent.

An example of the correct formatting

"text": "Pablo! We are inviting you to our workshop \“Cooking with Tefal\” 11/25/2021 at 1 p.m. Don\'t miss this event! Give us a call: +7 (495) 100-00-00"

"text": "Pablo! We are inviting you to our workshop «Cooking with Tefal» on 11/25/2021 at 1 p.m. Don\'t miss this event! Give us a call: +7 (495) 100-00-00"

An example of the incorrect formatting

"text": "Pablo! We are inviting you to our workshop “Cooking with Tefal” on 11/25/2021 at 1 p.m. Don't miss this event! Give us a call: +7 (495) 100-80-00"

Formatting Text in WhatsApp

The option for formatting text in WhatsApp messages is enabled by default without the option to disable it.

Text selectionExample
_cursive_Italics
*Bold*Bold
~Crossed out~Crossed out
`Monospaced`Monospaced

Response Format

In response to the request, a JSON object is returned containing the ID of the sent message and the status of its processing.

ParameterData typeDescription
requestIdstringThe ID of the message. This number was generated on your side.

Types of Attachments

The sent attachments must meet the following requirements:

Attachment typeSupported formatAcceptable size
documentAny valid MIME type.100 MB
imageimage/jpeg, image/png.5 MB
audioaudio/aac, audio/mp4, audio/amr, audio/mpeg, audio/ogg.

Codec=opus (NWB) and ACC.
16 MB
videovideo/mp4, video/3gpp.

Only MPEG 4 and 3GPP formats with the H.264 codec (MPEG-4 Part 10) and AAC for audio are supported.
16 MB

developers.facebook.com