Помощен център Messagio API Compatibility

Messagio API Compatibility

SMSBAT supports a compatibility layer with the Messagio API. This allows you to migrate your existing Viber integrations designed for Messagio directly to SMSBAT without having to rewrite your payload structure or change integration logic.


Connection Settings

To route requests through SMSBAT, update the base URL and authentication credentials in your integration:

  • Base URL: https://restapi.smsbat.com
  • Endpoint: POST /api/SendMessage
  • Request Format: application/x-www-form-urlencoded (Form Data)

Authentication & Credentials

Requests are authenticated using parameters sent directly within the request body form data:

ParameterTypeRequiredDescription
userstringYesYour SMSBAT account login or user identifier.
signstringYesAPI secret or signature registered for the sender name.
fromstringYesRegistered sender alpha name.
sending_methodstringYesChannel type. Use viber for regular Viber Business messages or viber_otp for Viber OTP templates.
phonestringYesRecipient phone number in international format (e.g., 380501234567).

Viber Message Types

Choose a tab below to view the specific parameters and request payloads for different Viber message structures:

Sends a simple text message.

Additional Parameters:

ParameterTypeRequiredDescription
txtstringYesMessage text.

Request Payload Example:

POST /api/SendMessage HTTP/1.1
Host: restapi.smsbat.com
Content-Type: application/x-www-form-urlencoded

sending_method=viber&from=MySender&user=myuser&phone=380501234567&sign=api_secret_signature&txt=Hello+from+SMSBAT%21

Response Format

The Messagio API compatibility endpoint returns responses in XML format with an HTTP 200 OK status code.

Accepted (Success) Response

<response>
  <code>0</code>
  <tech_message>OK</tech_message>
  <msg_id phone="380501234567">MESSAGE_GUID</msg_id>
</response>

Error Responses

If a request parameters validation fails or authentication fails, the response will return a non-zero code.

<response>
  <code>-1</code>
  <tech_message>PARAM ERROR (sign)</tech_message>
</response>

Callbacks

Callback URLs must be implemented and hosted on your platform. SMSBAT sends HTTP callbacks to update your system regarding delivery events, survey responses, and user replies.

1. Delivery Status Callback

Sent when a message transitions status (delivered, read, failed).

  • Content-Type: application/x-www-form-urlencoded
  • Method: POST

Request Payload Formats:

  • Delivered:
    msg_id=MESSAGE_GUID&status=delivered
    
  • Seen/Read:
    msg_id=MESSAGE_GUID&status=delivered&type=seen
    
  • Undelivered / Failed:
    msg_id=MESSAGE_GUID&status=undelivered&status_extended=REASON
    

Fields Description:

  • msg_id: SMSBAT unique message ID (GUID) returned in the SendMessage response.
  • status: Delivery outcome (delivered, undelivered, or status unknown).
  • type: Set to seen when the message has been viewed by the recipient.
  • status_extended: Specific technical reason for undelivered status (e.g. VIBER_EXPIRED, VIBER_BLOCKED_BY_USER, VIBER_USER_NOT_FOUND, VIBER_NO_DEVICE).

2. Survey Answer Callback

Triggered when a user selects a response option in a Viber Survey message.

  • Content-Type: application/x-www-form-urlencoded
  • Method: POST

Request Payload Format:

msg_id=ORIGINAL_SURVEY_MESSAGE_GUID&text=SELECTED_OPTION_TEXT

3. Inbound User Message Callback

Triggered when a user sends a text or media reply back to your Viber Business service.

  • Content-Type: application/json
  • Method: POST

Request Payload Format:

{
  "msg_id": "INBOUND_MESSAGE_GUID",
  "text": "Hello, I have a question",
  "media": "https://example.com/user-attachment.png",
  "phone": "380501234567",
  "sender_bm_id": "12345"
}

Fields Description:

  • msg_id: The unique message ID generated for the inbound reply.
  • text: Text content sent by the user (can be null if they sent media only).
  • media: Direct URL to download any media attachments sent by the user (can be null if text only).
  • phone: Sender’s phone number in international format.
  • sender_bm_id: The Viber Business sender ID.