Use this method to send messages to your clients via edna API.
schedule Method
A completed request using the schedule
method results in a message that is sent to the messenger according to the parameters specified in the request body. If the request is successful, the server returns code 200
with a JSON object detailing the message identifier and its sending status. If the request fails, the server returns a response with an error code. Read more about error codes.
URL
To send a message, a POST request is sent to the following URL address: https://app.edna.io/api/cascade/schedule
Request Format
A JSON object is passed in the request body with all the cascade and message parameters. These parameters depend on the message type and its contents.
Request Example
This is an example of the body of a request for the following cascade. First, a message is sent to the client via the push channel, then a WhatsApp message is sent, and finally a text is sent via an SMS channel.
{ "requestId": "test-001", "cascadeId": 111, "subscriberFilter": { "address": "18000000000", "type": "PHONE" }, "startTime": "2022-01-21T08:00:00Z", "content": { "smsContent": { "text": "Your card is ready. Pick it up at the bank office." }, "whatsappContent": { "contentType": "TEXT", "text": "Your card is ready. Pick can pick it up at the bank office.", "attachment": { "url": "https://.jpg", "name": "How to find us", "size": 5123 }, "location": { "longitude": 56.7645, "latitude": 48.4564, "address": "London, Buckingham street" } }, "pushContent": { "small": { "text": "Pick it up at the bank office.", "title": "Your card is ready", "imageUrl": "https://.png" }, "big": { "title": "Your card is ready", "text": "Pick it up at the bank office.", "imageUrl": "https://.png" }, "buttons": [ { "text": "Contact support", "url": "DeeplinkSupport" }, { "text": "Remind me later", "url": "DeeplinkLater" } ], "action": "DeeplinkMainPush", "effects": { "vibrate": "[500,100,500,150,50,50]", "lights": "#770808", "sound": "AthlonRoar", "androidNotificationChannel": "Order status" }, "iosSettings": { "interruptionLevel": "ACTIVE", "category": "ednaPushCategory" } } } }
Request Parameters
Below are tables with a full set of parameters, their types, and descriptions. Examples of requests for each channel and content type are available here.
General Parameters
Parameter | Data type | Character | Description |
requestId | string | Required | Message identifier. The value must be generated by your system and sent to the request. The maximum length is 256 characters. |
comment | string | Text comment in the message. This value is displayed in detailed reports. | |
cascadeId | string | Required | Cascade identifier. When you create a channel, it also automatically creates a cascade for sending messages via this channel. To retrieve the ID of the required cascade, use the API method for retrieving cascade information (refer to the id parameter). |
subscriberFilter | string | Required | Recipient of the message: a client’s ID in edna Pulse, their phone number or their Instagram ID.subscriberFilter consists of the following parameters: address and type . Consequently, type can be ID , PHONE , and INSTAGRAM_ID , and address is the value depending on the type (so, for example, if type is PHONE , address will be the client’s phone number). Example:"subscriberFilter": { |
address | string | Required | Value depending on type . |
type | string | Required | Type of the client’s identifier. Enter a value in upper case. • INSTAGRAM_ID — Client’s 16-digit identifier in Instagram. It is generated automatically by Meta when the client contacts the company’s Instagram business account. The value can be different and can change for the same Instagram client.• FACEBOOK_ID • DEVICE_APP_ID — ID of the client’s push device.• EDNA_ID — Client’s identifier in edna Pulse database. It is generated automatically when you create/upload a client to the system. The identifier is displayed in the URL on the Edit client page, for example, 3314 in https://app.edna.io/audience/3314/edit.• PHONE — Client’s phone number, for example, “18000000000”• EMAIL • UTM • COOKIE_ID • TELEGRAM_ID • GOOGLE_ID • APPLE_ID • YANDEX_ID • EXT_USER_ID |
startTime | string | Optional | Start time, i.e. the time when the message will be sent (it won’t be sent until the time you specify). • YYYY-MM-DDTHH:mm:ss.SSSXXX (2021-01-21T08:00:00Z) • YYYY-MM-DDTHH:mm:ss.SSS+TZ (2021-01-21T08:00:00Z+03:00) |
content | object | Required | Object; can contain the following objects: smsContent, whatsappContent, viberContent. |
whatsAppContent
Parameters
Параметр | Тип данных | Характер | Описание |
contentType | string | Обязательный | Message content type. Enter a value in upper case. • TEXT — Text message.• IMAGE — Image.• DOCUMENT — Document attached to the message.• VIDEO — Message that contains a video.• AUDIO — Message that contains an audio.• LOCATION — Message that contains. coordinates, address, and description of a place. The coordinates are converted into a Google Maps snap.• LIST_PICKER — Interactive menu buttons.• AUTHENTICATION — authentication message with one-time password button. |
text | string | Required, if contentType = TEXT or AUTHENTICATION | Message text, if contentType = TEXT .One-time password, if contentType = AUTHENTICATION . |
attachment | object | Required | Contains information about the attachment. If the attachment field is specified when sending a WhatsApp chat message, the text field will be ignored and only the attachment will be sent. |
attachment.url | string | Required, if attachment object is not empty | Link to the attachment: image, file, video or audio. |
attachment.name | string | Required | The name of the image, file, video, or audio. The maximum length is 70 characters. |
header | object | Required | Message header. You can select one of the following message header types: text, image, document. For a text header, you need to specify the text itself (it can contain one variable), it displays in bold before the message text. For an image/document header, you can specify the link to the image/document respectively. |
footer | string | Required | Message subject that is displayed under the message text in a toned-down color. |
location | object | Required | Contains information about the location. Sending a location message is only available as part of a 24-hour conversation. |
location.longitude | string | Required | Longitude coordinates. The range of values is from -180 to 180. |
location.latitude | string | Required | Latitude coordinates. The range of values is from -90 to 90. |
location.address | string | Optional | Address on the map. |
location.name | string | Optional | The object name whose address is transferred. |
header.text | string | Required for text header | The header text. |
header.imageUrl | string | Required for image header | The link to the image in the header. |
header.documentUrl | string | Required for document header | The link to the document in the header. |
header.documentName | string | Required for document header | The name of the document in the header. It will be displayed to the recipient of the message. |
header.videoUrl | string | Required for video header | The link to the video in the header. |
header.videoName | string | Required for video header | The name of the video in the header. It will be displayed to the recipient of the message. |
buttons | object | Required | An array of objects, each of which defines a button. |
buttons.text | string | Required | The text of the button. The maximum length is 20 characters. |
buttons.url | string | Required for link button | The URL that opens when the button is clicked. |
buttons.urlPostfix | string | Required if template has dynamic link or is non-zero | The dynamic part of the link is the URL of the button. |
buttons.phone | string | Required for call button | The phone number to be called when the button is pressed. |
buttons.payload | string | Required for text button | The code of the quick reply button. |
buttons.type | string | Required | Button type: • URL — URL that opens once the button is tapped.• PHONE — phone number.• QUICK_REPLY – quick reply button.• OTP — one-time password copy button.For more information, see examples. A message can contain up to three QUICK_REPLY buttons, or up to one of each URL and PHONE buttons. QUICK_REPLY buttons can’t be in a message with other button types. Possible combinations: • QUICK_REPLY QUICK_REPLY QUICK_REPLY QUICK_REPLY QUICK_REPLY QUICK_REPLY URL PHONE URL PHONE |
buttons.otpType | boolean | Optional | The type of button in the WhatsApp authorization message. Only for the WhatsApp authorization template message. Possible values: • COPY_CODE : copy the code;• ONE_TAP : the auto-fill button. |
buttons.autofillText | string | Optional | The text of the auto-fill button. Only for the auto-fill buttons in the WhatsApp authorization template message. The maximum number of characters is 25. |
buttons.packageName | string | Optional | The name of the Android application package in the WhatsApp authorization message. Only for the autofill buttons in the WhatsApp authorization template message. |
listPicker | object | Required | The item list object. It contains the button parameter and the sections object, which contains section objects. |
listPicker.button | string | Required, if listPicker object is not empty | The name of the interactive list button. |
listPicker.sections.title | string | Required, if listPicker object is not empty | The heading of the section of items displayed to the user. |
listPicker.sections.items | array of objects | Optional | The list of item objects. |
listPicker.sections.items. | string | Required, if listPicker object is not empty | The end-to-end element ID for the entire message is returned in the user’s reply message. |
listPicker.sections.items. | string | Required, if listPicker object is not empty | The name of the item. The maximum length is 24 characters including spaces. |
listPicker.sections.items. | string | Required | The subtitle of the item. The maximum length is 24 characters including spaces. |
messageMatcherId | integer | Required, if contentType = AUTHENTICATION | The ID of the template for this authorization message. |
viberContent
Parameters
Parameter | Data type | Character | Description |
contentType | string | Optional | Message content type with the following possible values (must be specified in the upper case): • TEXT – Text message.• IMAGE – Image.• DOCUMENT – Document attached to the message.• VIDEO – Message that contains a video.• AUDIO – Message that contains an audio.• BUTTON – Message that contains a button.• LOCATION – Message that contains coordinates, address, and description of a place. The coordinates are converted into a Google Maps snap. |
text | string | Optional | Message text. |
header | object | Optional | Message header. You can select one of the following message header types: text, image, document. For a text header, you need to specify the text itself (it can contain one variable), it displays in bold before the message text. For an image/document header, you can specify the link to the image/document respectively. |
footer | object | Optional | Message subject that is displayed under the message text in a toned-down color. |
attachment | object | Optional | Contains info about attachments. |
attachment.url | string | Required | Link to the image/document/video/audio. |
attachment.name | string | Optional | Name of the image/document/video/audio. Maximum length is 25 characters. |
attachment.size | string | Optional | Attachment size. |
location | object | Optional | Contains info about the location. |
location.longitude | string | Required | Longitude coordinates. |
location.latitude | string | Required | Latitude coordinates. |
location.address | string | Optional | Address on the map. |
caption | string | Optional | Button caption. |
action | string | Optional | Button URL. |
smsContent
Parameters
Parameter | Data type | Character | Description |
text | string | Required | Message text. |
pushContent
Parameters
Parameter | Data type | Character | Description |
small | object | Required | Parameters for displaying collapsed push notifications. |
small.title | string (optional) | Title of a collapsed push notification. | |
small.text | string | Required | Text of a collapsed push notification. |
small.imageUrl | string | Optional | Icon (logo) to display in collapsed push notifications. The recommended aspect ratio is 1×1, the size limit is 1024×1024. |
big | object | Optional | Parameters for displaying maximized push notifications. |
big.title | string | Optional | Text of a maximized push notification. |
big.text | string | Optional | Text of a maximised push notification. |
big.imageUrl | string | Optional | A large image for a maximized push. Images with aspect ratios of 2×1 are recommended, where the main visual mass remains when cropped to 1.79×1 and 2.5×1 (Android restrictions). |
action | string | Optional | Link that will be passed to the app when a client taps the push notification. |
buttons | object | Optional | Button display parameters. Up to two buttons can be displayed together with the notification. |
buttons.text | string | Optional | The button caption. Users will see this caption on the button in the notification. |
buttons.url | string | Optional | Button link. It will be passed to the application when the user taps the button. |
effects | object | Optional | Sound, vibration, notification channel name, and LED flashing color on the client’s device when receiving a push notification. |
effects.sound | string | Optional | The name of the sound file (without the extension). A file with this name must be located in the res/raw directory of an Android application and in the Xcode root directory of an iOS application. |
effects.lights | string | Optional | LED color the phone blinks with when receiving push notifications (Android only). Some Android smartphones have a signal LED. Using this parameter, you can set the color of the flashing of this LED when receiving a push. |
effects.vibrate | string | Optional | The sequence of intervals of inactivity and vibration of the motor when receiving a push notifications (in milliseconds), Android only. The first value is inactivity. For example, with the pattern [300,500,300,500] , the device will be inactive for 300 ms, vibrating for 500 ms, inactive again for 300 ms, vibrating for 500. |
effects .androidNotificationChannel | string | Optional | The name of the notification channel for Android. Users will see this name in the smartphone settings. You can only change the channel parameters (sound, vibration, and LED color) for new push notification recipients. |
iosSettings | object | Optional | Interruption level and the ContentExtension category (iOS only). |
iosSettings | string | Optional | The interruption level determines the type of notification on iOS 15 and above. |
iosSettings.category | string | Optional | The category for calling ContentExtension . The parameter is processed on the iOS side and determines how the extended push is rendered. |
attributes | object | Optional | Additional push message parameters. A key-value table in JSON. |
Quatation Marks in Text
Pay attention to how you put words in quotation marks. If you use the single (‘) or double quote (”) symbols in the message text, make sure to put the backslash (\) symbol before the opening and after the closing quotation mark. See the following example:
Correct:
"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"
or
"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"
Incorrect:
"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"
Text Formatting in WhatsApp
WhatsApp allows you to format text inside your messages. Please note, you cannot disable this feature.
- Italic: Place an underscore on both sides of the text: _text_
- Bold: Place an asterisk on both sides of the text: *text*
Strikethrough: Place a tilde on both sides of the text: ~text~Monospace
: Place three backticks on both sides of the text:```
text```
Response Format
The response contains a JSON object with the ID of the sent message and one of the available response codes.
Parameter | Data type | Description |
requestid | string | Message identifier. It is generated by your system. |
Attachment Types
All attachments that you send must comply with the following requirements. Otherwise, the message will not be delivered.
Content type | Supported format | Size, MB |
document | Any valid MIME type | 100 |
image | image/jpeg, image/png | 5 |
audio | audio/aac, audio/mp4, audio/amr, audio/mpeg, audio/ogg codec: opus (NWB) и ACC | 16 |
video | video/mp4, video/3gpp Important! Only MPEG 4 and 3GPP with the codec H.264 (MPEG-4 Part 10) and AAC for audio are supported | 16 |
For details on the media attachment formats for WhatsApp, refer to this article.