Scenarios

Creating a new scenario

A scenario is a combination of a message and contacts. Its structure contains sections for both message content and contact information.

Note: The API currently only supports creation of scenario with SMS as communication mode.

To create a scenario you can use the /scenarios endpoint.

The following fields are required:

  • name: The name of the scenario.
  • description: Details of the scenario.
  • message { to, subject, body }.

High-level request elements

name

String

Specifies the name of the scenario.

description

String

Specifies the description of the scenario.

allowedUsers

String

Specifies the usage permission:

  • EVERYONE
  • SELECTEDUSERS

When SELECTEDUSERS is provided, then ‘allowedUserIds’ shall contain the userID of the allowed users.

allowedUserIds

String

Specifies the comma separated list of users who can run this scenario.

Only contains values when allowedUsers is set to ‘SELECTEDUSERS’

message

Object

Specifies the messaging options.

to

String

Specifies the phone number or MRI or distribution list to which the message has to be sent.

subject

String

Specifies the subject of the message.

body

String

Specifies the body of the message.

label

String

Specifies the label for the message (to view during reporting).

email

Object

Email message that can be sent as part of this scenario:

  • body: The main content of the email.
  • footer: The email footer.
  • type: Text/plain or text/HTML.

voice

Object

Similar to a text message, a voice call can also be triggered. This provides the necessary information for the channel.

  • header: The header for message. This will be played before the subject.
  • body: The main content of the message.
  • footer: The message footer. Played after the body. Usually contains a thank-you note.
  • type: ConfCall:, ConfAccountNo:, ConfPinNo:, ConfModPinNo:, Pin:

web

Object

See Web and social messaging. The web message structure remains exactly the same.

social

Object

See Web and social messaging. The web message structure remains exactly the same.


  • JSON
  • XML

Creating a scenario

The following API calls allow users to create scenarios using the Whispir API:

{{codeStart}}

HTTP 1.1 POST https://api.<region>.whispir.com/scenarios?apikey=[your_api_key]

Authorization: Basic asdf98nf89asdvasd2r398h8sdf

x-api-key: your_api_key

Content-Type: application/vnd.whispir.scenario-v1+json

{

"title" : "Fire Evacuation Block A",

"description" : "Fire evacuation notification for Block A residents",

"message" : {

"to" : "+1000000000",

"subject" : "Fire Evacuation",

"body" : "A fire has been detected at level 55. Please evacuate the building immediately. Please do not use the lifts."

}

}

{{codeEnd}}

This will give a successful 201 response along with the details of newly created scenario.