Примеры отправки сообщений

В этой статье представлены основные примеры сообщений, которые можно отправить с помощью edna API, с указанием операторов и типов отправляемого контента.

Сообщение SMS

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "smsContent": {
            "contentType": "TEXT",
            "text": "Добрый день! Дмитрий"
        }
    }
}

Чат-сообщение WhatsApp

Если при отправке чат-сообщения WhatsApp указано поле attachment, то поле text игнорируется. Отправляется только вложение.

Текст:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Добрый день! Рады представить Вам наш новый канал взаимодействия с клиентами. Здесь вы можете задавать все интересующие вас вопросы."
        }
    }
}

Картинка:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "IMAGE",
            "attachment": {
                "url": "https://www.gstatic.com/webp/gallery/1.jpg",
                "name": "Lorem Ipsum"
            }
        }
    }
}

Документ:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "DOCUMENT",
            "attachment": {
                "url": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
                "name": "Lorem Ipsum"
            }
        }
    }
}

Видео:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "VIDEO",
            "attachment": {
                "url": "https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
                "name": "Lorem Ipsum"
            }
        }
    }
}

Аудио:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "AUDIO",
            "attachment": {
                "url": "https://dl.espressif.com/dl/audio/ff-16b-2c-44100hz.aac",
                "name": "Lorem Ipsum"
            }
        }
    }
}

Геолокация:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "LOCATION",
            "location": {
                "longitude": "163",
                "latitude": "48",
                "address": "г. Москва, ул Правды, д 3",
                "name": "ООО Компания"
            }
        }
    }
}

С интерактивным меню:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "LIST_PICKER",
            "text": "Здравствуйте, пожалуйста, выберите, какого цвета худи вы хотите",
            "listPicker": {
                "button": "Цвета худи",
                "sections": [
                    {
                        "title": "Выберите цвет",
                        "items": [
                            {
                                "identifier": "1",
                                "title": "Red",
                                "subtitle": "Худи Матрица L красная"
                            },
                            {
                                "identifier": "2",
                                "title": "Blue",
                                "subtitle": "Худи Матрица L синяя"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

С кнопками ответа:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Здравствуйте, пожалуйста, выберите, какого цвета худи вы хотите",
            "keyboard": {
                "rows": [
                    {
                        "buttons": [
                            {
                                "text": "Красный",
                                "payload": "1"
                            },
                            {
                                "text": "Синий",
                                "payload": "2"
                            },
                            {
                                "text": "зелёный",
                                "payload": "3"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

С одним товаром:

{
    "requestId": "test-001",
    "cascadeId": "3",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "content": {
        "whatsappContent": {
            "contentType": "PRODUCT",
            "header": {
                "text": "какой-то футер"
            },
            "text": "Выберите лучшее предложение",
            "catalog": {
                "id": "377932094379589",
                "product": {
                    "id": "yxtgwrkdy9"
                }
            }
        }
    }
}

С группой товаров:

{
    "requestId": "test-001",
    "cascadeId": "8",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "content": {
        "whatsappContent": {
            "contentType": "PRODUCT_LIST",
            "header": {
                "text": "какой-то футер"
            },
            "text": "Выберите лучшее предложение",
            "catalog": {
                "id": "377932094379589",
                "sections": [
                    {
                        "title": "Shoes",
                        "products": [
                            {
                                "id": "yxtgwrkdy9"
                            },
                            {
                                "id": "5k0l3pwczd"
                            }
                        ]
                    },
                    {
                        "title": "Shirts",
                        "products": [
                            {
                                "id": "5k0l3pwczd"
                            }
                        ]
                    }
                ]
            }
        }
    }
}

HSM-сообщение WhatsApp

Текст и подпись:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "footer": {
                "text": "Спасибо за интерес"
            }
        }
    }
}

Текст, заголовок-текст и подпись:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "header": {
                "text": "Ваш чат с edna"
            },
            "footer": {
                "text": "Спасибо за интерес"
            }
        }
    }
}
  • Текст и заголовок-картинка:
{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "header": {
                "imageUrl": "https://cdn.maikoapp.com/3d4b/4qgko/200.jpg"
            }
        }
    }
}

Текст, заголовок-картинка и подпись:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Текст и заголовок-картинка и подпись",
            "header": {
                "imageUrl": "https://www.gstatic.com/webp/gallery/1.jpg"
            },
            "footer": {
                "text": "Ждем вас!"
            }
        }
    }
}

Текст и заголовок-файл:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "header": {
                "documentUrl": "https://cdn.maikoapp.com/3d4b/4qgko/200.jpg"
            }
        }
    }
}

Текст, заголовок-файл и подпись:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "header": {
                "documentUrl": "https://cdn.maikoapp.com/3d4b/4qgko/200.jpg"
            },
            "footer": {
                "text": "Спасибо за интерес"
            }
        }
    }
}

Текст, заголовок-видео и подпись:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Текст и заголовок-видео и подпись",
            "header": {
                "videoUrl": "https://file-examples.com/wp-content/uploads/2017/04/file_example_MP4_480_1_5MG.mp4"
            },
            "footer": {
                "text": "Ждем вас!"
            }
        }
    }
}

Текст и две чат-кнопки:

