Automate Lead Transfer from Website to CRM
Leads from the website arrive via email — the manager spends up to 30 minutes daily manually entering them into the CRM. Contact errors, lost prospects, delayed responses. We eliminate this pain: the submission form sends data directly via API, the prospect instantly appears in the funnel, and the manager gets a Telegram notification. No boilerplate emails, no duplication. UTM tags are preserved, spam bots are blocked. With over 5 years of experience and 50+ successful CRM integrations, we guarantee reliable lead transfer.
Choosing the protocol — REST API with OAuth2 (amoCRM, Salesforce) or webhooks (Bitrix24, HubSpot) — impacts speed and reliability. REST API is up to 2x faster than webhooks and allows retry on error. All tokens are cached in Redis and refreshed automatically. The integration runs for years without glitches, saving the manager up to 10 hours per week. Cost savings: at 100 leads per month, you save up to $500 on manual entry. Development starts from $300, paying back in a month or two. At 500 prospects per month, annual savings exceed $30,000. For example, with 200 leads/month, manual data entry costs $2,400 per year; automation with a $300 setup saves $2,100 in the first year alone.
What technical challenges are solved?
- OAuth2 tokens in amoCRM live 24 hours — without auto-refresh, the form stops working. We implement a token manager: the refresh token extends the session, access_token is cached for 23 hours.
- Bitrix24 requires setting up webhooks and its own authorization. Signature verification ensures requests come only from your form.
- UTM tags are lost if not saved on first visit. We write them to cookies for 30 days and pass them along with the form.
- Duplicate contacts are blocked by checking existing records in CRM by email or phone.
- Spam bots are filtered out using a honeypot field and invisible captcha.
How do we integrate the form with CRM: Step by step
- Analyze your requirements: define field mapping, select integration protocol, and design error handling.
- Develop the form: add validation, styling if needed, and connect to the integration service.
- Set up token management: for OAuth2, implement auto-refresh and cache tokens in Redis.
- Configure UTM tracking: capture parameters on first visit via cookies and transmit them as custom fields.
- Test all scenarios: success, timeout, duplicate submission, and spam.
- Deploy and monitor: enable alerts in Telegram or Slack for failures.
Consider integration with amoCRM on Laravel 11 (PHP 8.3). The service creates a lead, a contact, and fills custom fields (source, comment).
class AmoCrmService
{
private string $subdomain;
private string $accessToken;
public function createLead(array $formData): int
{
$resp = Http::withToken($this->accessToken)
->post("https://{$this->subdomain}.amocrm.ru/api/v4/leads", [
[
'name' => "Заявка с сайта: {$formData['name']}",
'status_id' => config('amocrm.initial_status_id'),
'pipeline_id' => config('amocrm.pipeline_id'),
'_embedded' => [
'contacts' => [[
'name' => $formData['name'],
'custom_fields_values' => [
['field_code' => 'EMAIL', 'values' => [['value' => $formData['email']]]],
['field_code' => 'PHONE', 'values' => [['value' => $formData['phone'], 'enum_code' => 'WORK']]],
],
]],
],
'custom_fields_values' => [
['field_id' => config('amocrm.source_field_id'), 'values' => [['value' => 'Сайт']]],
['field_id' => config('amocrm.comment_field_id'), 'values' => [['value' => $formData['message']]]],
],
]
]);
return $resp->json('_embedded.leads.0.id');
}
}
The token is refreshed via AmoCrmTokenManager, which caches the access_token in Redis for 23 hours, using the refresh token flow.
class AmoCrmTokenManager
{
public function getValidToken(): string
{
$stored = Cache::get('amocrm_access_token');
if ($stored) return $stored;
// Refresh via refresh_token
$resp = Http::post("https://{$this->subdomain}.amocrm.ru/oauth2/access_token", [
'client_id' => config('amocrm.client_id'),
'client_secret' => config('amocrm.client_secret'),
'grant_type' => 'refresh_token',
'refresh_token' => decrypt(Setting::get('amocrm_refresh_token')),
'redirect_uri' => config('amocrm.redirect_uri'),
]);
$tokens = $resp->json();
Cache::put('amocrm_access_token', $tokens['access_token'], 82800); // 23 hours
Setting::set('amocrm_refresh_token', encrypt($tokens['refresh_token']));
return $tokens['access_token'];
}
}
UTM tag automation: How it works
Without UTM, you won't know which channel brought the prospect. We capture parameters on first visit in cookies (30-day expiry) and pass them with the form.
// Save UTM on first visit
const utmParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content'];
const params = new URLSearchParams(window.location.search);
utmParams.forEach(param => {
if (params.has(param)) {
document.cookie = `${param}=${params.get(param)};path=/;max-age=2592000`;
}
});
// Append UTM on form submission
function getUtmData() {
return Object.fromEntries(
utmParams.map(p => [p, getCookie(p) || '']).filter(([, v]) => v)
);
}
For direct visits, we substitute 'direct' to maintain analytics integrity.
Protocol comparison: REST API vs Webhook
| Criteria | REST API | Webhook |
|---|---|---|
| Response time | 0.5–2 sec | 1–3 sec |
| Token required | Yes (OAuth2) | No (but signature verification needed) |
| Error handling | Retry possible (idempotent) | Error on CRM side — notification loss |
| Suitable for | amoCRM, Salesforce, Pipedrive | Bitrix24, HubSpot, WordPress |
REST API is up to 2x faster and supports idempotent retries. Our UTM cookie system achieves 100% parameter accuracy, compared to common 20% loss in standard setups.
Preventing lead loss during CRM failure
When the customer relationship management system is down, we retry sending up to 3 times with a 10-second interval. If all attempts fail, the prospect is saved in a local log, and the administrator gets an alert in Telegram. This ensures no data is lost. For critical scenarios, we use a Redis queue — data persists until CRM recovers.
Integration deliverables
- Logic design: field mapping, protocol selection, error handling.
- Form development: validation, styling (optional), CRM integration.
- Token automation: OAuth2 refresh, Redis caching.
- UTM tags: cookie storage, transmission as custom fields.
- Documentation: API endpoint descriptions, sample requests, manager instructions.
- Launch support: monitoring setup, Telegram/Slack alerts.
Integration stages
| Stage | Description | Duration (work days) |
|---|---|---|
| 1. Analysis | Field mapping agreement, protocol selection, logic design | 1 |
| 2. Implementation | Form development, integration service coding, error handling | 2–4 |
| 3. Testing | Check all scenarios (success, timeout, duplicate, spam) | 1 |
| 4. Documentation | Integration point description, sample requests, instructions | 0.5 |
| 5. Deployment | Token caching setup, monitoring, notifications | 0.5 |
Optionally, we connect Telegram/Slack notifications for success or failure.
Timeline and cost
Integration with one CRM (without custom form design) takes 3–5 business days. If a unique form is needed (styling, complex validation, additional fields), the timeline extends to 7–10 days.
Cost is calculated individually after reviewing your stack and scope. Contact us — we'll evaluate the project within one day. Our team's expertise spans 5+ years and over 50 projects in custom form-to-CRM automation. We guarantee stable form operation: if errors occur, we fix them within a day. Order the integration and forget manual lead entry.
Preventing lead loss during CRM failure
When the CRM is unavailable, we retry sending up to 3 times with a 10-second gap. If all retries fail, the lead is saved locally and an alert is sent to the admin. This ensures no data is lost.Approach based on official amoCRM REST API documentation.







