Actions

Create a Banner Message Action

Displaying a banner involves creating an action trigger that activates an Omnichannel experience to return an appropriate JSON object. This object contains data that you can use to populate a banner message. You can use the getActions method to set up this trigger and obtain the JSON.

You can use the returned JSON data for multiple purposes. This example uses the JSON to display a banner message.

Creating the Experience

You must first create an Omnichannel experience in the Monetate platform that uses an Omni JSON action type. Refer to Create an Omnichannel Experience in the Monetate Knowledge Base for instructions, and to Available Action Types for additional information on Omni JSON actions.

You can use the following JSON template for the required input:

React Native
React Web
iOS
Android
Omni JSON Action Template Code


This is the JSON object that is returned on the trigger. Modify this template to suit your needs.

Triggering the Experience

The Omnichannel experience is triggered using the getActions method. This method is used when you want to satisfy an experience using a single event condition.

React Native
React Web
iOS
Android
getActions Method


The parameters are as follows:

  • actionType is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
  • context is name of the event.
  • eventData is the data associated with the event.
  • includeReporting indicates whether the response will have impression reporting data.

Full Code Example

This code triggers the configured Omni JSON experience and handles the experience by displaying a banner. Customize the example code as you see fit.

React Web
React Native
iOS
Android
Omni JSON Banner Action Full Example