Viber Message

Sending Viber messages with Omnichannel API.

The easiest way to use Omnichannel API is with our official libraries. Libraries will take care of authentication, request validation and response handling.

Send Viber Message

Use the following example to send a Viber Message using Omnichannel API.

# pip install messente-api

from pprint import pprint
from messente_api import (
from 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")

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

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

const MessenteApi = require('messente_api');

const defaultClient = MessenteApi.ApiClient.instance;
const basicAuth = defaultClient.authentications['basicAuth'];
basicAuth.username = 'YOUR_MESSENTE_API_USERNAME';
basicAuth.password = 'YOUR_MESSENTE_API_PASSWORD';

const api = new MessenteApi.OmnimessageApi();

const viber = MessenteApi.Viber.constructFromObject({
  text: 'hello viber',
  sender: '<sender name (optional)>',

const omnimessage = MessenteApi.Omnimessage.constructFromObject({
  messages: [viber],
  to: '<recipient_phone_number>',

api.sendOmnimessage(omnimessage, (error, data) => {
  if (error) {
  } else {
    console.log('API called successfully. Returned data: ', data);

// composer require messente/messente-api-php

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

use Messente\Api\Api\OmnimessageApi;
use Messente\Api\Model\Omnimessage;
use Messente\Api\Configuration;
use Messente\Api\Model\Viber;

$config = Configuration::getDefaultConfiguration()

$apiInstance = new OmnimessageApi(
    new GuzzleHttp\Client(),

$omnimessage = new Omnimessage([
    'to' => '<recipient_phone_number>',

$viber = new Viber(
        'text' => 'hello viber',
        'sender' => '<sender name (optional)>',


try {
    $result = $apiInstance->sendOmnimessage($omnimessage);
} catch (Exception $e) {
    echo 'Exception when calling sendOmnimessage: ', $e->getMessage(), PHP_EOL;
import com.messente.ApiClient;
import com.messente.ApiException;
import com.messente.api.OmniMessageCreateSuccessResponse;
import com.messente.api.Omnimessage;
import com.messente.api.OmnimessageApi;
import com.messente.api.Viber;
import com.messente.auth.HttpBasicAuth;

import java.util.Arrays;

// repositories { jcenter() }
// dependencies { implementation 'com.messente.api:messente-api' }

public class Main {
    public static void main(String[] args) {
        ApiClient apiClient = new ApiClient();

        HttpBasicAuth basicAuth = (HttpBasicAuth) apiClient.getAuthentication("basicAuth");

        Viber viber = new Viber();
        viber.text("hello viber");
        viber.sender("<sender name (optional)>");

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

        try {
            OmniMessageCreateSuccessResponse result = apiInstance.sendOmnimessage(omnimessage);
        } catch (ApiException e) {
# gem install messente_api

require 'messente_api'

MessenteApi.configure do |config|
  config.username = 'YOUR_MESSENTE_API_USERNAME'
  config.password = 'YOUR_MESSENTE_API_PASSWORD'

api_instance =
omnimessage = = '<recipient_phone_number>'
omnimessage.messages = [
    sender: '<sender name (optional)>',
    text: 'hello viber'

  result = api_instance.send_omnimessage(omnimessage)
  puts result
rescue MessenteApi::ApiError => e
  puts "Exception when calling send_omnimessage: #{e}"
  puts e.response_body
// PM > Install-Package com.Messente.Api

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

namespace Example
    public class SendOmniMessageExample
        public static void Main()
            Configuration conf = new Configuration();
            conf.Username = "YOUR_MESSENTE_API_USERNAME";
            conf.Password = "YOUR_MESSENTE_API_PASSWORD";
            var apiInstance = new OmnimessageApi(conf);

            var viber = new Viber(
                sender: "<sender name (optional)>",
                text: "hello viber"

            List<object> messages = new List<object>

            var omnimessage = new Omnimessage(
                to: "<recipient_phone_number>",
                messages: messages

                var result = apiInstance.SendOmnimessage(omnimessage);
            catch (Exception e)
                Debug.Print("Exception when calling SendOmnimessage: " + e.Message);

curl -X POST \
  '' \
  -H 'Content-Type: application/json' \
  -d '{
    "to": "<recipient_phone_number>",
    "messages": [
        "channel": "viber",
        "sender": "<sender name (optional)>",
        "text": "hello viber"


  "messages": [
      "channel": "viber",
      "message_id": "fr593ce7-68de-5e44-bc50-044a3ad0a7fa",
      "sender": "SENDER_ID"
  "omnimessage_id": "632c6f3d-49d0-4a8f-5k2n-74023d31e51d",

Use the message_id to keep track of the message delivery status.


Viber messages are not limited to SMS restrictions. You can use text, images or buttons in your messages for the same price.

Viber has different price and content requirements for transactional and marketing messages. Contact us to learn more.

Possible combinations of text, image and button elements:

Text Button Image
Only text
Text with button
Text, button and image
Only image

Keep in mind that because of Viber API restrictions you can only send text content with image if you add a button to the same message.

Use the following parameters to compose the message with different elements:

text: Message (max 1000 characters)
image_url: Embedded image URL (jpg, jpeg, png, gif files are supported)
button_text: The text of the button
button_url: The URL of the buton

Error example

  "errors": [
      "code": "105",
      "detail": "Invalid or disallowed sender Messente",
      "source": "payload[viber][sender]",
      "title": "Invalid data"
Key Value
title Error message
detail Longer description of the error message
source Location in the request body for this error message
code Machine-readable error code
101 Not found
102 Forbidden
103 Unauthorized
104 Internal Server Error
105 Invalid data
106 Missing data
107 Method not allowed