Home · Blog · Leads from a chatbot in CRM: funnel CHBT or webhook in amoCRM and Bitrix24

Leads from a chatbot in CRM: funnel CHBT or webhook in amoCRM and Bitrix24

· updated · Command CHBT · CRM, Integrations

In CHBT, the request from the bot has two routes to the manager. The first is the “Transaction in CRM” action in the flow: the card appears in the built-in Kanban immediately after the client calls the phone number, without a single setting outside. The second is the “HTTP request” action: the bot sends a POST with JSON (script variables, string tags, channel type) to your URL, and Make, n8n, Albato or your own script opens a deal in amoCRM or another CRM. For Bitrix24 there is also a ready-made connection in the “Integrations and API” section - a conversation event creates a lead. Below is how to configure each route, which JSON is sent out and why CHBT waits for a response for 15 seconds, what the built-in Kanban can and cannot do, and how to tag a request so that it does not get lost in any route.

Three ways to start a deal without a manager

The trade in CHBT appears in three ways, and only the first requires hands.

1. Manually. “Deal” button in the “CRM” section: name, amount, stage, responsible person, contact from the list. Needed for applications that came past the bot - by phone or by mail.

2. From a widget on the site. B chat on the site There is a button “Leave contacts”. When a visitor fills out a name, email or phone number, CHBT creates a contact, assigns a service tag to it, opens the “Lead from site - Name” deal in the “New” stage and sends a letter to the owner. Clicking the same button again by the same visitor does not create a second deal - deduplication by tag is already built-in.

3. From the script. In the block "Action" there is action "Transaction in CRM" with three parameters: name (with variables - for example, Application: {{service}} — {{name}}), amount and starting stage. Place it immediately after the “Data Collection” block, where you ask for a phone number: earlier, you will receive transactions without contacts; later, you will lose those who left for gratitude. Working diagram for the lead flow:

  1. “Message” with service selection buttons.
  2. “Action” → “Write variable” service = selected service (one action for each button branch).
  3. "Data collection" → Name.
  4. “Data collection” → Phone with format check, “Into variable” lead_phone.
  5. “Action” with three actions in a row: “Add tag” lead, “Transaction in CRM” with the name {{service}} — {{name}}, “Notify operator.”
  6. “Message” with confirmation and the “Operator” block so that the conversation goes into the inbox.

A ready-made example of the “Transaction in CRM” action is in the template “Buyer bot” - there the transaction is created upon the first scan of the QR. Open the template in “Scripts” and look at the settings of the “Capture in CRM” block. If you are assembling a script from scratch, it’s quicker to ask the AI ​​for an edit: “after assembling the phone, add the creation of a deal in CRM with a name from the service variable.”

One caveat: each passage of the flow creates a new deal. If a person completes the lead twice, there will be two cards. If you want one, place the “Condition” block before the action: tag lead “not specified” → create a deal, otherwise skip.

Built-in CRM CHBT: what's inside kanban

Section «CRM» in the office there is a board with four columns. The transaction card contains the name, amount in rubles, stage, person responsible and a link to the contact. You can assign any team member from the “Access” section to be responsible - owner, admin or operator. Cards are dragged between the columns with the mouse, and the “Funnel Sum” for all open transactions is calculated above the board.

From the transaction card, one click to the contact: there is a name, phone, e-mail, channel, tags, custom fields and the latest messages of the conversation. The manager does not need to look for correspondence in “Conversations” - the context is nearby.

What this kanban does not contain, and it is better to know in advance:

  • The stages are not editable - only four regular ones. If your process is longer (“qualified”, “QP sent”, “contract”), intermediate steps will have to be marked with contact tags.
  • There are no tasks or reminders to “call back on Thursday.” Discipline is in the manager’s head or in an external calendar.
  • There is no automatic transition of stages based on events - for example, “Paid” after the client wrote “paid”. The stage is moved by man.
  • There are no stage conversion reports. There is only a counter and a sum by columns, plus general analytics of the bot in “Analytics”.

This is enough for a small business: the goal of Kanban is for each request to be a card with the name of the person responsible, and not a line in the chat.

