SMS.ru Service Integration with Bitrix24
A typical situation: a company sends transactional SMS through SMS.ru — order confirmations, authorization codes, delivery notifications. CRM works in Bitrix24. Managers switch between two systems, marketing broadcasts live separately from the sales funnel, and no one tracks delivery statuses. Integration brings everything into one window: SMS are sent directly from CRM, statuses are returned, analytics are collected in one place.
Provider Registration via messageservice.sender.add
Bitrix24 works with SMS providers through the messageservice module. For SMS.ru to appear in the list of available services, it must be registered via REST API:
messageservice.sender.add({
CODE: "smsru",
TYPE: "SMS",
HANDLER: "https://your-domain.com/handler/smsru.php"
})
HANDLER — URL of a script that receives requests from Bitrix24 and forwards them to the SMS.ru API. Bitrix24 sends a POST request with fields: recipient number (message_to), message text (message_body), message identifier (message_id).
Handler on your side:
- Receives data from Bitrix24.
- Forms a request to SMS.ru API:
https://sms.ru/sms/send?api_id=YOUR_KEY&to=NUMBER&msg=TEXT&json=1. - Receives a response from SMS.ru with
sms_idand status. - Saves mapping
message_id(Bitrix24) →sms_id(SMS.ru) for subsequent delivery tracking. - Returns confirmation to Bitrix24.
After registration, the provider is available in CRM robots, in manual SMS sending from a card, and in CRM marketing.
Webhook for Delivery Statuses
SMS.ru supports callback notifications when a message status changes. In the SMS.ru personal account, a handler URL is set that will receive POST requests when the status changes:
- 100 — message in queue
- 101 — transferred to operator
- 102 — delivered
- 103 — not delivered (expired)
- 104 — not delivered (error)
The handler receives sms_id and status, finds the associated message_id from Bitrix24, and calls the status update method in Bitrix24. Without this mechanism, all messages in CRM will show "Sent" status even if the subscriber is actually unavailable.
In practice, callback from SMS.ru arrives with a delay of several seconds to a minute. For critical scenarios (payment confirmation), additionally configure polling via the sms.ru/sms/status method with a check by sms_id every 30 seconds.
Transactional and Marketing SMS
The separation is important both technically and legally.
Transactional SMS — notifications tied to a customer action: order confirmation, delivery status change, appointment reminder. Sent automatically via CRM robots:
- Deal moves to "Confirmed" stage → "Send SMS" robot → text with order number and amount
- Record in "Appointment" smart process moved to "One day before" stage → SMS reminder
For transactional SMS in SMS.ru, the standard sending route is used. The sender name (alphanumeric sender ID) is registered in the SMS.ru personal account and confirmed by documents.
Marketing SMS — broadcasts to the base: promotions, special offers, reactivation. Sent via Bitrix24 CRM marketing: contact segment → create SMS broadcast → select SMS.ru provider → send.
Key differences:
| Parameter | Transactional | Marketing |
|---|---|---|
| Initiator | Customer action (order, appointment) | Company (broadcast to base) |
| Consent | Implied with order placement | Mandatory opt-in |
| Cost | Standard SMS.ru tariff | SMS.ru tariff (same, but higher volume) |
| Setup in Bitrix24 | CRM robots / business processes | CRM marketing section |
| Limitation | No quantity limit | SMS.ru may limit frequency |
Automation via CRM Robots
Robots are the primary tool for automatic sending. Configure typical scenarios:
Sales funnel:
- New lead → SMS "Thank you for contacting us, a manager will reach out within 15 minutes"
- Deal at "Awaiting Payment" stage → SMS with payment link (substitute
#DEAL_UF_PAYMENT_LINK#) - Deal closed successfully → SMS with thanks and request to leave a review
Automation outside the funnel:
- Missed call (trigger) → SMS "We noticed your call, we will call back"
- Contact's birthday (scheduled business process) → congratulatory SMS
The robot text has access to CRM fields: #CONTACT_NAME#, #DEAL_TITLE#, #DEAL_OPPORTUNITY#, custom fields via #DEAL_UF_XXX#.
Cost Optimization
SMS.ru charges by the number of segments (1 SMS = 70 characters in Cyrillic or 160 in Latin). Ways to reduce costs:
- Short templates. Every extra character after 70 is a second segment. Template "Your order #{ORDER} for {SUM} rub. confirmed. Delivery {DATE}." — 80 characters, two segments. Remove "rub.", abbreviate — 68 characters, one segment. 50% savings per message.
-
Duplicate filtering. A robot can trigger twice on stage rollback. Add a condition to the robot: send only if custom field
UF_CRM_SMS_SENTis empty, after sending record the date. -
Number verification. SMS.ru returns an error when sending to an invalid number but still charges for the attempt. Before a mass broadcast, run the base through
sms.ru/sms/cost— the method returns the cost without sending, allowing you to identify invalid numbers.
Implementation Timeline
| Scale | Includes | Timeline |
|---|---|---|
| Basic | SMS.ru connection, one robot, manual sending from card | 3–5 days |
| Standard | 3–5 robots by stages, callback statuses, templates with substitution | 1 week |
| Extended | Mass broadcasts via CRM marketing, status polling, duplicate filtering, analytics | 1.5–2 weeks |
What We Configure
- SMS.ru registration as provider via
messageservice.sender.add - Handler for Bitrix24 requests → SMS.ru API
- Callback handler for delivery statuses
- Alphanumeric sender ID (sender name)
- CRM robots for transactional SMS by sales funnel stages
- Mass broadcasts via CRM marketing
- SMS templates with CRM field substitution
- Verification and normalization of phone numbers in the base
- Testing: sending from a card, robot execution, callback receipt, mass broadcast to test segment







