High-Throughput Messaging

Milan Motavar
By Milan MotavarSeptember 20257 min read

WhatsApp APIs are designed for real-time, one-to-one communication. Running large-scale campaigns on top of it introduces a new set of challenges: queues of thousands of messages, unpredictable spikes in traffic, strict delivery receipts, and webhook storms.

Our architecture is tuned to handle thousands of messages per second with low latency and high reliability. We do this by using AWS product such as: SQS, Lambda's, DynamoDB, and API Gateway.

Queue Management

The backbone of our high-throughput system is Amazon SQS.

  • Decoupling: Incoming message requests are pushed into queues. This prevents sudden traffic spikes from overwhelming downstream systems.
  • Concurrency control: Lambda workers pull messages at a controlled rate, ensuring WhatsApp API rate limits are respected.
  • Retry handling: Failed messages are automatically retried with exponential backoff. Dead-letter queues capture problematic payloads for manual review.

Queues give us elasticity. Even when a campaign spikes to millions of messages, the system absorbs the load without dropping requests.

Serverless Architecture

Our core message processing runs on AWS Lambda and API Gateway.

  • Scale on demand: Lambda automatically scales up workers when campaigns surge.
  • No idle cost: We only pay for execution time, which makes bursty workloads economical.
  • Isolation: Each worker is stateless, which isolates failures and prevents one bad batch from blocking others.

We deliberately avoided managing EC2 clusters or Kubernetes for messaging. Serverless reduces latency, minimizes ops overhead, and shifts infrastructure patching to AWS.

NoSQL for Speed

For storing high-velocity message logs, we use Amazon DynamoDB.

  • Single-digit millisecond reads/writes allow us to process delivery receipts and status updates in real time.
  • Partition keys are carefully chosen (AccountId + MessageId) to distribute load evenly.
  • TTL (time-to-live) automatically expires old logs to keep tables lean without manual cleanup jobs.

Traditional relational databases struggle with this scale of write-heavy traffic. DynamoDB is purpose-built for throughput.

Webhook Management

WhatsApp returns three critical status callbacks: sent, delivered, and read.

Handling webhooks at scale requires careful design:

  • API Gateway + Lambda receive webhook bursts and push them into SQS.
  • DynamoDB updates mark message states atomically.
  • Idempotency keys ensure duplicate callbacks don't corrupt status.
  • Retries are handled automatically if a webhook fails processing.

This guarantees every message has a consistent lifecycle view, even under webhook storms.

Monitoring and Observability

High throughput means failures will happen. What matters is how fast we detect and respond.

We rely on:

  • AWS CloudWatch for metrics and alarms.
  • Custom dashboards tracking messages per second, error rates, and queue depth.
  • Synthetic tests that continuously send and verify WhatsApp messages through our own platform.

This allows us to detect anomalies (e.g., rising latency, stalled webhooks) within seconds, not hours.

Keeping Latency Low

Throughput is only valuable if latency stays low. We optimize by:

  • Batching intelligently: Grouping small sends together while keeping under WhatsApp's rate limits.
  • Parallel execution: Splitting campaigns across multiple queues and Lambda workers.
  • Cold start reduction: Using provisioned concurrency for Lambdas that must respond instantly.

As a result, even during large campaigns, most messages are processed and acknowledged in under 200 ms.

Our Opinionated Approach

We believe high-throughput messaging cannot be solved with monolithic apps or under-provisioned servers. Competitors often struggle because they:

  • Overload relational databases with billions of inserts.
  • Treat webhooks as an afterthought.
  • Lack real-time observability into queues and failures.

We chose a serverless + queue-first architecture from day one. It is opinionated, but it works.

Closing Thoughts

Large WhatsApp campaigns are messy by nature with thousands of concurrent sends, delivery receipts, and webhook callbacks.

By combining SQS for decoupling, Lambda for scaling, DynamoDB for speed, and CloudWatch for monitoring, we keep latency low and throughput high.

This allows our customers to confidently run campaigns with millions of messages, knowing the system will keep up without breaking.

High-Throughput Messaging - SendZen Blog | SendZen