How to connect an AI agent to a custom (in-house) CRM via its API — without rewriting the system
Many companies run their own CRM: written for their process, hosted on their own server, and no off-the-shelf “AI assistant for amoCRM” fits it. You don't need to rewrite the system for that. If the CRM has a REST API that answers in JSON, an AI agent connects to it the same way it connects to a boxed one: you describe where the API lives, how to authorize and which request does what, and then you set up pipelines, create tasks and automations in plain words in a chat. This guide covers what you need, how it works in Kai and where the limits are.
In short / TL;DR
- Three things are needed: an https API address on a public host, an auth method (OAuth 2.0, API key, bearer or basic) and a pipelines-list endpoint. Everything else is optional.
- You connect with a connector spec: a JSON that Kai drafts from your docs or builds step by step in the chat. No code to write.
- After that the agent works with your CRM like with amoCRM: pipelines and stages, deals, contacts, companies, tasks, notes, fields, analytics; events from your CRM feed “event → action” rules.
- Try it first on Kai Sandbox CRM — a test CRM on Kai's side that connects exactly like a real one.
- Security: https only, requests only to your API's host, encrypted secrets, templates without code, size and rate limits.
- Connecting your own CRM is on the Max plan (€119/mo). Discussing the system and drafting the spec is free.
What “your own CRM” means to an AI agent
“Your own” here is any CRM that isn't on the list of ready-made integrations: an in-house system on Laravel or Django, a custom build on top of an open-source CRM such as EspoCRM or SuiteCRM, an internal portal with a sales module, or a CRM like HubSpot or Pipedrive. The agent doesn't care what it's written in. It needs three things: where to send requests, how to prove it's you, and which request does what. In Kai all of this is a connector spec — a JSON of a few dozen lines. Ready-made specs for HubSpot, Pipedrive and EspoCRM are already in the docs: paste, put your token in, send.
What you need before connecting
- The base URL of the API — https only and a public host only. Kai rejects local addresses, private networks and cloud metadata addresses, so nobody can reach someone else's infrastructure through the agent.
- Authorization in one of these ways: OAuth 2.0 (authorization code with PKCE or client credentials), a bearer token, an API key in a header, or basic auth. That covers what most in-house APIs can do.
- A pipelines-with-stages endpoint — the only mandatory operation. Deals, contacts, tasks, notes, fields, users are optional: describe them and the agent can use them; leave them out and it will honestly say the operation isn't available for this CRM and tell you what to add.
- JSON responses. The connector doesn't accept XML or HTML.
- Someone who knows the system. Kai drafts the spec from a description, but the field names should be checked by a person who has seen the code or the docs.
Three ways to connect
- Sandbox. In the Kai chat — Telegram or browser — tap “🔗 Connect CRM” → “🔧 My own CRM via API” → “🧪 Try Kai Sandbox CRM”. Kai spins up a small test CRM on its side with pipelines, deals, tasks and signed events and connects it exactly like a real custom CRM. Everything below works there too — the fastest way to see what the agent will do with your system before writing a line of the spec.
- From the docs. Paste a few paragraphs describing your API into the chat or attach a file — Kai drafts the spec, you check the field names and send it back.
- Step by step. The “🧩 Build the spec step by step” button: Kai asks for the API address, the auth method and two paths — pipelines and deals — calls them itself and reads the field names from live responses. No JSON to write; with OAuth 2.0 the fields are read right after you authorize.
A ready JSON can be sent as text or as a .json file. Before saving, Kai validates the spec — https, public host, placeholders, secrets — and tells you exactly what to fix. For OAuth 2.0 an “Authorize” button then appears for your CRM's side; for the other methods Kai calls the pipelines list right away and shows what it sees. Switch between several CRMs with /accounts.
What the agent can do once connected
| Operation | What Kai does | What to describe in the spec |
|---|---|---|
| Pipelines and stages | Lists, creates, renames, adds stages; tells “won” and “lost” stages apart | pipelines.list — mandatory; create, update, add_stage — optional |
| Deals | Searches, creates, updates, moves between stages, links contacts and companies | leads.list, leads.search, leads.create, leads.update |
| Contacts and companies | Creates and updates from a text or voice message | contacts.*, companies.* |
| Tasks | Creates with a due date on a deal, completes; reads the list for deal health and meeting briefs | tasks.create, tasks.complete, tasks.list |
| Notes and tags | Adds notes, applies tags | notes.create, notes.list, tags.* |
| Fields | Creates deal, contact and company fields: text, number, list, date; sets values | fields.* |
| Pipeline analytics | How many deals sit on each stage and where they get stuck | Data from leads.list |
| Automations | “Event → action” rules: your CRM sends an event to Kai's webhook, Kai creates a task, writes a note, notifies the chat | The events block in the spec + a webhook from your CRM, HMAC signature optional |
Placeholders like {{name}} in paths and request bodies are filled from the action's parameters, {{secret.token}} from this connector's secrets. Response paths are dotted: data.items, result.0.id. The agent builds requests only from what you described: no code, no access to anything else.
Security: what the agent cannot do to your system
- https only and public hosts only: addresses are checked both when the spec is saved and before every request — DNS is resolved again.
- Requests go only to the host of the base URL: paths in the spec are relative, absolute URLs and redirects are forbidden.
- Templates are not code: placeholders only. They have no access to Kai's environment, database or other users.
- Secrets are stored encrypted, never logged and are redacted from error messages.
- Limits: spec up to 64 KB, request body up to 256 KB, response up to 1 MB, 15-second timeout, 60 calls per minute per connector.
- OAuth 2.0: a signed state valid for 15 minutes, PKCE, a fixed redirect URI; the code is exchanged for a token only on Kai's server.
You can revoke access at any moment — delete the token or key on your CRM's side, and the agent's next request simply won't go through.
Limits: what you won't get
- Widgets or buttons inside your CRM: the agent lives in the chat and works through the API; it adds nothing to the system's interface.
- Operations that aren't in the spec: Kai doesn't guess endpoints, it asks you to describe them.
- APIs without JSON, with a non-standard request signature or reachable only inside a private network — a developer is needed first.
When you need a developer
- The CRM has no API — it has to be written. The minimum: pipelines and deals lists; the rest step by step.
- There is an API, but only inside the local network — you need a public https endpoint with authorization.
- You want events from the CRM for automations — the CRM has to send a webhook to Kai's address: one POST with JSON.
In every other case no developer is needed: Kai drafts the spec, the person who knows the system checks it.
With Kai it's one message
Once connected, talking about your CRM is no different from talking about amoCRM: you describe what you need, Kai asks follow-ups, shows a plan, does it and sends a report. Examples:
Show the pipelines in my CRM and how many deals sit on each stage.
Create the deal “Peters, kitchen” for 3,500 in the “Sales” pipeline, contact Peters, phone +1 555 000-0000, and a task “call back” for tomorrow.
When a deal moves to the “Contract” stage — create the task “issue the invoice” for the owner and message me in the chat.
Connecting your own CRM is on the Max plan: €119/mo, up to 10 CRM accounts, priority support. Discussing the system, asking for a draft spec and asking questions is free — during the trial and on any plan. Kai speaks English and Russian.
FAQ
My CRM is in-house, it has an API but no docs. Will it work?
Yes. Send examples of requests and responses or a piece of the controller code — Kai drafts the spec. Or build it step by step: give the address, the auth method and the paths to pipelines and deals; Kai calls them and reads the field names from the responses itself.
Is it safe to give an AI agent access to my own CRM?
Access is limited to what the spec describes: requests only to your host and only over https, templates without code, encrypted secrets, size and rate limits. To revoke access, delete the token or key on your side.
How much does connecting my own CRM cost?
It's the Max plan — €119/mo, up to 10 CRM accounts, priority support. Discussion and a draft spec are free. Building the CRM itself or its API is not part of the plan.
Do HubSpot, Pipedrive or EspoCRM count?
Yes. To the agent they are the same “own CRMs” via API: ready-made specs for them are in the Kai docs, you only need a token or an API key.
What's next
Open the Kai chat, tap “Connect CRM” → “My own CRM via API” and start with the sandbox or send your docs. If the system has a REST API, in one evening it becomes a CRM you can run with words.