Integrating Outbound Viber Messages with Atmosphere®

Overview

This tutorial describes how to send outbound messages using Atmosphere® to Viber users. Viber allows accounts to send messages to other Viber users who subscribe to the account. Viber supports a variety of message type (text, picture, video, file, location, sticker, contact, carousel content and URL). For this tutorial we will look at how to send a simple text message. For information on how to send other messaging types, check out the Viber documentation.

To enable outbound messaging, you will need the following:

  • An IntelePeer Atmosphere® account: You can sign up for an account here.
  • A Viber account: You will need to log onto the platform from a mobile device to create an account.
  • An API request tool: Several free tools exist including, cURL, Postman, and Fiddler. The choice on which one is best to use is yours.

Note: The example function code in Python is provided as-is. Adapt the example to your use case, or design your own in your preferred programming language.

Configure Viber

  1. Create A Viber Bot: Once you have logged into Viber, you will select Create Bot Account from the left-hand navigation pane.
  2. Complete the webform: A webhook (also called a web callback or HTTP push API) is a way for Viber to provide your applications with real-time information.
  3. Click Create.
  4. Your bot will be created and note your Account Authentication Token. This token is a unique account identifier used to authorize any API request.

Configure Atmosphere®

  1. Add an External Web Call action to your flow.
  2. Go to the ADD HEADER section and add the following key / value pair:
  • KEY: X-Viber-Auth-Token
  • Token: Your Viber Account Authentication Token
  1. Configure the action as follows:

METHOD: POST

URL OF SERVICE: https://chatapi.viber.com/pa/send_message

CONTENT-TYPE: application/json

BODY:

Copy
{
"receiver":"01234567890A=",
"sender":{
"name":"My Company Name"
}
"type":"text",
"text":"Hello world!"
}

Only required fields have been added to the example. For detailed information on these and optional parameters, check out the Viber documentation.

  1. Save and Deploy your flow.