On Demand

On Demand broadcasts are never sent automatically by Xenioo but can only be triggered by calling a very specific Launch Web Hook that will be dynamically generated for you. Invoked On Demand broadcasts are sent by Xenioo as soon as possible to all targeted users. The order of targets in each call is not guaranteed to be respected: if you need to send multiple broadcasts to the same user, use a small delay.

Broadcast Specific Settings

The following additional settings will be available when configuring this type of broadcast.

  • Enable Direct Mode Enable or Disable direct mode for the web hook. If enabled, the broadcast web hook can be called directly while if disabled, the web hook will require a bot api token to be supplied for each call.

  • Allow GET API verb Enable or disable calling the broadcast hook using a simple GET of the URL.

  • Allow POST API verb Enable or disable calling the broadcast hook using a POST call to the URL.

  • Require a Valid Filter in POST Payload If enabled, Xenioo will validate the incoming payload to make sure that the sent data is building a valid filter. If disabled, any json sent to the endpoint will be accepted and forwarded to the flow. Disabling this basically let you forward arbitrary payload that can be parsed by a script to a selected flow audience.

  • Enforce execution on a single contact regardless of filter When enabled, this flag will force the broadcast to always target a single conversation, regardless of the number of targets that are contained in the payload or in the audience.

  • Disable direct execution UI Button This setting will disable, or enable the execution button that appears beside each broadcast entry in the broadcasts view.

  • Visible to Mobile Operators If enabled, this broadcast will be available to all users accessing the bot from the Xenioo mobile application.

Launch Web Hook

This field contains the hook URL that Xenioo will generate for you. Use this hook in your integration systems to invoke this broadcast.

Calling the Web Hook

The web hook supplied by Xenioo can be called using either GET or POST standard http methods. In order to authenticate your request, a complete Bot Level Authorization Token must be created first.

When using POST, you have two ways of invoking the web hook using two different payloads: the audience and values approach lets you specify a dynamic audience and a set of value that will target one or more contacts using multiple filters while the mass users payload will let you target multiple users at once by specifying their unique id.

Xenioo 2.0 has added to On Demand invocation a full authorization header requirement. If you're integrating a service supporting only the previous version of Xenioo please make sure to activate the "Enable Legacy Mode" flag.

POST payload size cannot exceed 1MB total. Please take this into consideration when pushing to multiple simultaneous targets.

Audience and Values

Invoking the web hook using POST you can supply a number of parameters that can override the configured Audience or automatically set one or more variables for all targeted users. You can find an example of the full JSON payload below:


The above JSON, when posted to the Launch Web Hook will filter users to target only those with favorite_color equal to red and will create on all those users the variable new_favorite_color equal to magenta.

Using multiple values and variables is possible by just concatenating each entry with a semicolon (;). In the following example, we are using two filters and setting multiple variables:


In the example above, the target broadcast audience will be overridden by the dynamic parameters supplied: only the user with id equal to 3030391 and favorite_color equal to red will be targeted by the broadcast.

The JSON fields you may configure are:




A list of filter fields as a single, comma separated string that will be dynamically used ad audience filter.


The criteria to be used in the filters. Check table below for full reference.


The list of values for each of the field reference.


The list of logical operators that join the different filters. Can be either AND or OR. By default, or operators are AND.


The list of variables to be set automatically for each targeted user.


The values supplied for each variable.

When specifying the criteria field, you can use the following values:














The hook will return different http error codes depending on the call result:


200 OK

The call has been successful and the broadcast has been scheduled.

400 Bad Request

The call contains invalid data that cannot be correctly parsed. This may happen if the payload is invalid or some of the mandatory fields are incomplete.

404 Not Found

The specified broadcast has not been found or the broadcast is not enabled.

The set_conversation parameter

When invoking the OnDemand webhook using POST an additional boolean parameter named set_conversation can be specified. This parameter will ignore the audience filters and attempt to create a brand new conversation using the values supplied inside the set_variables and set_variables_values parameters.

Le't look at the following example:


Using the data above, Xenioo will execute the OnDemand broadcast trying to:

  • Search for an existing conversation for the targeted chatbot that has the specified user_id. If user_id is not supplied, it will try to use the user_phone_number;

  • If the conversation is found, it will target the found conversation for the broadcast and leave execution;

  • If the conversation is not found, it will create new conversation using the supplied variables and target it with the current broadcast.

Keep in mind that not all channels allow unattended or unsolicited messaging from unknown contacts and while the conversation can be created, the message delivery may still fail.

To create a brand new conversation at least bot_channel and user_phone_number (or user_id) must be supplied. If these parameters are missing the conversation won't be created.

If the targeted broadcast is called without the specified parameter, the specified Audience will be used instead for distribution.

The set_conversation parameter format is being deprecated and still exist solely for legacy support. Please do not use this kind of integration on V2 bots and always prefer the Multiple Users Creation and Targeting format.

Multiple Users Creation and Targeting

If you need to target multiple potentially new users with the very same broadcast you can use the targets payload mode when invoking the broadcast using POST.

The expected targets payload could look similar to the following example:

            "other_variable":"some other test value"

In the above example, the on demand broadcast will be sent to two different users. If the users do not exist, they will be created. Variables set in the payload do not need to be homogeneous: different contacts can have different variables. To create a new contact at least the user id and bot channel variables must be specified.

On WhatsApp, SMS and RCS, the user id of the contact is equal the user phone number variable. To create a new contact on these channels either user id or user phone number can be specified.

Delaying Delivery

You can enforce a delay in the broadcast delivery by specifying the delayminutes field in the payload.

            "some_variable":"...and 5 minutes later..."

The delay will affect the full execution of the broadcast, for all the specified targets.

Last updated