Broadcast Scheduler Engine Architecture
The Broadcast Scheduler Engine processes large-scale WhatsApp marketing campaigns with strict Meta Graph API rate-limiting compliance.
Broadcast Processing Flow
Rendering diagram...
Token Bucket Rate Limiting Algorithm
To respect Meta WhatsApp Tier limits and prevent account blocks, MetaPilot implements a Redis-backed Token Bucket Algorithm:
- Capacity: 50 tokens (messages) per second per tenant.
- Refill Rate: 50 tokens per second.
- Enforcement:
python
if token_bucket.consume(tenant_id, count=1): send_whatsapp_message(recipient) else: task.retry(countdown=1)
Error Handling & Exponential Retries
- Transient Failures (HTTP 429, 503): Retried automatically up to 3 times with exponential backoff (seconds).
SCHEDULER_RETRY_DELAYS = [60, 300, 900] - Permanent Failures (Invalid phone number, unsubscribed): Marked as immediately without retrying.
FAILED