SMSBAT Cascade RESTful API

Complete Developer Guide
Cascading API for efficient communication via Telegram Bot, Viber Bot, Viber Business Messages, and SMS

Overview

SMSBAT Cascade RESTful API allows sending messages via Viber and SMS, supporting two message types: transactional and promo.

How It Works?

Using SMSBAT Cascade RESTful API is simple and straightforward:

  • Send a Single Request: Initiate a message by sending a single API request.
  • Automatic Cascading: Our API automatically cascades messages to Telegram Bot, Viber Bot, Viber Business Messages, RCS, and SMS.
  • Efficient Delivery: Messages are efficiently delivered to recipients on all selected platforms.

Protocol

HTTPS is used as the protocol. The request body is a JSON array of message objects.

Request Methods
POST
Creating Objects
For example, creating a campaign
GET
Retrieving Data
Message delivery status

Authentication

For your convenience, several authentication options are available:

Authorization Headers
X-Authorization-Key
SMSBAT API Key
Primary key for authorization
X-Viber-Auth-Token
Viber Bot API Key
For sending via Viber
X-Tg-Bot-Key
Telegram Bot API Key
For sending via Telegram
cURL
curl -H "X-Authorization-Key:<SMSBAT-API-Key>"
-H "X-Viber-Auth-Token:<Viber-Bot-API-Key>"
-H "X-Tg-Bot-Key:<Telegram-Bot-API-Key>"
-H "Content-Type:application/json"

Endpoints

Requests to the SMSBAT Cascade RESTful API are sent to the endpoint with localization

Available Endpoints
POST
/api/CascadeMessage/send_message/tg-viber/async
Send message to cascade with Telegram delivery
POST
/api/CascadeMessage/send_message/async
Send message to cascade

Message Types

The API supports different message types for different use cases

Transactional Messages

Used for important notifications, such as transaction confirmations, security alerts, etc.

JSON
{
  "id": "12358",
  "fromName": "AlphaName",
  "toPhone": "380680000000",
  "messageType": "transaction",
  "ttl": 60,
  "sheduledSent": "2023-12-04T16:18:00.000+02:00",
  "wheterCheckSession": true,
  "viberMessage": {
    "receiver": "9SM4pcbqBp8bFgbZtgmqBA==",
    "minApiVersion": 1,
    "type": "text",
    "sender": {
      "name": "John McClane",
      "avatar": "http://avatar.example.com"
    },
    "text": "Hello World!!!",
    "fallbackText": "Test text"
  },
  "tgMessage": {
    "text": "Hello world!!!",
    "photoUrl": "https://example.com/image.jpg",
    "chatId": 544507441,
    "buttons": [
      {
        "action": "action",
        "text": "Press"
      }
    ]
  }
}

Promo Messages

Used for marketing campaigns, advertisements, and informational messages.

JSON
{
  "id": "12358",
  "fromName": "AlphaName",
  "toPhone": "380680000000",
  "messageType": "promo",
  "sheduledSent": "2023-12-04T16:18:00.000+02:00",
  "buttonText": "test",
  "buttonAction": "https://www.google.com/",
  "wheterCheckSession": true,
  "viberMessage": {
    "receiver": "9SM4pcbqBp8bFgbZtgmqBA==",
    "minApiVersion": 1,
    "type": "picture",
    "sender": { 
      "name": "John McClane", 
      "avatar": "http://avatar.example.com" 
    },
    "text": "Моя промоція, моє ім'я %name=1% моя тестова URL-адреса %url=1%",
    "media": "http://www.images.com/promo.jpg",
    "keyboard": {
      "type": "keyboard",
      "defaultHeight": true,
      "buttons": [{ 
        "actionType": "reply", 
        "actionBody": "відповісти мені", 
        "text": "Детальніше", 
        "textSize": "regular" 
      }]
    },
    "fallbackText": "Промо: Нова Промоція!"
  }
}

Viber Survey Messages

Viber Survey Messages, SMSBAT RESTful API

Interactive survey messages with multiple choice options for collecting feedback from users.

JSON
{
  "id": "21111112",
  "fromName": "AlphaName",
  "toPhone": "380936670003",
  "messageType": "viber_survey",
  "ttl": 80,
  "viberMessage": {
    "ttl": 60,
    "text": "Оцініть якість обслуговування в нашому магазині. Ваш відгук допоможе стати кращими 💛",
    "survey": {
      "options": [
        "😍Все було супер!",
        "🙂Добре, але є куди рости",
        "😕Нормально",
        "😞Погано",
        "😡Жахливо"
      ]
    }
  },
  "customerData": {
    "type": "data"
  }
}

Flash Call

Automatic call to confirm the phone number.

JSON
{
  "id": "15",
  "toPhone": "380669227498",
  "flashcallText": "343",
  "fromName": "alphaname",
  "messageType": "flashcall"
}

Variables in Messages

To send messages with variable content, use the following syntax

Variable Syntax

To include a variable in a message, wrap the variable identifier with '%' and specify the variable type.

Example
"text": "My Variable %name=id%"
Variable Types
name
%name=id%
Variable Name
url
%url=id%
Variable URL
short_url
%short_url=id%
Shortened Variable URL

Important!

Before sending a message with variable content, variables must be uploaded to https://api.counterbat.com/api/items

Viber Survey Message Builder

Створіть та відправте Viber Survey повідомлення з інтерактивним опитуванням

85/85
17/50
25/50
11/50
8/50
9/50

Response Example

After a successful message send, the API returns the following response

JSON
[
  {
    "messageId": "f5af2610-0e3e-42f5-888d-c65561deed14",
    "trackinId": "12358"
  }
]
Response Fields
messageId
Guid
Unique identifier of the message in the system
trackinId
String
Unique identifier of the message to track its status