Banner Message
Banner messages are responses that are displayed to the user on top of the chat window/screen. A banner can be shown as a response for the following actions:
- Executing a command
- Performing an action on a message (Message Action)
- Calling a Bot's menu handler
- Mentioning a Bot
- Sending a message to a Bot
- Invoking a function button handler
- Executing a form submit handler
The list of attributes required to display a banner message are given below. The mandatory fields are indicated with a *
Attribute Name | Data Type | Description |
type* | String | An identifier to invoke a banner as a response. Allowed values: type=banner |
status* Accepted values that can be passed for the "status" key 1. success 2. failure | String | Banner category. Allowed values: status=success, denotes a banner with a green outline and status=failure, denotes a banner with a red outline. |
text* | String | Indicates the message passed in a banner. |
Syntax for a banner message
//To show a success message as a banner
{
"type":"banner",
"status":"success",
"text":"text to be shown in a banner"
};
//To show an error message as a banner
{
"type":"banner",
"status":"failure",
"text":"text to be shown in a banner"
};
Let's take a simple example of showing a banner message to the user when an internal component is triggered on the Cliq platform.
Sample command execution handler code
banner = {"text":"Execution successful!","status":"success","type":"banner"};
return banner;
Sample Response
Example for a banner message
Let us assume that your team has planned to meet for a product discussion. But before you decide on the meeting venue and other things, it is important to take the number of head counts. For this, create a simple /poll command that will record the responses from the user and store it in a database. When the user clicks on a button for example (Available/Not Available) a banner message is displayed to the user.