Defining Deluge Functions
Deluge is the native online scripting language of the Zoho cloud environment. You can use deluge to write your business logic and automate actions across multiple Zoho applications and also enable integration with a third-party external service. They also contain a pack of in-built functions to perform common tasks, using which you could quickly build your application logic and also facilitate enhanced features in your applications. Deluge has a user-friendly syntax which allows you to build powerful applications real-quick.
You can seamlessly code the backend logic of your ConvoKraft bots using Deluge functions. Learn more about the data types supported by Deluge functions from this page.
ConvoKraft provides the below listed pre-defined Deluge functions each with its own purpose and invocation points, to define the business logic of your bots.
System-Defined Input Arguments
The following system defined input arguments are available for all pre-defined Deluge function types :
Argument | Deluge Data Type | Description |
---|---|---|
sessionData | Map | Contains the details of the client that is hosting the current chat session. To learn more about this argument, refer here. |
cache | Map | A temporary storage variable which is used to pass data across functions along the action execution cycle. To learn more about this argument, refer here. |
broadcast | Map | A storage variable which is used to pass data across different actions, while the user is interacting with the bot. To learn more about this argument, refer here. |
In addition to the system-defined arguments listed above, all the static params defined in the console for the action will also be available as input arguments individually for every Deluge function. ConvoKraft will populate the appropriate values for all the variables and will pass them on as input arguments for all the functions.
Code Deluge Functions
You can code the Deluge Functions in the in-built editor provided by ConvoKraft. We will be discussing more in detail about the editor, its usage and features in this section.
Overview of the Code Editor
The Deluge editor in ConvoKraft provides an unified experience wherein you could perform basic to complex operations all in the same place. It allows scripting by dragging tasks and dropping them onto the editor’s scripting area. It provisions quick access to set variables, add info statements or comments, and also add conditional statements including if, else if and else.
Additionally, the editor allows you to send notifications via email and also post as notifications to Zoho Cliq ( a communication platform powered by Zoho). You could also integrate with other Zoho services or with applications hosted in external servers using webhooks. You could create collections, insert data into collections, get data, update, delete or retrieve each element of the collection. You can learn more about the Deluge Editor from this page.
Function Validation
ConvoKraft validates the Deluge functions in the editor for its syntax and return value correctness automatically.
Syntax Validation
Syntax validation happens every time you attempt to save a Deluge function. If the syntax validation fails due to any compile time errors, the function will not be saved, and an appropriate error message will be displayed. Compile time errors include incorrect syntax, punctuation, missing variable initialization, and others.
Return Value Validation
In addition to the syntax validations, the return values of the Deluge functions will also be validated for every function execution in the ConvoKraft code editor. You can learn about the defined return value format for the Deluge functions from this page.
Return value validation happens when you execute the action by testing it using the bot’s chat window in the console. Click on Test this bot to start interacting with it. ConvoKraft validates the data type of the keys in the response such as message,card,broadcast and followup.
Please make sure to mandatorily fulfil all the values in the return map of the Deluge functions for the proper functioning of your action. If your function’s return value violates the specified format, an error message with the JSON element that commits the error will be displayed in the Logs window.
Function Logs
Every log contains at least one of the following labels:
-
INFO : Displays the debug and prints whatever is given in the code.
-
WARNING : Displays warning texts when something is detected as wrong or unusual. For example, the usage of any deprecated syntax in the code. Warnings will be ignored during action execution.
-
ERROR : Displays the errors that occur when code is being executed. For example, any syntax mismatch or unhandled exceptions. Errors will interrupt an action execution and an appropriate message will be thrown as a response.
You can switch between the various log levels in the editor to view only the respective logs.
Last Updated 2023-07-20 13:39:11 +0530 +0530
Yes
No
Send your feedback to us