Lost leads due to manual transfer from site to CRM is a systemic issue for growing businesses. An online store with 500 daily orders after implementing integration reduced processing time from 2 hours to 30 seconds. Managers spend up to 30% of work time copying data, and transfer errors reach 10%. Megaplan is a popular Russian CRM for small and medium businesses, but without automation efficiency drops. We solve this directly via REST API and webhooks, accelerating lead processing 50 times and eliminating human error. Our company has over 10 years of web development experience and has completed over 50 successful CRM integrations, ensuring robust solutions.
What data is transferred from the site to Megaplan
From the form, name, phone, email, and comment are typically passed. These fields map to standard deal and contact attributes. Custom fields can also be transferred—for example, UTM tags, traffic source, selected product. For online stores, it's useful to pass order composition, amount, and payment status. Everything goes into corresponding Megaplan fields; for non-standard data, extraFields are used. Up to 50 custom fields per deal are supported.
Setting up Megaplan API
Megaplan provides REST API v3. Authorization is via Bearer token, obtained by exchanging login/password or using an API key in account settings. Example of getting a token:
$response = Http::post("https://{$this->domain}.megaplan.ru/api/v3/auth/access_token", [ 'username' => env('MEGAPLAN_LOGIN'), 'password' => env('MEGAPLAN_PASSWORD'), 'grant_type' => 'password' ]); $token = $response['access_token']; $refreshToken = $response['refresh_token']; // Store token in Redis, refresh via refresh_token The token lives about an hour, so store it in Redis and refresh on schedule. Each request with an expired token returns 401 Unauthorized. For safe storage, use environment variables, not hardcoded login/password.
Creating a deal from a lead
When a visitor submits a form, we create a deal in the required pipeline. Example in Laravel:
$response = Http::withToken($this->getToken()) ->post("https://{$this->domain}.megaplan.ru/api/v3/deal/create", [ 'data' => [ 'contentType' => 'Deal', 'name' => "Site request: {$request->subject}", 'programId' => ['contentType' => 'DealProgram', 'id' => $this->pipelineId], 'responsible' => ['contentType' => 'Employee', 'id' => $this->defaultManagerId], 'contractor' => ['contentType' => 'Client', 'id' => $contactId], 'extraFields' => [ 'Cf12345' => $request->message, ] ] ]); Before creating a deal, ensure the client already exists. Search by email or phone to avoid duplicates.
Searching or creating a contact
// Search existing contact $search = Http::withToken($this->getToken()) ->post("https://{$this->domain}.megaplan.ru/api/v3/contractor/list", [ 'data' => [ 'contentType' => 'ContractorFilter', 'email' => $request->email ] ]); if ($search['data']['meta']['totalCount'] > 0) { $contactId = $search['data']['list'][0]['id']; } else { // Create new $contact = Http::withToken($this->getToken()) ->post("https://{$this->domain}.megaplan.ru/api/v3/client/create", [...]); $contactId = $contact['data']['id']; } This approach guarantees each client is unique and deals attach to their card.
Webhooks from Megaplan
Megaplan can send HTTP notifications when deal statuses change. This allows updating the order status on the site: when a manager moves a deal to "Successfully completed", the site can show a thank you. Webhooks are configured in the Megaplan interface—specify your endpoint URL. It's recommended to log incoming webhook requests for debugging.
Integration with Megaplan accelerates lead processing 50x
| Criterion | Manual entry | Via API |
|---|---|---|
| Time per lead | 2-5 minutes | 0.2-0.5 seconds |
| Transfer errors | 5-10% | 0% |
| Delay | Hours/days | Instant |
Our API-based integration is 50x faster than manual entry and eliminates errors entirely, compared to typical 10% error rate. For example, with 1000 leads per month, savings on manager salaries can reach 1.5 million rubles per year. Integration cost typically ranges from 50,000 to 150,000 rubles depending on complexity. Our integration starting at 50,000 rubles pays for itself within the first month. On average, our clients save 300,000 rubles per month after integration. Contact us now — our engineers will configure everything in 3-4 days.
Typical integration errors
| Error | Cause | Solution |
|---|---|---|
| 401 Unauthorized | Token expired | Refresh token via refresh_token |
| 409 Conflict | Duplicate contact | Check contact existence before creating |
| 429 Too Many Requests | API limit exceeded | Implement request queue and caching (exponential backoff) |
For duplicate contacts, always check client existence before creating. Use an index by email in your database. To speed up search, cache contact IDs in Redis by email. If API responds slowly (200–500 ms), queue all requests (via Laravel Queue or RabbitMQ). For frequent data (directories, pipelines), set up caching. Log every request and response in a crm_logs table — saves during debugging: method, URL, request body, response code, response body, execution time.
What's included
- Analysis of current forms and business logic.
- API connection setup and token acquisition.
- Development of lead transfer module with field mapping.
- Webhook notification setup for feedback.
- Testing all scenarios (success, error, duplicates).
- Integration documentation.
- 30-day post-launch support.
Process
- Analytics — we examine your pipeline, lead sources, required fields.
- Design — agree on data schema, REST endpoints, error handling.
- Implementation — write code, configure queues, caching.
- Testing — verify all scenarios, including edge cases (empty fields, special characters).
- Deployment — deploy to production, set up monitoring.
Timelines and cost
Basic integration (leads + contacts + deals) takes 3 to 4 working days. Complex projects with webhooks, custom fields, and reverse sync — up to 2 weeks. Cost is calculated individually after analyzing your tasks. For Megaplan site integration, lead transfer to Megaplan is handled via API, ensuring seamless data flow. Our team has 10+ years of experience and has completed 50+ CRM integrations, with a 5-year track record in the market. Submit a request — we'll offer the optimal solution.
Our experience: over 10 years of web development, over 50 successful CRM integrations. We guarantee stable integration and prompt incident resolution. Get an engineer consultation — we'll tell you how to automate your CRM.







