MMOOZZGG.com

How to build an AI agent

AI agent for CRM: a deal assistant in amoCRM you can build yourself

6 min read12 sources

The easiest AI agent for CRM works like this: when a new deal appears, amoCRM sends a webhook to n8n. A model reads the lead and writes a note with its conclusion into the deal. Below, following the amoCRM documentation, we build it on a private integration with a long-lived token that lasts from 1 day to 5 years.

On this page · 6 sections

Build it yourself in a week

What the agent does in amoCRM

You can build a manager’s assistant in amoCRM yourself. It receives the data of a new deal, asks a model to assess the lead and leaves a note in the card: what the customer wants, what is missing for a quote, and the next step.

An API is the way a program reads and changes amoCRM data at an address like https://subdomain.amocrm.ru/api/v4/. A webhook works the other way round: amoCRM itself sends an event to the address of your server.

You need administrator rights in the account, since only the administrator creates integrations. You also need n8n on a server with a domain, so that amoCRM can reach the webhook, and a model. Ollama runs open models on your computer or server and comes under the MIT license.

Step 1: a private integration and a token

A private integration is a connection that works only in your account. It receives a token, the access key to the API.

1. Open the “amoMarket” section in your account and click “Create integration”.

2. Enter a name and a description, choose the permissions, fill in the Redirect URI and upload a logo. You can skip the hook for switching the integration off, since that field is optional.

3. Save the integration, open the “Keys” tab in its window and click “Generate token”. Choose an end date: the term runs from 1 day to 5 years.

4. Copy the token at once, since it is shown only once. A long-lived token needs no exchange or refresh, and you can revoke it with the “Revoke access” button on the “Issued access” tab.

The token goes in every request in the Authorization header, with the word Bearer and then the token. Keep it in the n8n credentials, not in the workflow text.

Step 2: a webhook for a new deal

1. In n8n, create a workflow with a “Webhook” node and choose POST in the “HTTP Method” field. In the “Respond” field choose “Immediately”: amoCRM waits no longer than 2 seconds for a reply, and a model thinks longer.

2. Publish the workflow and copy the node’s “Production URL”.

3. In amoCRM, in the “amoMarket” section, click “WEB HOOKS” in the top right corner, paste the address, tick the event for a new deal and click “Save”.

4. Create a test deal and open the “Executions” tab of the workflow in n8n. amoCRM sends data in the x-www-form-urlencoded format, with the id of the new deal among it.

If more than 100 failed replies pile up within 2 hours and the last one also fails, amoCRM switches the webhook off and notifies the administrators. You can switch it on again in the settings with the “Enable” button.

Step 3: the model writes a note

1. After the “Webhook” node, place “AI Agent”. In the “Prompt” parameter choose “Define below” and insert the deal data from the webhook into the “Prompt (User Message)” field.

2. In the node options, add a “System Message” that says how to assess a lead and in what form to write the conclusion: three lines, no promises to the customer.

3. Connect a model, for example the “Ollama Chat Model” node with an open model on your own server. The n8n documentation also requires at least one tool connected to the agent.

4. Add an “HTTP Request” node: a POST to https://subdomain.amocrm.ru/api/v4/leads/deal-number/notes with the Authorization header. In the JSON body, pass a list with one note: note_type set to common and params with a text field that holds the model’s answer.

5. Create another test deal and open its card: a text note from the integration should appear in it.

If the agent needs other events, webhooks also cover a deal change, a status change, a new contact and a new note. One account can have no more than 100 webhooks.

Customer data and rights

A deal holds the customer’s name, phone number and messages, and these are personal data. Under 152-FZ, Russia’s personal data law, they are collected and stored in databases in Russia. Since 1 March 2023, an operator notifies Roskomnadzor, the Russian regulator, before transferring them abroad.

Keep the model that reads deals on a server in Russia. The page on data security describes how we store customer data.

Choose the integration’s permissions for the task: an assistant that writes notes does not need to delete deals. If a token leaks, a one-month token does less harm than a 5-year one.

Working with webhooks through the API, not the interface, needs the “Advanced” or “Professional” plan.

When you need a developer

This assistant cannot answer customers in amoCRM chats. According to the chats API documentation, an integration works as a message transport from an outside chat system and sees only the chats it created itself. That is a separate development project.

We connect an agent that answers in messengers, creates deals, moves them through the pipeline and hands the conversation to a manager, as a turnkey project: a pilot in 14 days from $1,499 with a metric in the contract. Details are on the AI agent for amoCRM page.

n8n in this build runs under the Sustainable Use License (fair-code): you may install and change it for yourself, but not resell it as a cloud service. A similar build in another CRM has its own guide, and we wrote on the blog about how to choose a CRM for an agent.

Questions and answers

Why did the amoCRM webhook switch itself off?

amoCRM waits no longer than 2 seconds for a webhook reply and treats codes from 100 to 299 as success. If more than 100 failed replies pile up within 2 hours, it switches the hook off. Set the reply to “Immediately” in the “Webhook” node and switch the hook on again in the settings.

Can the agent answer customers in amoCRM chats?

Through the chats API, yes, but that is a developer’s job: the integration connects an outside channel and sees only the chats it created. The assistant in this guide works with deals and notes.

Sources and fact-checking

Checked by the editors on 16 October 2026.

  1. amoCRM for developers: step-by-step example, February 2024 (amocrm.ru)
  2. amoCRM for developers: Webhooks, 2026 (amocrm.ru)
  3. amoCRM for developers: webhooks API, 2026 (amocrm.ru)
  4. amoCRM for developers: events and notes, 2026 (amocrm.ru)
  5. amoCRM for developers: chat features, 2026 (amocrm.ru)
  6. Alpine Linux packages, 2026 (pkgs.alpinelinux.org)
  7. Brace Law Firm, 9 July 2023 (brace-lf.com)
  8. Wikipedia, 2026 (en.wikipedia.org)
  9. n8n documentation: Webhook node, checked 16 October 2026 (docs.n8n.io)
  10. n8n documentation: AI Agent node, checked 16 October 2026 (docs.n8n.io)
  11. n8n documentation: Tools Agent, checked 16 October 2026 (docs.n8n.io)
  12. n8n documentation: HTTP Request node, checked 16 October 2026 (docs.n8n.io)

Found a mistake? Tell us

Publications

Mike Mozg

Agentic AI use cases at AT&T: nearly 500 processes now run on agents

AT&T no longer uses AI only to help staff work faster: it is rebuilding whole business processes around agents. SiliconANGLE reported on 14 November 2026 that nearly 500 agentic AI use cases at AT&T are already in production. Here is how the company rebuilds them, where a human still checks the agent, and what other large companies can take from it.

News4 min
Contact us