HTTP Api Omni
HTTP Api Omni
3 CONFIDENTIAL
Date
Omni Messaging REST API
2022-04-05
Technical Description
Connecting to the API
Authentication
Sending Messages
Sending Status
Sending Recipients
Receiving Delivery Reports
Receiving Click/Open Notifications
Receiving Viber Subscription Status Notification
Account Status
Examples
Appendices
1. SMS Character Encoding
2. Multipart SMS
1
REST API Guide v1.3 CONFIDENTIAL
Introduction
Version History
Terminology
Application Programming
API
Interface
Global System for Mobile A digital mobile telephone system that uses a
GSM
Communication variation of time division multiple access.
2
REST API Guide v1.3 CONFIDENTIAL
3
REST API Guide v1.3 CONFIDENTIAL
Technical Description
This document describes the REST API of the Bulk SMS platform that is used in order to manage all
important aspects of your Bulk SMS platform remotely. This document will be updated regurlarly as
an increasing amount of features will be added to the API. In case a future change is incompatible
with the current specification, a new API version will be created and compatibility to the features
that are described in this document will be maintained.
The API is designed according to the REST architecture and is available in the following URL:
https://api.omni-messaging.com/v1
The character set used by the API is UTF-8 and the data encoding format is JSON. For this reason the
content type that must be used in HTTP messages is:
Authentication
The API uses standard HTTP authentication for user identification and access control. More
specifically an API client must include an HTTP authentication header in each request. The username
and the password of the HTTP request are the User ID and the Auth Key for each account. This
information is available in the API Settings page of the administration panel.
Username User ID
According to standard HTTP authentication method, an Authorization: Basic HTTP header must be
provided that contains the base64 encoded version of the string username:password. An example
HTTP header for a User having an ID of 1 and Auth Key "abcdefghijklm123456789" is:
4
REST API Guide v1.3 CONFIDENTIAL
Response Format
The API presents a unified response format and the status of the request (successful or not) is
generally described by the HTTP Status Code that is returned to the HTTP Client that makes the
request. The HTTP status codes that are used by the API are:
5
REST API Guide v1.3 CONFIDENTIAL
{
"status": "success",
"data": {
}
}
Please note that the type of the data field depends on the specific response. It usually contains a
JSON object but can also contain an Array or even primitive types like String, Integer etc.
The standard response format for failed requests contains an array of errors that caused the failure.
An example response format for failed requests is shown below:
{
"status": "error",
"errors": [
{
"code": 401,
"message": "Unauthorized"
}
]
}
Please note that not all error responses are guaranteed to contain the specified response format.
As a general rule, you must use the HTTP Status Code to determine if a request is successful or
not.
6
REST API Guide v1.3 CONFIDENTIAL
Sending Messages
An API client is able to send messages to one or many recipients using the sendings resource of the
API.
POST https://api.omni-messaging.com/v1/sendings
Using this resource, the user creates a sendings object that describes the sending details. A
sufficiently detailed example is shown below:
{
"transaction_id": "a unique transaction id",
"sending_name": "Sending name",
"sending_code": "Sending code",
"execution_timestamp": 1504000000,
"allow_duplicates": false,
"channels": [
{
"push": {
"notification": {
"message": "Example push notification message"
},
"validity_period": 60
}
},
{
"viber": {
"message": {
"text": "Viber Message to {tag 1}"
},
"validity_period": 10
}
},
{
"sms": {
"from": "Sender",
"text": "SMS Message to {tag 1}",
"encoding": 0,
"type": 1,
"validity_period": 120
}
}
],
"destinations": [
{
"id": "1",
"phone_number": "306900000000",
"tags": [
"John"
]
}
]
}
7
REST API Guide v1.3 CONFIDENTIAL
8
REST API Guide v1.3 CONFIDENTIAL
Required: Yes*. Please note that when template_id element is used then the channal element
is not required and will be ignored.
9
REST API Guide v1.3 CONFIDENTIAL
A successful request creates a sending object that describes the parameters of the sending that was
just created. A sample response is shown below.
{
"status": "success",
"data": {
"transaction_id": "a unique transaction id",
"sending_name": "Sending name",
"sending_code": "Sending code",
"sending_id": "SD-abcd1234",
"channels": {
"push": {
"notification": {
"message": "Example push notification message"
},
"validity_period": 60
},
"viber": {
"message": {
"text": "Viber Message to {tag 1}"
},
"validity_period": 10
},
"sms": {
"from": "Sender",
"text": "SMS Message to {tag 1}",
"encoding": 0,
"type": 1,
"validity_period": 120
}
},
"recipients": [
{
"id": "1",
"phone_number": "306900000000",
"tags": [
"John",
"Smith"
]
}
],
"execution_timestamp": 1504000000,
"allow_duplicates": false,
"status": "pending",
"cost_estimation": 0.1825
}
}
10
REST API Guide v1.3 CONFIDENTIAL
Most of the content of the response shows the message details that were used on this sending. The
following table describes the elements that have not been analyzed in the request object.
11
REST API Guide v1.3 CONFIDENTIAL
Channels Object
There are 3 types of channel objects that describe the different options for sending messages. Each
channel has unique characteristics that will be explained in detail in the following sections.
SMS
The user can choose to send an SMS message to each recipient, either directly or as a fallback
method if messages sent using other channels fail or get expired. An SMS channel object describes
all aspects of the SMS message and is shown in the following example:
{
"sms": {
"from": "Sender",
"text": "SMS Message to {tag 1}",
"encoding": 0,
"type": 1,
"validity_period": 120
}
}
Alternatively the Template feature could be used in an SMS object as shown in the following
example:
{
"sms": {
"template_id": "TP-NCEPMRHm",
"validity_period": 120
}
}
12
REST API Guide v1.3 CONFIDENTIAL
Required: Yes*. Please note that when sms.template_id element is used then the sms.from
and sms.text elements are not required.
13
REST API Guide v1.3 CONFIDENTIAL
14
REST API Guide v1.3 CONFIDENTIAL
Viber
Viber messages can be sent through this API for accounts that have the Viber capability enabled and
configured. A full featured Viber message object is shown below:
{
"viber": {
"message": {
"text": "Viber Message to {tag 1}",
"caption": "Click here",
"action": "http://example.com/",
"image": "http://via.placeholder.com/350x150"
},
"validity_period": 5,
"action_tracking": false,
"smartphone_only": false
}
}
Alternatively the Template feature could be used in an Viber object as shown in the following
example:
{
"viber": {
"template_id": "TP-NCEPMRHm",
"validity_period": 5
}
}
15
REST API Guide v1.3 CONFIDENTIAL
Please note that the action element can be personalized by using the {tag #} notation. All tags
in action URL will be url encoded except of the first tag in case action URL starts with a tag.
Required: Yes*. Please note that the viber.message and viber.template_id element are
not simultaneously required.
16
REST API Guide v1.3 CONFIDENTIAL
17
REST API Guide v1.3 CONFIDENTIAL
Push
An alternative communication channel that can be used in sending messages is the Push Notification
channel. If the requirements are met and the account configuration is complete, a push notification
campaign can be scheduled using the following specifications. A simple Push Channel object is
shown below:
{
"push": {
"notification": {
"title": "Push notification title",
"message": "Example push notification message",
"url": "",
"custom_data": {
}
}
}
}
18
REST API Guide v1.3 CONFIDENTIAL
19
REST API Guide v1.3 CONFIDENTIAL
Destinations
The destinations element of the sending object is used to define the destination phone numbers
for each sending. Each sending can be used to send messages to more than one recipients at a time,
for this reason the destinations object is an Array of destination objects.
Simple Destination
In it's simplest form, a destination can be a sigle phone number in International format. You may
also specify a unique id and destination specific tags. A full-featured example is shown below:
{
"id": "1",
"phone_number": "306900000000",
"tags": [
"John",
"Smith"
]
}
20
REST API Guide v1.3 CONFIDENTIAL
List
If you wish to send messages to a list that is already created through the administration panel, a
different destination object makes this possible. In the following example you can see that the
intended recipients for this sending are included in list LS-abcd1234.
{
"list_id": "LS-abcd1234"
}
You can also combine the 2 destination objects in order to send messages to multiple phone
numbers and multiple lists at the same time.
When list objects are used as destinations, the API retrieves and combines the phone numbers
contained in these lists as well as any extra destinations provided with the request. The response
contains an array of all destinations that will receive the message and a unique id for each
destination.
21
REST API Guide v1.3 CONFIDENTIAL
Sending Status
After a successfull sending creation the API offers a unique resource for each sending that a client
can use to monitor and retrieve information about the sending. The API call that must be executed
for this reason is:
The Sending ID that has to be used was mentioned in create sending response (example format:
SD-abcd1234). A successfull response contains the following information:
{
"status": "success",
"data": {
"transaction_id": "a unique transaction id",
"sending_id": "SD-abcd1234",
"sending_name": "Sending name",
"sending_code": "Sending code",
"channels": {
"push": {
"notification": {
"message": "Example push notification message"
},
"validity_period": 60
},
"viber": {
"message": {
"text": "Viber Message to {tag 1}"
},
"validity_period": 10
},
"sms": {
"from": "Sender",
"text": "SMS Message to {tag 1}",
"charset": "GSM",
"validity_period": 120
}
},
"charge": 0.09,
"execution_timestamp": 1504000000,
"allow_duplicates": false,
"status": "finished",
"delivery_status": [
{
"push": {
"delivery": {
"pending": 0,
"expired": 0,
"failed": 0,
"delivered": 0,
"opened": 0
}
}
},
22
REST API Guide v1.3 CONFIDENTIAL
{
"viber": {
"delivery": {
"pending": 0,
"expired": 0,
"failed": 0,
"delivered": 1,
"seen": 1
}
}
},
{
"sms": {
"delivery": {
"delivered": 0,
"not_delivered": 0,
"call_barred": 0,
"blocked": 0,
"absent_subscriber": 0,
"no_sms_subscription": 0,
"submitted": 0
}
}
}
]
}
}
The response contains the sending data as shown in "Create Sending" request as well as some extra
information regarding the sending and it's status. The extra fields are:
23
REST API Guide v1.3 CONFIDENTIAL
24
REST API Guide v1.3 CONFIDENTIAL
Sending Recipients
After a successfull sending creation the API offers a unique resource for each sending that a client
can use to monitor and retrieve information about the sending recipients. The API call that must be
executed for this reason is:
The Sending ID that has to be used was mentioned in create sending response (example format:
SD-abcd1234). A successfull response contains the following information:
{
"status": "success",
"data": [
{
"id": "SD-bfLodvhR-000000",
"phone_number": "306900000000",
"tags": [
"Tag 1"
],
"messages": {
"viber": {
"message": {
"text": "Tag 1",
"caption": "Caption",
"action": "Action",
"image": "Image URL"
},
"validity_period": 20,
"charge": 0,
"timestamp": 1521721262,
"fallbacked": true,
"dlr": "no_suitable_device",
"dlr_timestamp": 1521721272,
"message_status": "not_seen",
"message_status_timestamp": 1521721262
},
"sms": {
"from": "Sender",
"text": "Tag 1",
"type": "sms",
"encoding": "gsm",
"validity_period": 60,
"parts": 1,
"charge": 0.1825,
"timestamp": 1521721291,
"fallbacked": false,
"dlr": "submitted",
"dlr_timestamp": 1521721291
}
}
}
]
}
25
REST API Guide v1.3 CONFIDENTIAL
The response data contains data for every recipient of the sending if the following format.
26
REST API Guide v1.3 CONFIDENTIAL
27
REST API Guide v1.3 CONFIDENTIAL
Account Status
Information regarding your account status is available using the account resource.
GET https://api.omni-messaging.com/v1/account
{
"status": "success",
"data": {
"id": 1,
"username": "test",
"email": "[email protected]",
"mobile": "306900000000",
"account_status": "active",
"balance": 500.000
}
}
28
REST API Guide v1.3 CONFIDENTIAL
The messaging platform is able to forward delivery reports as they are received to client's system
that have initiated the sending. In order to enable the delivery report forwarding you must provide a
callback URL via the API section of the Web Administration Panel. This setting is user-specific and is
used for all delivery report events.
POST https://your-domain.com/api/delivery-reports
The full URL is user configurable. The body of the request will contain a JSON object as is shown in
the following example.
{
"id": "SD-abcd1234-000001",
"transaction_id": "a unique transaction id",
"sending_id": "SD-abcd1234",
"channel": "viber",
"dlr": "delivered",
"dlr_timestamp": 1504000030,
"message_status": "opened",
"message_status_timestamp": 1504000030
}
Each field contains information for a specific destination and is explained in the following table:
29
REST API Guide v1.3 CONFIDENTIAL
30
REST API Guide v1.3 CONFIDENTIAL
31
REST API Guide v1.3 CONFIDENTIAL
32
REST API Guide v1.3 CONFIDENTIAL
The messaging platform is able to forward Click/Open notifications as they are received to client's
system that have initiated the sending. In order to enable the notifications forwarding you must
enable delivery reports by provide a callback URL via the API section of the Web Administration
Panel and enable the "Click Notification Events" option.
POST https://your-domain.com/api/delivery-reports
The full URL is user configurable. The body of the request will contain a JSON object as is shown in
the following examples.
{
"id": "SD-abcd1234-000001",
"transaction_id": "a unique transaction id",
"sending_id": "SD-abcd1234",
"channel": "viber",
"clicked": true,
"clicked_timestamp": 1504000030,
"device_type": "mobile",
"device_os": "android"
}
{
"id": "SD-abcd1234-000001",
"transaction_id": "a unique transaction id",
"sending_id": "SD-abcd1234",
"channel": "sms",
"opened": true,
"opened_timestamp": 1504000030
}
Each field contains information for a specific destination and is explained in the following table:
33
REST API Guide v1.3 CONFIDENTIAL
34
REST API Guide v1.3 CONFIDENTIAL
The messaging platform is able to forward Viber subscription status change notification as they are
received to client's system. In order to enable the subscription status change notifications
forwarding you must provide a callback URL via the API section of the Web Administration Panel.
This setting is user-specific.
POST https://your-domain.com/api/viber-subcription-notifications
The full URL is user configurable. The body of the request will contain a JSON object as is shown in
the following example.
{
"id":"15",
"msisdn":"306900000000",
"type":"user_subscribed",
"timestamp":1521105142
}
Each field contains information for a specific destination and is explained in the following table:
35
REST API Guide v1.3 CONFIDENTIAL
Examples
Minimum SMS Sending
POST https://api.omni-messaging.com/v1/sendings
{
"transaction_id": "a unique transaction id",
"channels": [
{
"sms": {
"from": "Sender",
"text": "Message goes here"
}
}
],
"destinations": [
{
"id": "1",
"phone_number": "306900000000"
}
]
}
POST https://api.omni-messaging.com/v1/sendings
{
"transaction_id": "a unique transaction id",
"channels": [
{
"viber": {
"message": {
"text": "Viber Message"
}
}
}
],
"destinations": [
{
"id": "1",
"phone_number": "306900000000"
}
]
}
36
REST API Guide v1.3 CONFIDENTIAL
POST https://api.omni-messaging.com/v1/sendings
{
"transaction_id": "a unique transaction id",
"channels": [
{
"viber": {
"message": {
"text": "Hello {tag 1}, your invoice for
January is issued. Amount due: {tag 2}"
},
"validity_period": 30
}
},
{
"sms": {
"from": "Online Shop",
"text": "Hello {tag 1}, your invoice for January is
issued. Amount due: {tag 2}",
"validity_period": 120
}
}
],
"destinations": [
{
"id": "1",
"phone_number": "306900000000",
"tags": [
"John",
13.37
]
},
{
"id": "1",
"phone_number": "306900000001",
"tags": [
"Maria",
50
]
}
]
}
37
REST API Guide v1.3 CONFIDENTIAL
Appendices
GSM
According to the GSM specification, a standard SMS message can contain up to 140 bytes of data.
Standard Latin (ISO-8859-1) character encoding represents a single character using 1 byte, which is 8
bits. Therefore, the maximum number of Latin 1 characters that could be included in an SMS is 140.
GSM encoding represents characters using 7 bits instead of 8. This therefore provides a maximum of
160 characters per SMS. (140 * 8 bits) / 7 bits = 160.
This effectively halves the number of characters that the GSM character set can support, compared
to ISO-8859-1. In order to include common characters that are usually represented using the 8th bit,
these characters as well as other symbol characters must be re-mapped to a combination of lower
bits. These remapped characters are often referred to as special characters. This remapping, in
combination with packing 7-bit characters into 8-bit bytes is called GSM Encoding.
Due to the fact that the character set of this API is UTF-8 it is possible for the SMS text to contain
characters that cannot be represented from the standard GSM character set. In these cases an
automatic replace mechanism attempts to replace missing characters with visually similar
characters. If such a replacement is not possible then the offending character is removed from the
resulting SMS message.
You can find more information regarding the GSM character set here
Important Notice: According to the GSM specifications, the 9 special characters listed below count
as 2 individual characters:
Character Description
€ Euro sign
^ Circumflex accent
~ Tilde
| Vertical bar
\ Backslash
38
REST API Guide v1.3 CONFIDENTIAL
Unicode (UTF-8)
This character format allows for a greatly extended character set which supports many languages.
Due to the fact that each Unicode character requires 2 bytes, the SMS message length is reduced to
70 characters. 140 bytes / 2 bytes = 70 characters.
2. Multipart SMS
It is possible to send multiple SMS joined together to form a single long message. This type of
message is referred to as one of the following:
Long SMS
Concatenated SMS
Multipart SMS
A long SMS is comprised of several standard SMS containing a concatenation header at the beginning
of each one. Since this header is within the message, it reduces the total size of each SMS according
to the table below:
1 160 70
2 306 134
3 459 201
4 612 268
5 765 335
n n * 153 n * 67
Concatenated SMS are charged by the number of individual SMS messages used. If you send a 459
7-bit characters message, you will be charged for 3 SMS.
39