Action Execution function

Action Execution function


The Execution function is the endpoint to an action execution. It defines the fulfillment of an action. This does the actual execution of the action and gives a final success (or failure) message to the user, as a result of the completion of an action. The response to the user can be a plain text or a collection of cards (visual elements).

Invocation Point

The Execution function is invoked at the endpoint of an action. By default, the endpoint of an action comes after all the param values are prompted and filled with proper values. Alternatively, the endpoint can also be triggered from the context handler function (“todo” : “execute”)Once the execution function is invoked, the action is completed and any further conversation from the user will be considered as a new action.


Input arguments

Only the system defined input arguments, are available as the input arguments of the Execution function. 

Return Value

Execution function must return a map that should be in the following format.
{
        “message” : “The reply message.”,
        “card” : { },
        "broadcast" : { }      
}

As shown above, the following are the keys that can be present in the map that would be returned from the Execution function. 

message

To give a plain text message as a reply to the user. The plain text will be rendered through voice or as text, depending on the medium of communication.
This key is mandatory. 

card 

To give a visually formatted message as a reply to the user. A card is a collection of visual elements such as table, image etc. Card will be rendered on the screen for both call and chat media. The value of this key is a list of map objects. Each map object represents a UI element in the card. A single card may contain more than one element of the same type. Every element in the card will be displayed one below the other in the reply message.
This key is optional. 


Below are the list of UI elements that are supported in Zia's reply message card.

No.
Element
Description
1.
Note

{
        “type” : “note”,
        “content” : “You have the following overdue tasks.”
}
Formatting options available in note content :
1. Bold — Shows ***this*** in Bold 
2. Italic — Shows %%this%% in Italic
3. Underline — Shows ___this___ with underline
4. Strikethrough — Strikes through ~~~this~~~ text
5. Link 
— Shows [this](link URL) as a link
2.
Title
{
        
“type” : “title”,
        
“content” : “Weekly sales report”
}
3.
List - Bullet & Numbered

{
        “type" : "list",
        “format” : "bullet”, //"numbered" in case of numbered list
        “elements” :
        [
        
        {
                        “label" : "point no. 1"
                },
                {
                        “label" : “point no. 2"
                }
        ]
}

4.
Table


{
        “type" : "table",
        “heading" : "Table Heading",
        “columns” :
        [
                "column1 header",
                "column2 header",
                "column3 header"
        ]
        “rows” :
        [
                [
                        “value a1",
                        "value a2",
                        "value a3"
                ],
                [
                        "value b1",
                        "value b2",
                        "value b3"
                ]
        ]
}
5.
Image
{
        “type" : "image",
        “content" : "image_url"
}
6.
File
{
        “type" : "file",
        “name” : "file_name",
        “format" : "pdf", //file extension
        “content" : "file_url"
}
7.
Contact card

{
        “type" : "vcard",
        “info” :
        {
                “image" : "image_url",
                “fields" :
                [
                        {
                                "First Name” : “Smith”
                        },
                        {
                                ”Last Name” : “Gibbs”
                        },
                        {
                                “Company" : “ABC Corp”
                        },
                        {
                                “Website" : “https: //www.abccorp.com"
                        }
                ]
        }
}

broadcast 

To give any data in a Map format, that would be available throughout the session, for consecutive action executions as well. If you wish the bot to remember any information when it processes the next action, it can be passed as a Map value to this key. 
This key is optional.