Defining Deluge Functions

Defining Deluge Functions


If the chosen development platform of your skill is Deluge, you will have to define all your actions’ business logic in the pre-defined Deluge functions, hosted in Zoho’s cloud environment. 
 
Deluge is the native online scripting language of the Zoho cloud environment. The following are the pre-defined functions wherein you have to define the business logic of your action. 
  1. Execution function
  2. Context Handler function
  3. Button Click functions
These functions will be invoked at their respective invocation points.

Input Arguments

The following system defined input arguments are available for all the functions.

Argument
Deluge Data Type
Description
user 
Map
Contains the details of the user who is interacting with the bot. 
org
Map
Contains the details of the organization in Zia Skills that the interacting user belongs to.
sessionData 
Map
Contains the details of the client that is hosting the current chat session. 
cache
Map
A temporary storage variable which is used to pass data across functions along the action execution cycle.
broadcast
Map
A storage variable which is used to pass data across different actions, as the user is interacting with the bot. 

In addition to the system defined arguments listed above, all the static params defined for the action will also be available as input arguments individually for every function. 

Zia Skills will populate apt values for all the variables and will pass on as input arguments for all the functions.


Session Data

The current chat session details of the client will be stored in the bot's context and these data will be available in all functions under the 'sessionData' argument. This argument consists of the following keys.

Key Name
Possible Values
Description
 id 
 a unique id of current session

A unique id (session id) is assigned to every session.

 medium

 'call' or 'chat'.

The mode of communication through which the user interacts with the bot.

 client_host

 'mobile' or 'web'

The nature of client application that hosts the bot.

 client_host_type
  1. The name of the mobile operating system, if  'client_host' is 'mobile'.
  1. The name of the web browser, if 'client_host' is 'web'.

The specific environment in which the client_host runs.

 client_identifier
  1. The URL of the client web application, if  'client_identifier' is 'web'.
  1. The package name / bundle identifier of the mobile applicationif 'client_identifier' is 'mobile'.

A unique identifier of the client.


The following is a sample value of the 'sessionData' argument.
"sessionData" : {
                              "id" : "1579635239811",
                              "medium" : "chat",
                              "client_host" : "web",
                              "client_host_type" : "Firefox 72",
                              "client_identifier" : "https://zylker.com/"
                              }


Broadcast 

If you wish your bot to remember any information related to the currently executing action, the information can be set as a map value to 'broadcast' key. This value gets retained even after the execution of the current action and will be available for all subsequent actions until the current chat session is over. Subsequent actions can use this value, as required by their business logic.

The following is a sample value of the 'broadcast' argument.
"broadcast" : {
                           "user_level" : "admin", 
                           "status" : "booked"
                        }


Return value 

Each function has its own specification of return data. Please note that it is your responsibility to fulfill the return data contract of every function for the proper functioning of your action.


Function Validations

The code that you write to define the functions would be validated by Zia Skills for syntax and return value correctness.

Syntax validation happens whenever a function is attempted to be saved. If the syntax validation fails due to any compile time errors, the function will not be saved and an apt error message would be displayed. Compile time errors includes incorrect syntax, punctuation, missing variable initialization, etc.


In addition to the above syntax validations, the return values of the functions will also be validated for every function execution. You can use the sample chat window to test the functions and view the results of the return value validations in the Logs window.

If the function's return value violates the contract specified for the function, an apt error message with the JSON element that commits the error will be displayed in the Logs  window.


Every log would have been given one of the below labels, as per their purpose.

INFO - displays the debug prints whatever given in the code.

WARNING - displays the warning texts when something detected as wrong or unusual. E.g. Usage of any deprecated syntax in the code. Warnings will be ignored during action execution.

ERROR - displays the errors that occur when executing the code. E.g. syntax mismatch, unhandled exceptions. Errors will interrupt action execution and an appropriate message will be given as a response.

