# Setting up the chat robot

Open Bitrix24 and select the “Deals” or “Leads” section depending on where you want to set up the chatbot.

1. Click on the “Automation Rules” button

   <figure><img src="https://whatcrm.gitbook.io/~gitbook/image?url=https%3A%2F%2F1360887499-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fb61nIKR97C88XZEX04cC%252Fuploads%252Ftzh0fKbMXh645UYwIOUA%252Frr1.jpg%3Falt%3Dmedia%26token%3Dc43655d6-175b-496d-9d2c-74f580f82cd5&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=9779583d&#x26;sv=2" alt=""><figcaption></figcaption></figure>
2. Find the right stage of the sales funnel where you want to customize chatbot actions
3. Under the stage name, click the “+ Add” button

   <figure><img src="https://whatcrm.gitbook.io/~gitbook/image?url=https%3A%2F%2F1360887499-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Fb61nIKR97C88XZEX04cC%252Fuploads%252FOg9XLIqq1dNoriHdtlNC%252Frr2.jpg%3Falt%3Dmedia%26token%3D01905025-bdb4-42d5-b86b-1ab0efbeeb57&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=d9a36322&#x26;sv=2" alt=""><figcaption></figcaption></figure>
4. Select “Other” and then a communication channel with the name: \[Telegram by Whatcrm] \[whatcrm] Telegram

   <figure><img src="https://1360887499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb61nIKR97C88XZEX04cC%2Fuploads%2FlRyLGjoshF7peg2PTkMK%2FGroup%20388.jpg?alt=media&#x26;token=debce3ae-f4a7-4377-8c83-66179e4314b5" alt=""><figcaption></figcaption></figure>
5. Set up the conditions you need for the bot to be triggered
6. In the robot settings, select the desired Open Line. Messages will be sent from the phone number that is bound to this line. This allows you to manage sending messages through the right number by simply selecting the appropriate Open Line.<br>

   <figure><img src="https://1360887499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb61nIKR97C88XZEX04cC%2Fuploads%2FPI2qdwqZHYwlIgEkpQwE%2FGroup%20389.jpg?alt=media&#x26;token=8fd9953a-b773-4702-bf34-c24c02e9390d" alt=""><figcaption></figcaption></figure>
7. Adding files to a message (optional) Now you can attach files directly in the robot parameters:

   <figure><img src="https://1360887499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb61nIKR97C88XZEX04cC%2Fuploads%2FTz6qckkb5mZHgiB7Vu5z%2FGroup%20390.jpg?alt=media&#x26;token=8e3a5c0a-cd69-42c4-8ec6-e5be7b15f918" alt=""><figcaption></figcaption></figure>

* Click the “Upload file icon” button.
* Select the desired file from your computer disk. It can be an image, PDF catalog, document, etc.
* The file will be automatically attached to the post without the need to generate a direct link.

{% hint style="info" %}
💡 Please note: file sending may be subject to tariff-dependent restrictions. Please [check the file restrictions](https://whatcrm.gitbook.io/whatcrm-docs/english/useful-articles/attachment-limits).
{% endhint %}

Pay attention to the phone number type specified in the robot settings.

If one phone number type is specified in the contact/lead/transaction card (e.g. Work) and another is selected in the robot parameters (e.g. Mobile), the message will not be sent.

Make sure that the phone type selected in the robot matches the one specified by the customer.

## **Sending a notification to a custom recipient in Telegram**

<figure><img src="https://1360887499-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fb61nIKR97C88XZEX04cC%2Fuploads%2FREfaDklmPcEhaxCUwxNo%2FGroup%20391.jpg?alt=media&#x26;token=d74a577b-b373-4b8a-ac1a-6c6360ce5803" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
💡 **Example use case:**\
When a lead or deal moves to a specific stage, a Telegram notification is automatically sent.
{% endhint %}

To enable this, check the **"Send message to manager"** option.

**Recipient ℹ️**\
Enter only one of the following:

* **Phone number**: digits only.
* **Username**: starts with `@` (e.g., `@username`).
* **Group ID**: numeric identifier.

Enter the notification text and save the settings.