{
    "requestId": "test-001",
    "cascadeId": "11",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "keyboard": {
                "rows": {
                    "buttons": [
                        {
                            "text": "Привет!",
                            "type": "QUICK_REPLY",
                            "payload": "1"
                        },
                        {
                            "text": "Пока",
                            "type": "QUICK_REPLY",
                            "payload": "2"
                        }
                    ]
                }
            }
        }
    }
}

Текст и кнопка-ссылка:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "keyboard": {
                "rows": {
                    "buttons": [
                        {
                            "text": "Нажимай!",
                            "type": "URL",
                            "url": "https://raskladki.net.ru/ru/"
                        }
                    ]
                }
            }
        }
    }
}

Текст и кнопка-звонок:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "whatsappContent": {
            "contentType": "TEXT",
            "text": "Приветствуем! Напишите нам, чтобы познакомиться с функциями edna",
            "keyboard": {
                "rows": {
                    "buttons": [
                        {
                            "text": "Звони!",
                            "type": "PHONE",
                            "phone": "79000000000"
                        }
                    ]
                }
            }
        }
    }
}

Авторизационное сообщение с кнопкой копирования одноразового пароля:

{
    "requestId": "test-001",
    "cascadeId": "71",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "content": {
        "whatsappContent": {
            "contentType": "AUTHENTICATION",
            "messageMatcherId": 4601
            "text": "1234"
        }
    }
}'

Сообщение Viber

Текст:

я{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "viberContent": {
            "contentType": "TEXT",
            "text": "Новый текст совершенно"
        }
    }
}

Картинка:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "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"
            }
        }
    }
}

Документ:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "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"
            }
        }
    }
}

Сообщение с кнопкой и картинкой:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "viberContent": {
            "caption": "Название кнопки",
            "action": "https://www.w3.org/WAI/ER/tests/xhtml/testfiles/resources/pdf/dummy.pdf",
            "text": "Текст сообщения",
            "contentType": "BUTTON",
            "attachment": {
                "url": "https://www.gstatic.com/webp/gallery/1.jpg",
                "name": "Lorem Ipsum"
            }
        }
    }
}

Отправка SMS-сообщение с резервированием Viber-сообщением:

{
    "requestId": "test-001",
    "cascadeId": "1",
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2021-01-21T08:00:00Z",
    "content": {
        "smsContent": {
            "contentType": "TEXT",
            "text": "Новый текст SMS"
        },
        "viberContent": {
            "contentType": "TEXT",
            "text": "Новый текст VIBER"
        }
    }
}

Сообщение Push

{
    "requestId": "test-001",
    "cascadeId": 111,
    "subscriberFilter": {
        "address": "79000000000",
        "type": "PHONE"
    },
    "startTime": "2022-01-21T08:00:00Z",
    "content": {
        "pushContent": {
                "small": {
                    "text": "Заберите её в отделении банка",
                    "title": "Карта готова",
                    "imageUrl": "https://.png"
                },
                "big": {
                    "title": "Карта готова",
                    "text": "Заберите её в отделении банка",
                    "imageUrl": "https://.png"
                },
                "buttons": [
                    {
                        "text": "Поддержка",
                        "url": "DeeplinkSupport"
                    },
                    {
                        "text": "Напомнить позже",
                        "url": "DeeplinkLater"
                    }
                ],
                "action": "DeeplinkMainPush",
                "effects": {
                    "vibrate": "[500,100,500,150,50,50]",
                    "lights": "#770808",
                    "sound": "AthlonRoar",
                    "androidNotificationChannel": "Статус заказа"
                },
                "iosSettings": {
                    "interruptionLevel": "ACTIVE",
                    "category": "ednaPushCategory"
                }
            }
        }
    }

Сообщение OK Notify

{
  "requestId": "{{$guid}}",
  "cascadeId": "31759",
  "comment": "",
  "subscriberFilter": {
    "address": "70000000000",
    "type": "PHONE"
  },
  "content": {
                "okNotifyContent":{
                "contentType":"TEXT",
                "text":"Текст для сообщения OK Notify"
    }
  }
}

Сообщение VK Notify

Сообщение с кнопками:

{
  "requestId": "{{$guid}}",
  "cascadeId": "31778",
  "comment": "",
  "subscriberFilter": {
    "address": "70000000000",
    "type": "PHONE"
  },
  "content": {
                "vkNotifyContent":{
                "contentType":"TEXT",
                "text":"Сообщение с кнопками",
            "keyboard": {
                "rows": [
                    {
                        "buttons": [
                            {
                                "text": "button1",
                                "buttonType": "QUICK_REPLY",
                                "payload": "qwerty1",
                                "color": "positive"
                            },
                            {
                                "text": "button2",
                                "buttonType": "QUICK_REPLY",
                                "payload": "qwerty2",
                                "color": "negative"
                            },
                            {
                                "text": "button3",
                                "buttonType": "QUICK_REPLY",
                                "payload": "qwerty3",
                                "color": "primary"
                            },
                            {
                                "text": "perehod",
                                "buttonType": "URL",
                                "url": "https://edna.ru",
                                "payload": "qwerty4"
                            },
                            {
                                "buttonType": "LOCATION",
                                "payload": "qwerty5"
                            },
                            {
                                "text": "mini apps",
                                "buttonType": "VK_MINI_APPS",
                                "payload": "qwerty6",
                                "hash": "#edna",
                                "appId": 36637,
                                "ownerId": 7481938
                            }
                        ]
                    }
                ]
            },
        "messageMatcherId": 5675
        }
  }
}