Please note, not only the errors committed in that current function in display will be shown in its Logs window, but the errors which are caused by other functions in the flow of the action will also be displayed here.

    Zoho CRM Training Programs

    Learn how to use the best tools for sales force automation and better customer engagement from Zoho's implementation specialists.

    Zoho CRM Training
      Redefine the way you work
      with Zoho Workplace

        Zoho DataPrep Personalized Demo

        If you'd like a personalized walk-through of our data preparation tool, please request a demo and we'll be happy to show you how to get the best out of Zoho DataPrep.

        Zoho CRM Training

          Create, share, and deliver

          beautiful slides from anywhere.

          Get Started Now


            Zoho Sign now offers specialized one-on-one training for both administrators and developers.

            BOOK A SESSION








                                You are currently viewing the help pages of Qntrl’s earlier version. Click here to view our latest version—Qntrl 3.0's help articles.




                                    Manage your brands on social media

                                      Zoho Desk Resources

                                      • Desk Community Learning Series


                                      • Digest


                                      • Functions


                                      • Meetups


                                      • Kbase


                                      • Resources


                                      • Glossary


                                      • Desk Marketplace


                                      • MVP Corner


                                      • Word of the Day


                                        Zoho Marketing Automation

                                          Zoho Sheet Resources

                                           

                                              Zoho Forms Resources


                                                Secure your business
                                                communication with Zoho Mail


                                                Mail on the move with
                                                Zoho Mail mobile application

                                                  Stay on top of your schedule
                                                  at all times


                                                  Carry your calendar with you
                                                  Anytime, anywhere




                                                        Zoho Sign Resources

                                                          Sign, Paperless!

                                                          Sign and send business documents on the go!

                                                          Get Started Now




                                                                  Zoho TeamInbox Resources



                                                                          Zoho DataPrep Resources



                                                                            Zoho DataPrep Demo

                                                                            Get a personalized demo or POC

                                                                            REGISTER NOW


                                                                              Design. Discuss. Deliver.

                                                                              Create visually engaging stories with Zoho Show.

                                                                              Get Started Now







                                                                                            You are currently viewing the help articles of Sprints 1.0. If you are a user of 2.0, please refer here.

                                                                                            You are currently viewing the help articles of Sprints 2.0. If you are a user of 1.0, please refer here.



                                                                                                  • Related Articles

                                                                                                  • Defining Params

                                                                                                    Params are the input data received from the user, in order to complete an action. If we consider the execution of an action analogous to filling a form, then the fields in the form shall be considered as params for the action.  For example, the ...
                                                                                                  • Defining an Action

                                                                                                    Adding a New Action To add a new Action to a Skill, follow the steps as given below. In the Skill's details page, under the ACTIONS tab, click the + ADD ACTION option. The Create New Action page appears. Give a meaningful name for the action. Based ...
                                                                                                  • Button Click functions

                                                                                                    The custom buttons can be created by defining the "button" card in the Execution function. Button Click functions are used to configure the business logic for those custom buttons when they are clicked. Invocation Point Once the custom button ...
                                                                                                  • Defining Sample Sentences

                                                                                                    Defining sample sentences is the key in defining your action, because this is what the user is likely to tell Zia in order to trigger your action.  If you have chosen the action intention as "Perform an Operation", then sample sentences must be ...
                                                                                                  • FAQ - Actions

                                                                                                    What is an action? An action is a single ability or a task that the bot performs when you give an instruction as a part of your conversation. For example, you can ask the bot to fetch your appointments for the day or ask it to schedule a meeting to ...
                                                                                                    Wherever you are is as good as
                                                                                                    your workplace

                                                                                                      Resources

                                                                                                      Videos

                                                                                                      Watch comprehensive videos on features and other important topics that will help you master Zoho CRM.



                                                                                                      eBooks

                                                                                                      Download free eBooks and access a range of topics to get deeper insight on successfully using Zoho CRM.



                                                                                                      Webinars

                                                                                                      Sign up for our webinars and learn the Zoho CRM basics, from customization to sales force automation and more.



                                                                                                      CRM Tips

                                                                                                      Make the most of Zoho CRM with these useful tips.



                                                                                                        Zoho Show Resources