External CRM: what exactly is sent via an “HTTP request”

Action “HTTP request” in the “Action” block - the only bridge from the flow to the outside. There are three settings: URL, method (POST by default; GET, PUT, PATCH, DELETE available) and an optional field “to a variable” where the text of the server response will be saved. The body of the request CHBT is formed by the header itself Content-Type: application/json. Body Structure:

{
  "contact": { "id": 4821, "tags": "[\"lead\",\"src-vk\"]" },
  "vars": { "service": "Manicure", "lead_phone": "+7 912 000-00-00", "name_var": "Anna" },
  "text": "+7 912 000-00-00",
  "channelType": "telegram"
}

What is important to understand here.

  • The variables go away, not the card fields. The name, phone number and e-mail that the “Data Collection” block recorded in the contact will not be included in the request. Fill in the “To variable” field in these blocks - and the data will appear in vars. Details are in the help variables.
  • Tags come as a JSON string, not an array. On the receiving side it needs to be parsed - in Make this is one step “Parse JSON”.
  • text — the client’s last message at the time of action, usually this is the phone number just entered. Don't build logic on it.
  • channelType — telegram, max, vk or web. This is a ready-made source for the “Channel” field in CRM.

Limitations, which are honest: CHBT waits for a response for 15 seconds, does not make repeated attempts in case of an error, does not sign the request. If your receiver does not respond, the lead was not included in the external CRM, but the flow for the client will continue as if nothing had happened. Therefore the receiver must respond 200 immediately and process the data later, and insure critical requests with a tag and a letter to the owner. The format of incoming and outgoing requests is described in webhooks help.

Route via Make, n8n or Albato step by step

The connector is needed to turn the generic JSON from CHBT into a specific CRM API call. The procedure is the same for any service.

  1. Create a script in the connector with a "Webhook" trigger. It will return a URL like https://hook.eu1.make.com/…. Copy it.
  2. In CHBT, paste the URL into the "HTTP Request" action, POST method. Save the script.
  3. Go through the flow from your phone as a client and leave a test number. The connector will catch the request and show the structure of the fields - you will map using it.
  4. Add a duplicate search step: find a contact in CRM by vars.lead_phone. Found - update, not found - create. Without this step, each repeat lead will generate a second client.
  5. Create a deal: name from vars.service, source from channelType, tags - from the parsed list. In amoCRM, decide in advance whether the lead goes into the “Unsorted” or immediately into the funnel; in Bitrix24 - a lead or a deal, depending on the CRM mode.
  6. Assign a person in charge connector rule: one by one, by service from vars.service or by channel.

If you don’t want to pay for the connector, the receiver can be written in an hour in any language: accept JSON, call the CRM API, respond 200. This is the same “HTTP request”, only the URL leads to your server. For Bitrix24, the connector is not required: the ready-made connection and its limitations are described on the page integration with Bitrix24.

About AI qualification before transfer: if in the script before collecting the phone there is an “AI agent” block, its answers do not go to the CRM - only what is in the variables is transferred. If you want to record what the client asked, save the key answer with the “Save variable” action before the “HTTP request”.

The way back from CRM to a bot: what is possible and what is not

A frequent request: “the manager converted the transaction to a paid one - let the bot write to the client in Telegram.” There is no ready-made two-way synchronization with CRM in CHBT, but an external system can write to the client in his conversation - through the public API.

How it comes together. The webhook for the “new message” event transmits the id of the conversation, the connector saves it in the transaction. When a deal changes stage, the connector sends a text request POST /api/v1/conversations/:id/messages. The message goes to the client in the channel from which he wrote, as an operator response, and the conversation passes to the person. A closed conversation is first translated into work with a request /handoff. The API cannot write to someone who has not written to the bot. Details - in API Help.

Trigger "Incoming webhook" not suitable for this: the external system sends a POST to the script's address with a secret, and the script is launched as a new dialog in the widget channel, and not as a message to a specific person in Telegram or MAX. It is suitable for service flows and notifications to operators.

