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. 

    • Related Articles

    • Defining an Action

      Adding a new Action To add a new action to a bot, follow the steps as given below.  In the bot's detail page, under the ACTIONS tab, click the + ADD ACTION option. The Create New Action page appears. Give a meaningful name for the action. Based on ...
    • Fallback Function

      When a bot receives an input message that it couldn't understand, it would reply with a "Sorry, I can't understand" message. If you wish to customize this default response message to give a reply of your own, you can customize that with Fallback ...
    • Action Followups

      Action Followups defines what the bot should recommend the user after executing an action, in order to engage the user further in conversation. The bot can display a list of suggestions or ask if it can invoke another action, that might be ...
    • Context handler function

      Context handler function is used to control the conversational flow of an action. You can change the order in which the params are prompted to the users in the runtime. You can also skip some params, do custom validations of the param values and ask ...
    • Trigger Function

      Zoho Survey is integrated with Deluge, our online scripting language, which can help you add functions to automatically perform actions when responses are submitted. Use Deluge and APIs to create connections and push data to third-party services or ...