Omnichannel Quickstart

Follow the guide to add SMS messages to your application in minutes.


Sending a message using the API is a three-step process.

  1. Sign up to Messente and receive your API keys (no credit card required).
  2. Verify your phone number as sender ID or request a branded Sender name .
  3. Using the API keys, make an API request with the desired message and recipient.

Upon sign up we will add you 1€ credit so you can test out the service immediately. With it you can send around 10-15 test messages.


Once you have received your API keys follow this guide to send a message.

1. Install a library

The fastest way to get started with the API is to use are official libraries.

Select your preferred programming language and follow the instructions.

With PIP

To install the API client library, simply execute:

pip install omnichannel-api

Or with Setuptools

To install the API client library, simply execute:

python setup.py install --user

then import the package:

import omnichannel 

Take a look at the package's GitHub and PyPI page.

Install with npm

npm install omnichannel_api --save

Take a look at the library's GitHub and npm packages page.

Install with composer

composer require messente/messente-omnichannel-php

Take a look at the library's GitHub and composer page.

Maven users

To install the API client library to your local Maven repository, simply execute:

mvn clean install

and add this dependency to your project's POM

<dependency>
	<groupId>com.messente.omnichannel</groupId>
	<artifactId>omnichannel-java</artifactId>
	<version>$INSTALLED_VERSION</version>
	<scope>compile</scope>
</dependency>

Gradle users

Add this dependency to your project's build file

compile "com.messente.omnichannel:omnichannel-java"

Others

At first generate the JAR by executing:

mvn clean package