What can be done without development:

  • Messages to the client about the status - from the bot itself. The client writes “order status”, the script responds: if the orders live in your system - with the “HTTP request” action to it, otherwise - the operator’s response from the “Dialogs”. The order status with Ozon and Wildberries by number CHBT is not received.
  • Mass notifications to a group of clients - through the “Mailouts” section by tag. You can manually add a tag to a contact card or export the list from CRM and find people in Contacts by phone.
  • Single messages from the manager - from “Conversations”: the operator writes to the same chat where the client communicated with the bot.

Remember also the rule of messengers: the bot writes only to those who have already written to it. A contact entered manually in CRM with a phone number cannot be reached by a bot in Telegram - it does not have a conversation.

When is the built-in kanban enough, and when is a webhook needed?

Both routes close the same thing: a deal has been created, data from the conversation is in it, there is a person in charge, the manager moves the stage. The difference is where this deal lives and how much there is around it add on.

CriteriaSection “CRM” in CHBTamoCRM / Bitrix24 via "HTTP request"
SettingNothing: a deal is created by an action in the script or a widget buttonURL of the receiver, field mapping in Make/n8n/Albato or your own script
StagesFour fixed: “New”, “In progress”, “Paid”, “Rejection”Any funnels and stages of your CRM
Fields transactionsName, amount in rubles, responsible, contactAll fields of your CRM, including custom
Data from the conversationIn the deal name through variables, the rest - in the contact card (custom fields, tags)Everything that was saved “To variable”, plus tags and channel
Tasks, reminders, telephonyNoMeans CRM
PriceIncluded in any plan, including FreeCRM subscription + connector (Make and n8n have free limits)

The rule is simple: if you don’t have a CRM yet, don’t buy it for the sake of the bot, start with the built-in kanban; the “Transaction in CRM” action is already in the script, and moving to the webhook later is one additional “Action” block. If there is already a CRM and managers live in it, the bot should write there, and not create a second board: two boards mean that one of them will no longer be viewed in a month.

What tags should the lead script include?

Tags are the only data that equally ends up in both routes: in the contact card and in the external CRM in the field tags. Therefore, the lead script should add them itself using the “Add tag” action, and not rely on the manager. Three tags per lead are enough.

  • Source — src-vk, src-qr, src-site: placed in the first block of the branch where the “Deep Link” trigger with a specific payload or the “Opening” trigger leads widget".
  • Intention — manicure service, plan-pro: placed in the selection branch with the button.
  • Processing status — lead, processed: the first one puts the script, the second one - the manager with his hands in the card, when called.

Tag processed - cheap replacement for stages in the built-in kanban: filter in “Contacts” by tag lead without processed shows the unprocessed tail. How to build an entire tag system is in the article about tags as a segmentation system.

And another habit that saves nerves: at the end of the lead script, put the “Operator” block. The conversation will end up in “Conversations” with the status “Operator” (the “Waiting for a response” tab), the manager will see it in the list of unread ones and will respond from the account - even if the letter was lost in spam and the connector fell. Where exactly in the script to transfer the conversation to a person is discussed in the article about transferring the conversation to the operator.

Selection and launch checklist

  1. There is no CRM yet → built-in kanban CHBT. Add “Transaction in CRM” after the block with the phone number, assign a person in charge when you first view the board.
  2. CRM is → “HTTP request” on the webhook of the connector. In all “Data collection” blocks, fill in “To variable”, otherwise empty fields will go to CRM.
  3. Before the “Transaction in CRM” action, set the “Condition” tag lead, if you don't want duplicate cards.
  4. For external CRM, set up a search for a duplicate by phone before creating a contact.
  5. Check the receiver: the answer should come faster than 15 seconds. Submit a test request from your phone and make sure it reaches your CRM with the correct service and channel.
  6. Add a tag and "Notify Operator" next to "HTTP Request" - this is a fallback channel if the external system is not available.
  7. Complete the script with the “Operator” block so that the conversation appears in the inbox.

Built-in CRM and the “HTTP request” action are available on the Free plan - 1 bot, 30 conversations per month, all channels. This is enough to run the connection with your CRM on real requests before paying for Basic. How much do the Plans cost and what is included in them - on the page “Plans” page. Create a bot and configure the transfer of requests →

More on the blog