Imagine your backend sending 10,000 SMS synchronously via HTTP. Each request takes 100–500 ms, the server hangs for minutes, Twilio's limit of 1 SMS/sec on a regular number is exceeded in seconds, and half the messages return a 429 error. Budget wasted, users unhappy. We have seen these scenarios dozens of times.
Recently, a project with 500,000 users in Russia and CIS came to us. The client used Twilio, paying $0.08 per message instead of $0.02 from a local provider. After migrating to SMSC and setting up a queue with a 30 msg/s limit, we reduced costs by 60% and eliminated message loss. On another project, we decreased the per-message cost from $0.07 to $0.02, saving the client over $2,000 per month.
The solution is an async queue with throttling and a well-chosen gateway. Below, we break down the architecture that handles load without burning your budget.
Over 7 years, we have integrated SMS messaging into 30+ mobile apps—from startups to enterprise projects with millions of users. Our experience shows that 80% of delivery issues stem from improper rate limiting configuration and choosing a gateway not suited for the target geography.
Which gateway to choose?
Compare popular options:
| Gateway | Features |
|---|---|
| Twilio | REST API, webhook statuses, global coverage. Expensive for CIS—2-3 times the cost of local operators. |
| SMSC.ru | Cheap for RF/CIS, no webhook statuses on low-cost plans—requires server polling. |
| Infobip | Supports SMS, Viber, WhatsApp. Onboarding is complex—requires document verification. |
| Vonage (Nexmo) | SDKs for mobile, but CIS coverage is limited. |
Typical gateway rate limits:
| Gateway | Limit per number (SMS/sec) | Limit per account (SMS/sec) |
|---|---|---|
| Twilio (standard number) | 1 | 10 |
| Twilio (short code) | 100 | 1000 |
| SMSC.ru | 30 | 300 |
| Infobip | 50 | 500 |
If your audience is in Russia and CIS—choose SMSC or similar. For international projects—Twilio or Infobip. We help you select the optimal option for your budget and requirements.
Пример настройки воркера с Bull
const Queue = require('bull'); const smsQueue = new Queue('sms', 'redis://localhost:6379'); smsQueue.process(5, async (job) => { const { to, body } = job.data; await twilio.messages.create({ to, from, body }); await delay(1000 / 5); // 5 msg/sec }); Here, 5 workers (concurrency) with a 200ms delay between messages—resulting in 5 SMS/sec. For higher throughput, increase concurrency while staying within the gateway's limit.
How to avoid rate limiting?
Rate limiting is the main challenge in bulk messaging. Exceeding limits leads to blocking and message loss. The proper architecture: a task queue (e.g., RabbitMQ or Redis + BullMQ) and workers with throttling. Each worker picks up a task, sends the SMS, waits an interval, then proceeds. To speed up, multiple workers run in parallel, controlling overall throughput.
Why not send SMS synchronously?
Attempting to send 10,000 SMS in a single loop of HTTP requests leads to:
- Backend being blocked for the duration of all requests (each takes 100-500 ms).
- Exceeding the gateway's limit—some requests return a 429 error.
- No retry logic for network failures.
A queue solves all three: requests are non-blocking, limits are respected, and failed tasks are automatically retried. Rate limiting is a mechanism to account for at the design stage.
What's included in the integration work?
- Requirements analysis: audit of the current app, gateway selection, budget estimation.
- Server side: queue design (RabbitMQ / Redis), worker implementation with throttling, webhook configuration for statuses.
- Mobile client: message composition form (with character counter), recipient segment selection, progress tracking via WebSocket/SSE.
- Testing: load testing up to 50,000 messages, rate limiting verification.
- Documentation: API description, schemas, operation manual.
- Support: 3-month warranty, consultations.
The result—a reliable messaging system ready for scaling.
How to track delivery statuses?
Twilio sends a webhook to your endpoint on every status change: queued → sending → sent → delivered or undelivered/failed. The backend aggregates these statuses, and the mobile client requests a summary via a REST endpoint:
GET /admin/sms/jobs/{jobId}/stats → { "total": 5000, "sent": 4823, "delivered": 4601, "failed": 177 } If the gateway doesn't support webhooks (like SMSC on low-cost plans), the backend polls for statuses on a schedule.
Common mistakes when integrating SMS messaging
- Ignoring rate limiting—leads to blocking and message loss.
- Choosing a gateway solely on price—a cheap gateway may lack webhook statuses, complicating tracking.
- Synchronous sending—backend hangs and limits are exceeded.
- No retry logic—messages are lost on transient failures.
Timeline and cost
Gateway integration (Twilio or SMSC), queue implementation, mobile UI with character counter, segment selection, and progress tracking—from 5 to 8 business days. Cost is calculated individually based on complexity and chosen gateway. Get a consultation from our engineer—they will select the gateway for your budget and load. Contact us for an assessment of your project—we will offer the best turnkey solution.







