Creating scenario

Find out about the simple method which will allow you to send WhatsApp messages, and combine other communication channels with simple failover approach.

The first step is to create an OMNI scenario. In the OMNI scenario configuration, you need to define the OMNI steps which will be sequentially executed. The key parameters are the channel and from, respectively identifying the communication channels and senders for each communication channel. 

PREREQUISITES 

The connection itself has to be secured either by using BASE64 hash combination of Infobip credentials, API keys or tokens as most secured and recommended option. In order to enable secure connection towards Infobip, please refer to this guide that contains all the details for enabling authorized connection – Security and Authorization

For WhatsApp sender (“channel”: “WHATSAPP” flow) you should use the WhatsApp sender provided during the activation process – the phone number in the international format that was activated for you, per example: 385981234567. 

NOTE

You need to create the scenario only during the initial phase. This step doesn’t need to be completed every time prior to sending the message. Creation of a new scenario is needed if you are adding new channels in a failover approach or changing the sender you will be using

POST /omni/1/scenarios HTTP/1.1 
Host: api.infobip.com 
Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ== 
Content-Type: application/json 
{
    "name": "My WHATSAPP-SMS scenario",
    "flow": [
        {
            "from": "WhatsAppSender",
            "channel": "WHATSAPP"
        },
        {
            "from": "InfoSMS",
            "channel": "SMS"
        }
    ],
    "default": true
}	
  

Response format

If successful, the response header HTTP status code will be 200 OK, and the scenario will be created, as shown in the example below. 

If you try to create the scenario without authorization, you will receive a 401 Unauthorized error. 

{ 
    "key": "CC9F01A5DC7BEE2C2B829D203482A654", 
    "name":"My WHATSAPP-SMS scenario", 
    "flow": [ 
      { 
        "from": "WhatsAppSender", 
        "channel": "WHATSAPP" 
      }, 
      { 
        "from": "InfoSMS", 
        "channel": "SMS" 
      }     
    ], 
    "default": true 
  }	
  

The key parameter needs to be stored as it will be used when sending the message.

INFO

More information about creating an OMNI scenario can be found on the following page: Scenario:// Create.