Sending cascade messages to the Viber channel
Use the /api/cascade/schedule method to send cascade messages to the Viber channel.
This article describes how to send cascade messages using the /api/cascade/schedule method and the viberContent object.
For more information about the /api/cascade/schedule method, see:
Calling the method
To send a message to the Viber channel through a cascade using the /api/cascade/schedule method, send a POST request to https://app.edna.io/api/cascade/schedule.
Request examples
Message with text
{
"requestId": "test-001",
"cascadeId": "1",
"subscriberFilter": {
"address": "35700000000",
"type": "PHONE"
},
"startTime": "2021-01-21T08:00:00Z",
"content": {
"viberContent": {
"contentType": "TEXT",
"text": "Hello! We are pleased to introduce you to our new customer communication channel. Here you can ask all the questions you are interested in."
}
}
}
Message with an image
{
"requestId": "test-001",
"cascadeId": "1",
"subscriberFilter": {
"address": "35700000000",
"type": "PHONE"
},
"startTime": "2021-01-21T08:00:00Z",
"content": {
"viberContent": {
"contentType": "IMAGE",
"attachment": {
"url": "https://www.gstatic.com/webp/gallery/1.jpg",
"name": "Lorem Ipsum"
}
}
}
}
Message with a document
{
"requestId": "test-001",
"cascadeId": "1",
"subscriberFilter": {
"address": "35700000000",
"type": "PHONE"
},
"startTime": "2021-01-21T08:00:00Z",
"content": {
"viberContent": {
"contentType": "DOCUMENT",
"attachment": {
"url": "https://www.gstatic.com/webp/gallery/1.jpg",
"name": "Lorem Ipsum"
}
}
}
}
Message with a button and an image
{
"requestId": "test-001",
"cascadeId": "1",
"subscriberFilter": {
"address": "35700000000",
"type": "PHONE"
},
"startTime": "2021-01-21T08:00:00Z",
"content": {
"viberContent": {
"caption": "Button name",
"action": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
"text": "Button text",
"contentType": "BUTTON",
"attachment": {
"url": "https://www.gstatic.com/webp/gallery/1.jpg",
"name": "Lorem Ipsum"
}
}
}
}
viberContent parameters
For more information about the general /api/cascade/schedule method parameters, see:
| Parameter | Data type | Requirement | Description |
|---|---|---|---|
contentType | string | Required | Message content type. Possible values are specified in uppercase:
- TEXT — text message;
- IMAGE — image;
- DOCUMENT — document attached to the message;
- VIDEO — message containing a video;
- AUDIO — message containing audio;
- BUTTON — button;
- LOCATION — message with the coordinates, address, and description of a location. The coordinates are converted to a Google Maps image. |
footer | object | Optional | Caption. It displays below the message in a muted text color. |
text | string | Optional | Message text. Text formatting |
header | object | Optional | Message header. You can select one of the following header types: text, image, or document. For a text header, specify the header text. The header can contain one variable. The header is displayed in bold before the message. For a multimedia header, you can specify a link to a document or image. |
attachment | object | Optional | Contains attachment information. |
attachment.url | string | Required | Link to an attachment: image, file, video, or audio. |
attachment.name | string | Optional | Name of the image, file, video, or audio. The maximum length is 25 characters. |
location | object | Optional | Contains location information. |
location.longitude | string | Required | Coordinates (longitude). |
location.latitude | string | Required | Coordinates (latitude). |
location.address | string | Optional | Address on the map. |
caption | string | Optional | Button name. |
action | string | Optional | Link for the button. |
Text formatting
Rules for escaping quotation marks in text
Separate the “ or ‘ quotation marks with \ in the sent message.
Example of correct formatting:
"text": "Maria! We’re looking forward to seeing you at the \"Cooking together with Tefal\" master class on January 25, 2020, at 1:00 PM. Don’t miss this event! Our phone number is 8(495)100-00-00"
"text": "Maria! We’re looking forward to seeing you at the “Cooking together with Tefal” master class on January 25, 2020, at 1:00 PM. Don’t miss this event! Our phone number is 8(495)100-00-00"
Example of incorrect formatting:
"text": "Maria! We’re looking forward to seeing you at the "Cooking together with Tefal" master class on January 25, 2020, at 1:00 PM. Don’t miss this event! Our phone number is 8(495)100-00-00"
Attachment types
Sent attachments should meet the following requirements:
| Attachment type | Supported format | Allowed size |
|---|---|---|
| document | Any valid MIME type. | 100 MB |
| image | image/jpeg, image/png. | 5 MB |
| audio | audio/aac, audio/mp4, audio/amr, audio/mpeg, audio/ogg. Codec=opus (NWB) and ACC. | 16 MB |
| video | video/mp4, video/3gpp. Only MPEG 4 and 3GPP formats with the H.264 (MPEG-4 Part 10) codec and AAC for audio are supported. | 16 MB |
Response format
{
"requestId": "string"
}
Response example
{
"requestId": "test-001"
}
Response parameters
| Parameter | Data type | Description |
|---|---|---|
requestId | string | Internal identifier of an outgoing message. The customer’s external system generates it when sending a message. |