Button Click Functions
Introduction
ConvoKraft allows you to configure custom buttons in the responses while interacting with the user alongside the default Submit button. When you define Single/Multi selection list params for an action, if you need to perform further custom operations using the selected options as input, you can code the logic in Button click functions. These buttons can be created by defining the button card in the Execution function.
-
The Button Click Function can be used only if you have chosen the developement platform of your ConvoKraft bot to be Deluge.
-
You can configure a maximum of three Button Click functions for an action.
Invocation Point
Once the custom buttons configured in the Execution Handler response is clicked, the corresponding Button Click function configured for that button would be invoked.
Input Arguments
In addition to the system defined input arguements, the below listed input argument is also available for the Button Click Function :
Argument | Deluge data type | Description |
---|---|---|
data | Map | The value set to the data key for the button card in the Execution function |
Return Value
Button click function returns a map in the following format :
copy{ “message” : “The reply message.”, “card” : { }, "broadcast" : { }, "followup" : { } }
To learn more about the keys returned by the Button Click Function, please refer to this page.
Implementation
Once you create an action for your ConvoKraft bot and choose to configure the response based on a business logic, you must define the sample sentences and respective params for it. Please make sure to follow the below listed steps to implement the Button Click function :
- When you create an action, you will need to configure the required sample sentences and params for it. Click on New param and select Single/Multi selection list.
- In the param dialog box, under Submission Buttons, click Add Button to create a new custom button.
- Provide a meaningful action name for your button as Label and define a name that has to referenced in your Execution function for this custom button as Id.
- When you save the changes made to the sample sentences and params, you will be able to view the Functions tab. Under Button Click Functions, the custom button you have created will appear. Click on Edit Function to code the business logic of the button invocation. You could also create new functions by clicking on Add Function.
- Start writing your logic in the ConvoKraft Deluge editor and save the script once done. The editor also allows you to switch between functions right away. Click on the Test this Bot button to interact with the bot and validate the changes you made.
To learn more about the elements and usage of ConvoKraft editor, please refer to this page.
Last Updated 2023-07-03 17:23:11 +0530 +0530
Yes
No
Send your feedback to us