cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Arguments for Code Action

Arguments for Code Action

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.  

MeghaD_0-1667897930566.png

 

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: 

  1. Click on the ACTION for the Reply Action Trigger
  2. Select the applicable action from Choose the action drop-down menu. 
    Note: You cannot add Arguments for the Webhooks. 
  3. Click ADD FUNCTION PARAMETER button. 
  4. In the FUNCTION PARAMETERS, enter the Title and Value.
  5. Click ADD FUNCTION PARAMETER to add multiple arguments. 
  6. 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.

MeghaD_1-1667897931245.png

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. 

MeghaD_2-1667897930967.png

When you configure a Code Action argument it will be available on execution inside the code action within the payload.args object.


 

Arguments for Code Action

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.  

MeghaD_0-1667897930566.png

 

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: 

  1. Click on the ACTION for the Reply Action Trigger
  2. Select the applicable action from Choose the action drop-down menu. 
    Note: You cannot add Arguments for the Webhooks. 
  3. Click ADD FUNCTION PARAMETER button. 
  4. In the FUNCTION PARAMETERS, enter the Title and Value.
  5. Click ADD FUNCTION PARAMETER to add multiple arguments. 
  6. 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.

MeghaD_1-1667897931245.png

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. 

MeghaD_2-1667897930967.png

When you configure a Code Action argument it will be available on execution inside the code action within the payload.args object.


 

Arguments for Code Action

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.  

MeghaD_0-1667897930566.png

 

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: 

  1. Click on the ACTION for the Reply Action Trigger
  2. Select the applicable action from Choose the action drop-down menu. 
    Note: You cannot add Arguments for the Webhooks. 
  3. Click ADD FUNCTION PARAMETER button. 
  4. In the FUNCTION PARAMETERS, enter the Title and Value.
  5. Click ADD FUNCTION PARAMETER to add multiple arguments. 
  6. 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.

MeghaD_1-1667897931245.png

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. 

MeghaD_2-1667897930967.png

When you configure a Code Action argument it will be available on execution inside the code action within the payload.args object.


 

Version history
Last update:
3 weeks ago
Updated by:
Contributors