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.
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:
This is the JSON object that is returned on the trigger. Modify this template to suit your needs.
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.
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.
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.
The parameters are as follows:
- context is name of the event.
- requestID is the request ID for the API.
- includeReporting indicates whether the response will have impression reporting data.
- arrActionType is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- event is the data associated with the event.
The parameters are as follows:
- context is name of the event.
- eventData is the data associated with the event.
- actionTypes is the type of action you want to request. You can specify one action or multiple actions in an array to handle.
- includeReporting indicates whether the response will have impression reporting data.
This code triggers the configured Omni JSON experience and handles the experience by displaying a banner. Customize the example code as you see fit.
You must handle the getActions method in a Thread or AsyncTask. To update the main thread, you can use either Handler or runOnUiThread. This code example uses Thread and Handler to update the main thread and change the UI.