+55 (21) 960104492
Log In Free trial
Select region

Trigger in Bitrix24 to track message reading in the bot designer

Trigger is an event that starts an action. An event represents a received message or a change in its status (sent, delivered, read).

The action that occurs as a result of the trigger involves moving the deal through the stages of the sales funnel. This process consists of two stages: first, an event is created in the Bot Designer, and then the action is configured in Bitrix24.

The connecting element of the two systems is a webhook.

Bot constructor

In the Bot Constructor, you can configure the reaction to the message status. This is done in the “Pause” block, where you can select the desired status, for example, “Delivered” or “Read”. Follow the instructions:

General instructions:

1. Create a script: Log in to your ChatApp account and go to the bot builder. Create a new script with a block to wait for a message to be read.

2. Add incoming fields: In the “Incoming Webhook” block, add fields that will be used to receive the user’s contact information by clicking on the “Add Field” button.

3. Set the “Send message*” block: Use the “{{chat_id_phone}}” variable, select the messenger and write the message text to send a message to a specific user.

4. Set the status expectation: Set up the “Pause” block with the desired “By Status” response by selecting the expected status that you want to track.

Instructions with a specific example:

1. Add two variables to obtain contact information. Add 2 fields with variables: “chat_id_phone” and “id_deal” to the “Incoming Webhook” block.

Note: the variable “chat_id_phone” is the entity of the contact, which is contacted by phone number, username, and the variable “id_deal” is the entity of the CRM system, that is, the deal. With the help of these two variables, a connection occurs.

2. Fill in the empty fields to transfer information to a specific user. Fill out the “Sending message*” block: specify the variable “{{chat_id}}”, line, messenger, message text.

3. to stop the dialogue until the message is read by the user. Select the reaction “By status” – “Read”.

4. Add the “Send webhook” block. Using a webhook, we move the sales funnel to the desired stage in Bitrix24.

Please note that the “Sending webhook” block is filled in after setting up Bitrix24.

5. Copy the link from the “Incoming Webhook” block in the bot designer. It will be used in the next paragraph of the Bitrix24 article.

Bitrix24

Movement through the funnel is carried out in Bitrix24 using a trigger. The action is movement along the funnel, which is provided by a webhook from the bot. The trigger action is movement through the sales funnel.

1. Create a deal, fill in the required fields.

2. Open the robot settings window.

3. Create an “Outgoing Webhook” robot at the first stage of the sales funnel. Our outgoing webhook will call the bot constructor script (the link to the script was copied in the first part of the article when preparing the script). This will allow data to be exchanged between the two systems. Let's link the deal to the scenario using the deal ID and client contact number.

4. Paste the copied link (to the bot script) into the “Handler” field in the “Outgoing Webhook” robot in Bitrix24. In the “One by one” item, select - Regardless of other robots, and in the “When” item – Current time (Immediately). Complete the link with variables as shown in the example.

5. Place the cursor after “chat_id_phone=” and click on the button. Through the search, find the variable “Phone (text)”. Place the cursor after “id_deal=” and enter the deal id. Save your settings.

Note: Instead of the general form of the variable, enter specific values:

  • {{Contact: Phone (text)}} enter the phone number without spaces, for example {89886665444}.
  • {{id}} can be found in the deal card. Click on it and the address bar of the browser will show the deal number, for example, if the URL is https://b24-ej2ic2.bitrix24.ru/crm/deal/details/127/, then the deal id will be 127.

Link with filled variables:

6. Create a “Track Incoming Webhook” trigger at the stage of the deal where you want it to move when the message is read. Click on the blue “Add” text.

7. Go to the robot settings window. Under the “Track Incoming Webhook” trigger, click “Edit”.

8. Copy the link from the URL field in the robots settings window.

Moving the deal to the right stage

1. Paste the link into the “Submit Webhook” block.

2. In the “Params” field, add “target” under “Key” and “DEAL_{{id}}” under “Value”.

3. Save and publish the bot.

Ready! Now, after reading the client’s message, the deal will automatically move to the next stage, and employees will be able to continue working with the active deal.

Leave a request for integrator services