Skip to main content

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.
tip

Upon sign up we will add you some free credits so you can test out the service immediately. With it you can send a few test messages.


API key required

Follow this guide to send a message, once you have received your API keys.

Install a library

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

Select your preferred programming language and follow the instructions.

With PIP

To install the API client library, simply execute:

pip install messente-api

Or with Setuptools

To install the API client library, simply execute:

python setup.py install --user

then import the package:

import messente_api

Take a look at the library's GitHub and PyPI pages.

Let us know if your preferred language is not in the list
warning

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

Send a single SMS

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

# pip install messente-api

from pprint import pprint
from messente_api import (
OmnimessageApi,
SMS,
Omnimessage,
Configuration,
ApiClient,
OmnimessageMessagesInner,
)
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api_instance = OmnimessageApi(ApiClient(configuration))

sms = SMS(sender="<sender name (optional)>", text="hello sms")
sms_inner = OmnimessageMessagesInner(sms)

omnimessage = Omnimessage(messages=[sms_inner], to="<recipient_phone_number>")

try:
response = api_instance.send_omnimessage(omnimessage)
print(
"Successfully sent Omnimessage with id: %s that consists of the following messages:" % response.omnimessage_id
)
for message in response.messages:
pprint(message)
except ApiException as exception:
print("Exception when sending an omnimessage: %s\n" % exception)

Detailed API Reference on sending an SMS

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 a status update.

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

# 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(
messages=tuple([sms]), to="<recipient_phone_number>", dlr_url="<webhook_url>"
)

# 3. Send an SMS with the script and monitor the incoming requests on the webhook's website.

Learn more about the delivery status

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.

In the following case, a message is sent to Viber first and if the user is not registered to Viber, then SMS is tried. Finally, if all the other options were unsuccessful, Messente sends an SMS.

# pip install messente-api

from pprint import pprint
from messente_api import (
OmnimessageApi,
SMS,
Omnimessage,
Configuration,
ApiClient,
Viber,
WhatsApp,
WhatsAppParameter,
WhatsAppComponent,
WhatsAppTemplate,
WhatsAppLanguage,
OmnimessageMessagesInner,
)
from messente_api.rest import ApiException

configuration = Configuration()
configuration.username = "YOUR_MESSENTE_API_USERNAME"
configuration.password = "YOUR_MESSENTE_API_PASSWORD"

api_instance = OmnimessageApi(ApiClient(configuration))

viber = Viber(sender="<sender name (optional)>", text="hello viber")
viber_inner = OmnimessageMessagesInner(viber)

wa_parameters = [WhatsAppParameter(type="text", text="hello whatsapp")]
wa_component = WhatsAppComponent(type="body", parameters=wa_parameters)
wa_template = WhatsAppTemplate(
name="<template name>",
language=WhatsAppLanguage(code="<language_code>"),
components=[wa_component],
)
whatsapp = WhatsApp(sender="<sender name (optional)>", template=wa_template)
whatsapp_inner = OmnimessageMessagesInner(whatsapp)

sms = SMS(sender="<sender name (optional)>", text="hello sms")
sms_inner = OmnimessageMessagesInner(sms)

omnimessage = Omnimessage(
messages=(viber_inner, whatsapp_inner, sms_inner),
to="<recipient_phone_number>",
)

try:
response = api_instance.send_omnimessage(omnimessage)
print(
"Successfully sent Omnimessage with id: %s that consists of the following messages:" % response.omnimessage_id
)
for message in response.messages:
pprint(message)
except ApiException as exception:
print("Exception when sending an omnimessage: %s\n" % exception)
warning

To start sending Viber messages please contact our support.

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.