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.

      Create. Review. Publish.

      Write, edit, collaborate on, and publish documents to different content management platforms.

      Get Started Now


        Access your files securely from anywhere

          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







                              Quick LinksWorkflow AutomationData Collection
                              Web FormsEnterpriseOnline Data Collection Tool
                              Embeddable FormsBankingBegin Data Collection
                              Interactive FormsWorkplaceData Collection App
                              CRM FormsCustomer ServiceAccessible Forms
                              Digital FormsMarketingForms for Small Business
                              HTML FormsEducationForms for Enterprise
                              Contact FormsE-commerceForms for any business
                              Lead Generation FormsHealthcareForms for Startups
                              Wordpress FormsCustomer onboardingForms for Small Business
                              No Code FormsConstructionRSVP tool for holidays
                              Free FormsTravelFeatures for Order Forms
                              Prefill FormsNon-Profit

                              Intake FormsLegal
                              Mobile App
                              Form DesignerHR
                              Mobile Forms
                              Card FormsFoodOffline Forms
                              Assign FormsPhotographyMobile Forms Features
                              Translate FormsReal EstateKiosk in Mobile Forms
                              Electronic Forms
                              Drag & drop form builder

                              Notification Emails for FormsAlternativesSecurity & Compliance
                              Holiday FormsGoogle Forms alternative GDPR
                              Form to PDFJotform alternativeHIPAA Forms
                              Email FormsFormstack alternativeEncrypted Forms

                              Wufoo alternativeSecure Forms

                              WCAG



                                        Create. Review. Publish.

                                        Write, edit, collaborate on, and publish documents to different content management platforms.

                                        Get Started Now







                                                          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


                                                                • Desk Community Learning Series


                                                                • Digest


                                                                • Functions


                                                                • Meetups


                                                                • Kbase


                                                                • Resources


                                                                • Glossary


                                                                • Desk Marketplace


                                                                • MVP Corner


                                                                • Word of the Day


                                                                • Ask the Experts


                                                                  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 Demo

                                                                                                    Get a personalized demo or POC

                                                                                                    REGISTER NOW


                                                                                                      Design. Discuss. Deliver.

                                                                                                      Create visually engaging stories with Zoho Show.

                                                                                                      Get Started Now









                                                                                                                          • Related Articles

                                                                                                                          • Zoho SalesIQ: Building a Zobot with Zia Skills

                                                                                                                            Zia Skills can be used as a bot building platform for a Zobot in Zoho SalesIQ. A bot-building platform is a layer where you define the abilities and business logic of your chatbots. A bot-building platform has the following roles. Handling Natural ...
                                                                                                                          • Zoho SalesIQ: A sample Zobot powered by Zia Skills

                                                                                                                            Zobot is Zoho SalesIQ's virtual chat agent that is designed to interact with website visitors conversationally. Zobot automates the process of interacting with website visitors and helps to maintain the presence of a helping hand, even when all the ...
                                                                                                                            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