How actions work

How to turn on ChatRex actions, fill out the card, transfer parameters and check the result through preview.

An action is an operation that a bot causes during a dialogue. It can be built into ChatRex or provided by connected integration.

Enable actions

  1. Open My Bots and proceed to edit the bot.
  2. Select Integrations and actions.
  3. Turn on the switch Enable actions in the bot.
  4. Fill in the field The main purpose of the bot.
  5. Press Add action.

Action card

When creating, fill in the main fields:

  • Action name is a human-readable name for navigation in the interface; the bot does not use it.
  • The code name is a mandatory unique identifier in Latin that the bot sees.
  • Description of action for the bot - call conditions, purpose and expected result;
  • Response to perform an action - what the bot should do after the result is received;
  • What to do as a result of is one or more standard or integration actions.

Code names should not be repeated even for actions with different user names. Refer to them in the system prompt so that the bot uniquely chooses the desired operation. In the description, specify when the action is allowed to be caused and what data should be collected in advance.

Settings of nested operations are designed the same: the signature of the parameter is on the left, the switch or selection field is on the right, and the explanation opens with the hint icon. This order is maintained in the actions of connected integrations.

Preview of the result

After selecting and configuring the operation, open the Preview of the result block. It displays an example of JSON, which action will return the bot.

The preview helps to understand the structure of the response in advance and correctly use the obtained fields in the prompt. And it does:

  • does not perform the action;
  • does not create or modify data in an external system;
  • updated after changing the settings of the action;
  • It can be copied by the copy button.

If the mandatory parameters have not yet been filled in, the preview may be empty. Fill in the action settings and open the block again.

Variables and parameters

If an action needs dialog data, create it in the Bot Logic → Your Variables tab. For example:

  • phone - the client's phone;
  • email - e-mail;
  • order_number - Order number;
  • service is the selected service.

Insert variables via @ in those fields where the interface supports substitution, including the webhook URL. The list that opens combines the variables of the connected integrations and the Own variables block; the desired value can be found by searching. For mandatory data, add a rule to the prompt: first request and verify the value, then call the action.

Response to the outcome

After execution, the bot can use the received data in the response or continue the sequence of actions. In the prompt, specify:

  1. When to cause an action;
  2. what data are required;
  3. How to report success;
  4. What to do with an empty result or error
  5. when user confirmation is required.

Verification

Check out at least three scenarios:

  • successful implementation;
  • the absence of a mandatory parameter;
  • Error or empty response of the external system.

For CRM-changing actions that create a record or payment, use test data first. Do not allow irreversible and financial transactions without explicit user confirmation.

The preview shows only an example of the response structure and does not replace the action check in Testing.