Then manually install the following JARs:

  • target/omnichannel-java-$VERSION_NUMBER.jar
  • target/lib/*.jar

Take a look at the library's GitHub page for more information.

Install the library with gem.

gem install omnichannel

Take a look at the library's GitHub page for more installation options. You can also check out the gem in RubyGems library.

Install using NuGet

Install-Package com.Messente.Omnichannel

Take a look at the library's GitHub page. You can also check out the package in NuGet library.

These libraries only contain Omnichannel API features. For other Messente features you need to install different set of libraries. Libraries page contains the list of all our SDKs


2. Send a single SMS

Use the following example to send an SMS using Omnichannel API.

Detailed API Reference on sending an SMS

// PM > Install-Package com.Messente.Omnichannel

using System;
using System.Diagnostics;
using System.Collections.Generic;
using com.Messente.Omnichannel.Api;
using com.Messente.Omnichannel.Client;
using com.Messente.Omnichannel.Model;

namespace Example
{
    public class SendOmniMessageExample
    {
        public static void Main()
        {
            // Configure HTTP basic authorization: basicAuth
            Configuration.Default.Username = "MESSENTE_API_USERNAME";
            Configuration.Default.Password = "MESSENTE_API_PASSWORD";

            List messages = new List();
            var sms = new SMS(sender: "YOUR_PHONE_NUMBER", text: "Hello SMS!");

            messages.Add(sms);

            var apiInstance = new OmnimessageApi();
            var omnimessage = new Omnimessage(to: "RECIPIENT_PHONE_NUMBER", messages: messages);

            try
            {
                OmniMessageCreateSuccessResponse result = apiInstance.SendOmnimessage(omnimessage);
                Debug.Print("SMS successfully sent!");
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("There was a problem sending SMS: " + e.Message);
            }

        }
    }
}
    
# gem 'omnichannel', '~> 1.0.0'

require 'omnichannel'

# setup authorization
Omnichannel.configure do |config|
    # Configure HTTP basic authorization: basicAuth
    config.username = 'MESSENTE_API_USERNAME'
    config.password = 'MESSENTE_API_PASSWORD'
end

api_instance = Omnichannel::OmnimessageApi.new

omnimessage = Omnichannel::Omnimessage.new
omnimessage.to = 'RECIPIENT_PHONE_NUMBER'
omnimessage.messages = [
    Omnichannel::SMS.new(
        {
            :sender => "YOUR_PHONE_NUMBER",
            :text => "Hello SMS!"
        }
    )
]

begin
    result = api_instance.send_omnimessage(omnimessage)
    puts "SMS successfully sent!"
rescue Omnichannel::ApiError => e
    puts "There was a problem sending SMS: #{e}"
    puts e.response_body
end
    
# pip install omnichannel-api

from omnichannel import OmnimessageApi, SMS, Omnimessage, Configuration, ApiClient
from omnichannel.rest import ApiException

# API information from https://dashboard.messente.com/api-settings
configuration = Configuration()
configuration.username = "MESSENTE_API_USERNAME"
configuration.password = "MESSENTE_API_PASSWORD"

# create an instance of the API class
api_instance = OmnimessageApi(ApiClient(configuration))

sms = SMS(sender="YOUR_PHONE_NUMBER", text="Happy messaging!" )
omnimessage = Omnimessage(to="RECIPIENT_PHONE_NUMBER", messages=(sms,))

try:
    response = api_instance.send_omnimessage(omnimessage)
    print("SMS successfully sent with id %s:" % response.omnimessage_id)
except ApiException as e:
    print("There was a problem sending SMS: %s\n" % e)
    
// npm install omnichannel_api --save

const OmnichannelApi = require('omnichannel_api');

const defaultClient = OmnichannelApi.ApiClient.instance;

// Configure HTTP basic authorization: basicAuth
const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'MESSENTE_API_USERNAME';
basicAuth.password = 'MESSENTE_API_PASSWORD';

const api = new OmnichannelApi.OmnimessageApi();

const sms = OmnichannelApi.SMS.constructFromObject({
    text: "Happy messaging!",
    sender: 'YOUR_PHONE_NUMBER'
});

const omnimessage = OmnichannelApi.Omnimessage.constructFromObject({
    messages: [sms],
    to:"RECIPIENT_PHONE_NUMBER"
});

api.sendOmnimessage(omnimessage, (error, data) => {
    if (error) {
        console.error(error);
    } else {
        console.log('API called successfully. Returned data: ', data);
    }
});
curl https://api.messente.com/v1/omnimessage \
    -u MESSENTE_API_USERNAME:MESSENTE_API_PASSWORD \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{ "to": "RECIPIENT_PHONE_NUMBER", "messages": [{ "channel": "sms", "sender": "YOUR_PHONE_NUMBER", "text": "Happy messaging!" }] }'
    
// composer require messente/messente-omnichannel-php

require_once(__DIR__ . '/../vendor/autoload.php');

use \Messente\Omnichannel\Api\OmnimessageApi;
use \Messente\Omnichannel\Configuration;
use \Messente\Omnichannel\Model\Omnimessage;
use \Messente\Omnichannel\Model\SMS;

// Configure HTTP basic authorization: basicAuth
$config = Configuration::getDefaultConfiguration()
    ->setUsername('MESSENTE_API_USERNAME')
    ->setPassword('MESSENTE_API_PASSWORD');

$apiInstance = new OmnimessageApi(new GuzzleHttp\Client(), $config);
$omnimessage = new Omnimessage(["to" => "RECIPIENT_PHONE_NUMBER"]);

$sms = new SMS(["text" => "Happy messaging!", "sender" => "YOUR_PHONE_NUMBER"]);
$omnimessage->setMessages([$sms]);

try {
    $result = $apiInstance->sendOmnimessage($omnimessage);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling OmnimessageApi->sendOmnimessage: ', $e->getMessage(), PHP_EOL;
}
    
// compile "com.messente.omnichannel:omnichannel-java"

public class Main {
    public static void main(String[] args) {
        ApiClient defaultClient = Configuration.getDefaultApiClient();

        // Configure HTTP basic authorization: basicAuth
        HttpBasicAuth basicAuth = (HttpBasicAuth) defaultClient.getAuthentication("basicAuth");
        basicAuth.setUsername("MESSENTE_API_USERNAME");
        basicAuth.setPassword("MESSENTE_API_PASSWORD");

        OmnimessageApi apiInstance = new OmnimessageApi();
        Omnimessage omnimessage = new Omnimessage();

        SMS sms = new SMS();
        sms.text("Happy messaging!");
        sms.sender("YOUR_PHONE_NUMBER");

        omnimessage.setMessages(Arrays.asList(sms));
        omnimessage.setTo("RECIPIENT_PHONE_NUMBER");

        try {
            OmniMessageCreateSuccessResponse result = apiInstance.sendOmnimessage(omnimessage);
            System.out.println(result);
        } catch (ApiException e) {
            System.err.println("Exception when sending SMS message");
            e.printStackTrace();
        }
    }
}
    

3. Get delivery reports

Messente tracks your sent message and reports status updates back to you.

To be able to view the status, you must add a callback URL to the message. Messente will use this URL to make HTTP POST requests, if there is an status update.

Here is a code snippet for you to test it out quickly.

Learn more about the delivery status

# 1. Get a temporary WebHook URL from https://webhook.site/ .
# Leave the website open. This is where you'll see your incoming delivery reports.

# 2. Edit the previous code example by adding the delivery URL to the request.
var omnimessage = new Omnimessage(to: "RECIPIENT_PHONE_NUMBER", messages: messages, dlr_url: "YOUR_WEBHOOK_URL");

# 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
    
# 1. Get a temporary WebHook URL from https://webhook.site/ .
# Leave the website open. This is where you'll see your incoming delivery reports.

# 2. Edit the previous code example by adding the delivery URL to the request.
omnimessage.dlr_url = 'YOUR_WEBHOOK_URL'

# 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
    
# 1. Get a temporary WebHook URL from https://webhook.site/ .
# Leave the website open. This is where you'll see your incoming delivery reports.

# 2. Edit the previous code example by adding the delivery URL to the request.
omnimessage = Omnimessage(to="RECIPIENT_PHONE_NUMBER", messages=(sms,), dlr_url="YOUR_WEBHOOK_URL")

# 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
    
// 1. Get a temporary WebHook URL from https://webhook.site/ .
// Leave the website open. This is where you'll see your incoming delivery reports.

// 2. Edit the previous code example by adding the delivery URL to the request.
const omnimessage = OmnichannelApi.Omnimessage.constructFromObject({
	messages: [sms],
	to: "RECIPIENT_PHONE_NUMBER",
	dlr_url: "YOUR_WEBHOOK_URL"
});

// 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
// 1. Get a temporary WebHook URL from https://webhook.site/ .
// Leave the website open. This is where you'll see your incoming delivery reports.

// 2. Edit the previous code example by adding the delivery URL to the request.
$omnimessage = new Omnimessage(["to" => "RECIPIENT_PHONE_NUMBER", "dlr_url" => "YOUR_WEBHOOK_URL"]);

// 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
    
// 1. Get a temporary WebHook URL from https://webhook.site/ .
// Leave the website open. This is where you'll see your incoming delivery reports.

// 2. Edit the previous code example by adding the delivery URL to the request.
omnimessage.setTo("RECIPIENT_PHONE_NUMBER");
omnimessage.setDlrUrl("YOUR_WEBHOOK_URL");

// 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
    
# 1. Get a temporary WebHook URL from https://webhook.site/ .
# Leave the website open. This is where you'll see your incoming delivery reports.

# 2. Edit the previous code example by adding the delivery URL to the request.
curl https://api.messente.com/v1/omnimessage \
    -u MESSENTE_API_USERNAME:MESSENTE_API_PASSWORD \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{ "to": "RECIPIENT_PHONE_NUMBER", "messages": [{ "channel": "sms", "sender": "YOUR_PHONE_NUMBER", "text": "Happy messaging!" }] }, "dlr_url": "YOUR_WEBHOOK_URL"'

# 3. Send an SMS with the script and monitor the incoming requests in the webhook website.
    

4. Send a message to multiple channels with fallback

You can also send a single message to multiple channels by setting a fallback priority in the outgoing request. If the message recipient has not signed up or is not available on one of the channels, then Messente picks the next channel from the priority list.

For example in the following case message is sent to to Viber first and if the user is not registered to Viber, then WhatsApp is tried. If the user is not available on Whatsapp either, then Messente tries SMS.

curl https://api.messente.com/v1/omnimessage \
    -u MESSENTE_API_USERNAME:MESSENTE_API_PASSWORD \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    -d '{ "to": "RECIPIENT_PHONE_NUMBER", "messages": [{ "channel": "whatsapp", "sender": "YOUR_PHONE_NUMBER", "text": "Hello WhatsApp!" }, { "channel": "viber", "sender": "YOUR_PHONE_NUMBER", "text": "Hello Viber!" }, { "channel": "sms", "sender": "YOUR_PHONE_NUMBER", "text": "Happy messaging!" }] }'
    
# create an instance of the API class
api_instance = OmnimessageApi(ApiClient(configuration))

whatsapp = WhatsApp(sender="YOUR_PHONE_NUMBER", text=WhatsAppText(body="Hello WhatsApp"))
viber = Viber(sender="YOUR_PHONE_NUMBER", text="Hello Viber")
sms = SMS(sender="YOUR_PHONE_NUMBER", text="Happy messaging!" )

omnimessage = Omnimessage(to="RECIPIENT_PHONE_NUMBER", messages=(viber, whatsapp, sms))

try:
    response = api_instance.send_omnimessage(omnimessage)
    print("SMS successfully sent with id %s:" % response.omnimessage_id)
except ApiException as e:
    print("There was a problem sending message: %s\n" % e)
const api = new OmnichannelApi.OmnimessageApi();

const whatsAppText = OmnichannelApi.WhatsAppText.constructFromObject({
	body: "Hello WhatsApp!",
	preview_url: false
});

const whatsapp = OmnichannelApi.WhatsApp.constructFromObject({
	text: whatsAppText,
    sender: "YOUR_PHONE_NUMBER"
});

const viber = OmnichannelApi.Viber.constructFromObject({
	text: "Hello Viber!",
	sender: "YOUR_PHONE_NUMBER"
});

const sms = OmnichannelApi.SMS.constructFromObject({
    text: "Happy messaging!",
    sender: 'YOUR_PHONE_NUMBER'
});

const omnimessage = OmnichannelApi.Omnimessage.constructFromObject({
    messages: [viber, whatsapp, sms],
    to: "RECIPIENT_PHONE_NUMBER"
});

api.sendOmnimessage(omnimessage, (error, data) => {
    if (error) {
        console.error(error);
    } else {
        console.log('API called successfully. Returned data: ', data);
    }
});
$apiInstance = new OmnimessageApi(new GuzzleHttp\Client(), $config);
$omnimessage = new Omnimessage(["to" => "RECIPIENT_PHONE_NUMBER"]);

$whatsAppText = new WhatsAppText(["body" => "Hello WhatsApp!"]);
$whatsapp = new WhatsApp(['text' => $whatsAppText, "sender" => "YOUR_PHONE_NUMBER"]);
$viber = new Viber( ["text" => "Hello Viber!", "sender" => "YOUR_PHONE_NUMBER"]);
$sms = new SMS(["text" => "Happy messaging!", "sender" => "YOUR_PHONE_NUMBER"]);
$omnimessage->setMessages([$viber, $whatsapp, $sms]);

try {
    $result = $apiInstance->sendOmnimessage($omnimessage);
    print_r($result);
} catch (Exception $e) {
    echo 'Exception when calling OmknimessageApi->sendOmnimessage: ', $e->getMessage(), PHP_EOL;
}
OmnimessageApi apiInstance = new OmnimessageApi();
Omnimessage omnimessage = new Omnimessage();

Viber viber = new Viber();
viber.text("Viber text");
viber.sender("YOUR_PHONE_NUMBER");

WhatsApp whatsApp = new WhatsApp();
WhatsAppText whatsAppText = new WhatsAppText();
whatsAppText.body("WhatsApp text");
whatsApp.text(whatsAppText);

SMS sms = new SMS();
sms.text("Happy messaging!");
sms.sender("YOUR_PHONE_NUMBER");

omnimessage.setMessages(Arrays.asList(whatsApp, viber, sms));
omnimessage.setTo("RECIPIENT_PHONE_NUMBER");

try {
	OmniMessageCreateSuccessResponse result = apiInstance.sendOmnimessage(omnimessage);
	System.out.println(result);
} catch (ApiException e) {
	System.err.println("Exception when sending SMS message");
	e.printStackTrace();
}
# gem 'omnichannel', '~> 1.0.0'

require 'omnichannel'

# setup authorization
Omnichannel.configure do |config|
    # Configure HTTP basic authorization: basicAuth
    config.username = 'MESSENTE_API_USERNAME'
    config.password = 'MESSENTE_API_PASSWORD'
end

api_instance = Omnichannel::OmnimessageApi.new

omnimessage = Omnichannel::Omnimessage.new
omnimessage.to = 'RECIPIENT_PHONE_NUMBER'
omnimessage.messages = [
    Omnichannel::WhatsApp.new(
        {
            :sender => "YOUR_PHONE_NUMBER",
            :text => Omnichannel::WhatsAppText.new(
                {
                    :body => "Hello from WhatsApp!",
                    :preview_url => false
                }
            )
        }
    ),
    Omnichannel::Viber.new(
        {
            :sender => "YOUR_PHONE_NUMBER",
            :text => "Hello from Viber!"
        }
    ),
    Omnichannel::SMS.new(
        {
            :sender => "YOUR_PHONE_NUMBER",
            :text => "Hello SMS!"
        }
    )
]

begin
    result = api_instance.send_omnimessage(omnimessage)
    puts "SMS successfully sent!"
rescue Omnichannel::ApiError => e
    puts "There was a problem sending SMS: #{e}"
    puts e.response_body
end
    
// PM > Install-Package com.Messente.Omnichannel

using System;
using System.Diagnostics;
using System.Collections.Generic;
using com.Messente.Omnichannel.Api;
using com.Messente.Omnichannel.Client;
using com.Messente.Omnichannel.Model;

namespace Example
{
    public class SendOmniMessageExample
    {
        public static void Main()
        {
            // Configure HTTP basic authorization: basicAuth
            Configuration.Default.Username = "MESSENTE_API_USERNAME";
            Configuration.Default.Password = "MESSENTE_API_PASSWORD";

            List messages = new List();
            var sms = new SMS(sender: "YOUR_PHONE_NUMBER", text: "Hello SMS!");
            var viber = new Viber(text: "Hello viber!");
            var whatsapp = new WhatsApp(text: new WhatsAppText(body: "Hello WhatsApp!"));

            messages.Add(viber);
            messages.Add(whatsapp);
            messages.Add(sms);

            var apiInstance = new OmnimessageApi();
            var omnimessage = new Omnimessage(to: "RECIPIENT_PHONE_NUMBER", messages: messages);

            try
            {
                OmniMessageCreateSuccessResponse result = apiInstance.SendOmnimessage(omnimessage);
                Debug.Print("SMS successfully sent!");
                Debug.WriteLine(result);
            }
            catch (Exception e)
            {
                Debug.Print("There was a problem sending SMS: " + e.Message);
            }

        }
    }
}
    

To start sending Viber and WhatsApp messages please contact our support team.

Next steps

Integrating SMS to your application should never take more than a day. Now that you have things set up it's time to get yourself a proper sender name