Integration of Mango Office with your website: API, webhook, click-to-call
Every day a manager spends up to 10 minutes searching for information about an incoming call: who is the client, where from, which order. If the call drops, this data is lost. Integrating Mango Office with your site turns calls into structured requests that automatically enter the CRM. Our experience — over 10 successful projects, we ensure stable operation of webhooks and API. Result: reaction time reduced by 30%, lost leads drop to zero. Savings on operational costs up to 30% through automation.
The problem is not only data loss but also duplication: if the phone number is not normalized, the same client may be entered multiple times. We solve this with a unified normalization function that brings all numbers to the +7XXX format. And click-to-call allows initiating a call from CRM with one click, without dialing. Let's start with the main point: without number normalization, integration loses its meaning.
Why number normalization is important
Mango Office transmits numbers in different formats: 8XXX, +7XXX, 7XXX without plus. If not normalized, calls from the same client create duplicates. Our normalizePhone function (PHP) cleans the number from extra characters, adds the country code, and converts to a unified format. Example:
function normalizePhone(string $phone): string {
$phone = preg_replace('/[^0-9]/', '', $phone);
if (strlen($phone) === 10) $phone = '7' . $phone;
if (str_starts_with($phone, '8')) $phone = '7' . substr($phone, 1);
return '+' . $phone;
}
Validation on 80% of calls shows that normalization reduces duplication by 50%.
Setting up a webhook for event reception
Create a route that accepts POST requests from Mango Office. The request body is JSON with event and call data. Process the events call_arrived, call_started, call_finished. Example in PHP:
Route::post('/webhooks/mango', function (Request $request) {
$json = json_decode($request->json, true);
$event = $json['event'];
$call = $json['call_id'];
$caller = $json['from']['number'];
if ($event === 'call_arrived') {
$customer = Customer::where('phone', normalizePhone($caller))->first();
broadcast(new MangoCallArrived($call, $caller, $customer));
}
if ($event === 'call_finished') {
CallRecord::create([
'mango_call_id' => $call,
'duration' => $json['duration'],
'recording' => $json['recording_url'] ?? null,
'caller' => $caller
]);
}
});
After setting up the webhook, call data is saved in your database, and managers receive notifications via WebSocket.
Click-to-Call via API
Initiate a call from CRM with one click. Use the Mango Office API to create a callback. Example request:
$response = Http::withHeaders(['X-Mango-VPbxApiKey' => env('MANGO_API_KEY')])
->post('https://app.mango-office.ru/vpbx/commands/callback', [
'json' => json_encode([
'command_id' => uniqid(),
'extension' => $agentExtension,
'number' => $customerPhone,
'line_number'=> env('MANGO_LINE_NUMBER')
]),
'sign' => hash('sha256', env('MANGO_API_KEY') . json_encode([...]) . env('MANGO_SALT'))
]);
This allows the manager to call a client directly from the interface, without manual dialing.
Getting call recordings via API
For analytics and quality control, use the API to retrieve recordings. Send a POST request with a date range, get a list of recordings with audio URLs. Example:
$recordings = Http::withHeaders(['X-Mango-VPbxApiKey' => env('MANGO_API_KEY')])
->post('https://app.mango-office.ru/vpbx/stats/calls/recording/post_read', [
'json' => json_encode([
'start' => strtotime('today midnight'),
'end' => time(),
'fields' => ['start_time', 'duration', 'direction', 'from_number', 'to_number', 'recording']
])
])->json();
Each recording is linked to a deal in CRM. Average recording size is 10 MB, over a week up to 500 MB.
Comparison of integration options
| Feature |
Mango Office Widget |
Custom integration via API |
| Click-to-call |
Yes |
Yes + CRM linking |
| Call data |
Only statistics |
Full history with recording, tags, deals |
| Time to launch |
1 day |
2–4 days |
| Control over routing |
Limited |
Flexible: by page, product, time |
| Call processing speed |
1.5x slower |
1x (baseline) |
| Cost |
Fixed subscription |
Individual, per your volume |
Custom integration processes calls 1.5 times faster than the standard widget.
What's included in the integration?
- Webhook setup for call events
- Click-to-call implementation via Mango Office API
- Phone normalization function (PHP, JS, or other stack)
- Integration with your CRM (Bitrix24, amoCRM, and others)
- Loading and linking of call recordings
- Operational documentation
- Stable operation guarantee — 1 month free support
Integration stages turnkey
| Step |
What we do |
Duration |
| Analysis |
Study CRM, DB schema, processes |
1 day |
| Webhook setup |
Create endpoint for events |
1 day |
| Click-to-call integration |
Call button in cards |
1 day |
| Recording linking |
Save audio to deals |
1 day |
| Testing |
Simulate scenarios |
1 day |
| Deployment |
Handover documentation, training |
1 day |
Total: basic integration takes 2–5 days depending on complexity.
Checklist for successful integration
- Ensure the API key and salt are configured correctly. Wrong signature causes 90% of issues.
- Use a unique call_id for each call to avoid duplication.
- Normalize numbers considering international format, especially if clients are from different countries.
- Account for API limits: no more than 100 requests per minute.
Following these points avoids typical startup errors.
Conclusion
Integrating Mango Office with a website is not just a technical task — it's an opportunity to automate call processing and increase conversion. Our approach is custom configuration for your CRM and business processes. The cost of integration is calculated individually. Get an engineer consultation — contact us to evaluate your project.
Email Campaign Integration: Why Does It Often Break?
We’ve observed that a trigger email sent 10 minutes after registration converts 4–5 times better than the same email sent after 24 hours. This isn’t a marketing myth—it’s mechanics: while the user is still warm, while they remember the context. But most integrations with email services are built like this: form submits → synchronous HTTP request to API → if the API is slow, the user waits 3 seconds → the email either goes out or doesn’t, nobody knows. In one project, we saw a 30% drop in conversion simply because the email service responded with 504 and Laravel’s queue driver wasn’t configured. Lost emails often hit customers silently – no log, no alert, just a missing order confirmation.
If you’re facing lost emails or spam folder issues, order an audit of your current integration – we’ll find bottlenecks within 2 days.
Providers and Their APIs
Unisender — a Russian provider popular in the SMB segment. REST API, simple. Adding a contact: importContacts, sending a transactional email: sendEmail. Important: for transactional emails (order confirmations, password resets), Unisender Go is a separate service with a different API and separate pricing. Mixing bulk and transactional mailings in one stream is bad for domain reputation. Unisender Go handles up to 1000 requests per second.
SendPulse — provides email, SMS, web push, Viber, and Telegram bots through a unified API. Convenient for projects requiring an omnichannel approach. Automation 360 is a visual chain builder; you can trigger automation via API events. The PHP SDK (sendpulse/rest-api-php-sdk) is maintained but updated irregularly – better to use Guzzle directly.
Mailchimp — a choice for international audiences and marketing teams accustomed to the Mailchimp ecosystem. Transactional email via Mandrill (a subsidiary service). Marketing API v3 for list, tag, and campaign management. Webhooks for opens, clicks, unsubscribes, bounces.
SMS. For Russia: SMSCenter, MTS Exolve, Devino Telecom, SMS Aero. Their APIs are similar: a send method with phone, message, sender parameters (sender name must be registered separately with the operator). One nuance: the sender name must be registered through the aggregator with a contract – otherwise SMS won’t be sent on MTS/MegaFon/Beeline networks.
| Provider |
Type |
Transactional Emails |
Marketing |
Notes |
| Unisender |
email+SMS |
Unisender Go (separate) |
Yes |
Popular in Russia, simple REST |
| SendPulse |
email+SMS+web push+Viber |
Yes |
Yes |
Unified API, omnichannel |
| Mailchimp |
email |
Mandrill |
Yes |
Analytics, international |
| Twilio |
SMS+email |
Yes |
No |
Global, expensive in Russia |
How to Build an Integration That Doesn’t Lose Emails?
Separate Transactional and Marketing Streams
Transactional emails (order confirmations, password resets, delivery status) go through a dedicated sender domain or subdomain tx.example.com. Marketing campaigns go through mail.example.com or news.example.com. If a marketing campaign receives many spam complaints, it should not affect the reputation of the transactional stream. According to SendGrid documentation, transactional messages should be sent through a dedicated IP pool to prevent cross-contamination.
Queue and Retry
Any call to the email API goes through a queue (Laravel Queue, Bull, Celery). If Unisender returns a 503, the job retries after 5 minutes, then 15, then 60. After 5 failed attempts, it goes to a dead letter queue with an alert. The user already received their 200 OK and knows nothing about the issue. This approach reduces bounce rate on projects to 0.5%.
Example Laravel job:
public function handle(): void
{
try {
$response = Http::post(config('services.unisender.email_url'), $this->params);
if ($response->failed()) {
$this->release(300); // retry after 5 min
}
} catch (\Throwable $e) {
$this->release(300);
}
}
Templates
We store templates in code (Blade, Twig, React Email), not in the provider’s interface. Reasons: versioning via Git, browser preview without sending, testability. For complex templates with dynamic content — react-email with export to HTML via @react-email/render.
Validation and Consent
Before adding a contact to a list — double opt-in (confirmation email). Store the confirmation timestamp in your own database. Upon unsubscription — synchronously unsubscribe both at the provider and in your database. Ignoring webhook unsubscriptions is a direct path to account suspension at the provider. All processes comply with Федеральный закон № 152-ФЗ «О персональных данных».
Deliverability Monitoring and DKIM Setup
Connect provider webhooks for events: bounce (hard and soft), spam_complaint, unsubscribe. Hard bounce — immediately mark the email as invalid in your database, stop sending. Soft bounce 3 times in a row — same. Metrics: open rate, click rate, bounce rate, unsubscribe rate — review at least once a week. Our certified engineers configure alerts in Grafana/Prometheus.
DKIM configuration steps:
- Generate a key pair (e.g.,
openssl genrsa -out private.key 2048).
- Publish the public key in DNS as a TXT record for the selector (e.g.,
mail._domainkey.tx.example.com).
- Provide the selector to the provider (SendGrid, Mailgun, Unisender).
- Verify with
dig TXT mail._domainkey.tx.example.com.
SPF, DKIM, DMARC must be configured separately for each stream. We use subdomains with different DNS records.
Why Is It Important to Separate Streams?
If you send a marketing campaign from the same domain as transactional emails and receive spam complaints, you risk getting the domain blocked — and users will stop receiving even order confirmations. SPF, DKIM, DMARC (Sender Policy Framework, DomainKeys Identified Mail, Domain‑based Message Authentication, Reporting and Conformance) must be configured separately for each stream. In one project, a marketing blast with 12% spam complaints blocked the transactional domain for 48 hours — we had to re‑authenticate with Google and Yandex.
What Does the Integration Scope Include?
- Audit of current communication streams and domain reputation (SPF, DKIM, DMARC)
- Provider and schema selection: transactional vs marketing traffic
- Configuration of SPF, DKIM, DMARC DNS records
- Development of email templates (HTML + dynamic content)
- Backend integration via queues and API
- Webhook setup for deliverability and complaints
- Operations documentation and team training
- Deliverability guarantee and post‑launch support
We deliver production‑ready documentation, access to monitoring dashboards, and a handover session with your engineers. Our certified engineers provide a 30‑day post‑launch health check guarantee.
Timelines and Cost
| Scenario |
Timeline (business days) |
Notes |
| Basic transactional emails (one provider) |
5–7 days |
Price is calculated individually after audit |
| Trigger sequences + SMS + web push |
10–20 days |
Price is calculated individually after audit |
| Full omnichannel automation |
20–40 days |
Price is calculated individually after audit |
Cost is calculated individually after audit. We provide turnkey service: from analysis to production monitoring. Contact us for a free engineer consultation — we’ll evaluate your project and give accurate timelines. Over 7 years of experience in email service integration, 50+ projects implemented. Order a free audit of your current integration and receive a report with recommendations and estimated savings.