Integration of a site with amoCRM: API and webhooks
A lead comes from a form on the site — the manager spends 2–3 minutes manually entering the contact into amoCRM. That's 30% of lost leads due to delay. Each lost lead costs on average $45–65 in potential revenue. Automatic integration via REST API eliminates the delay and ensures every request immediately lands in the right funnel. Sales team time savings — up to 40%. With an average manager salary of $450–650 per month, that's $180–260 saved monthly per manager. Payback of integration — less than 3 months.
We have set up such synchronization for 30+ projects: from online stores to B2B portals. Stack — Laravel 11, PostgreSQL, Redis. We guarantee 99.9% uptime and processing 1000+ leads per hour.
Why OAuth 2.0 is the only option for server-to-server?
amoCRM uses Authorization Code flow with a long-lived refresh token (60 days). Unlike Bitrix24, where permanent webhooks can be used, amoCRM requires a full OAuth scheme. According to official amoCRM documentation, this is the only method for server-to-server interaction.
Setup process:
- Create an integration in the amoCRM account: "Settings → Integrations → Create integration".
- Obtain
client_id,client_secret,redirect_uri. - Initial authorization — a manual step via browser (generating a code).
- Exchange code for access + refresh tokens — programmatically.
- Automatic access token refresh via refresh.
// ... We recommend storing tokens in cache and database — this reduces the risk of losing access. In case of a cache failure, the backup in settings allows session recovery without re-authorization.
API client for working with entities
amoCRM v4 REST API supports all CRUD operations. We use a single client with a 15-second timeout:
// ... How do we create a contact and a deal?
In amoCRM, a request is a combination of Contact and Lead. We first search for an existing contact by phone to avoid duplicates, then create a deal with custom fields (source, UTM tags). Detailed algorithm:
// ... Custom fields are created via the amoCRM interface. Their IDs can be obtained via GET /leads/custom_fields. In the config, we map the field_id.
What to do with webhooks from amoCRM?
Webhooks provide feedback from amoCRM when a deal status changes. Setup is simple: in the integration interface, specify your endpoint URL. amoCRM sends POST requests in form-encoded format. Example handler in Laravel:
// ... Thus, when an order is paid on the site, the status changes in amoCRM, and conversely — when the status changes in CRM, the order is updated. Webhook processing speed — up to 5 seconds, which is 3 times faster than periodic API polling.
Updating a deal on payment
Note: when a client pays for an order, we automatically update the deal in amoCRM: set the status to "Successful", price, and order number in a custom field. For this, we call PATCH /api/v4/leads/{id} with new data.
Comparison of approaches: webhooks vs direct API
| Parameter | Direct REST API | Webhooks |
|---|---|---|
| Initiation | Site → amoCRM | amoCRM → Site |
| Speed | Instant (synchronous) | Depends on queue, usually < 1 min |
| Reliability | Error control required | Automatic retries |
| Use cases | Sending new leads | Updating existing statuses |
The optimal scheme is a combination: creating leads via API, syncing statuses via webhooks. This ensures two-way synchronization.
Typical integration mistakes
- Ignoring refresh token: its lifetime is 60 days, needs to be renewed in advance.
- Missing idempotency when processing webhooks: a repeated request can create a duplicate.
- Incorrect custom field mapping: field IDs differ across accounts.
- Timeouts: without Redis connection pooling or queues, the site may freeze under peak load.
What's included in the integration (turnkey)
- Architecture documentation for the integration (OAuth, requests, data schemas)
- Setting up a token store (cache + DB) with automatic refresh
- Implementing an API client with timeouts and error handling
- Creating a webhook controller with order status synchronization
- Migrating custom fields and configs
- Training your team on integration usage (1 hour session)
- Technical support for 30 days after launch
- Deliverables: detailed documentation, all source code, access to integration settings
Timeframes
| Integration type | Timeframe |
|---|---|
| Basic (OAuth, sending leads, token storage) | 1–2 days |
| Full (two-way sync, webhook, custom fields, UTM) | 3–4 days |
| Extended (catalog, tasks, chat) | +2–3 days |
We'll assess your project for free
Contact us for a detailed discussion of your project. We will assess your project and offer the optimal solution. Get a consultation right now. Integration is done turnkey with full training and support.







