Arguments for Code Actions
For the Code Actions, you can now add function arguments to make them reusable without rewriting the Code Action. You can implement multiple Arguments for a single Cloud Code Action by adding the parameters and values for the same Code Action.
Rules for adding the arguments
- Data type: A code action argument should always be a string.
- Argument names: Argument names should be validated. An argument name must comply with JavaScript naming.
- Number of Arguments: The maximum number of arguments should be 30.
- Title length: The title should be unique for each Reply Action. The maximum length of the title should be 30 characters.
- Value Limit: The Maximum limit for the value should be 5000. The payload.args object is {} (empty) by default. This prevents additional null checks.
Adding Arguments to the Code Action
Perform the following steps to add multiple arguments for the Code Action:
- Click on the ACTION for the Reply Action Trigger.
- Select the applicable action from Choose the action drop-down menu.
Note: You cannot add Arguments for the Webhooks. - Click ADD FUNCTION PARAMETER button.
- In the FUNCTION PARAMETERS, enter the Title and Value.
- Click ADD FUNCTION PARAMETER to add multiple arguments.
- Click SAVE to update the arguments for the Event.
Example
Suppose the bot calculates the lead score to indicate the buying prospects during a conversation with the users. You can increase the score when they show interest in the product. When they explicitly say they want to buy the product, you can increase it with more points than just 1.
Previously, if you wanted to increase the lead score by 10 instead of 5, you would have to copy the entire code action and change the number. Using arguments within Code Action, you can add multiple arguments to increase the lead score based on the prospects.
When you configure a Code Action argument it will be available on execution inside the code action within the payload.args object.
Updated 11 months ago