Automation
Multi-Tenant Email Automation
Bulk email automation system built on Microsoft Graph, supporting multiple tenants with reliable, batched, error-tolerant delivery.
01
Overview
Sending email at scale across multiple tenants means every tenant has its own authentication context, its own rate limits, and its own failure modes — the system has to isolate them from each other while still processing efficiently.
02
Challenge
Multi-tenant Graph API auth adds a layer of complexity beyond single-account email automation: each tenant needs isolated credentials and token handling, and a failure or rate limit on one tenant can't be allowed to stall or corrupt processing for the others.
03
Architecture
Each tenant authenticates independently against Microsoft Graph. Outgoing messages are grouped into batches rather than sent one-by-one, with retry logic around transient failures and rate limits, and delivery outcomes logged per message rather than assumed.
- Trigger / Schedule
- Tenant Auth (Microsoft Graph)
- Batching Layer
- Send + Retry
- Delivery Log
04
Implementation
- Per-tenant authentication against Microsoft Graph, keeping credentials and token refresh isolated per tenant.
- Messages grouped into batches to reduce request overhead and respect Graph API rate limits.
- Retry logic around transient failures, distinguishing recoverable errors (rate limits, timeouts) from permanent ones (invalid recipient).
- Per-message delivery logging so failures are visible and traceable rather than silent.
05
Technologies
06
Engineering Decisions
Why batch sends instead of one request per email?
Graph API rate limits make per-message requests inefficient at volume. Batching reduces request count and makes throughput predictable.
Why isolate auth per tenant?
A shared credential model would mean one tenant's token issue or rate limit affects every other tenant. Isolation keeps failures contained.
07
Reliability
- Retry logic separates transient failures (retryable) from permanent ones (logged and skipped).
- Per-tenant isolation means one tenant's failure doesn't block others.
- Delivery logging gives visibility into what sent, what failed, and why.
08
Outcome
A multi-tenant automation system that reliably batches and delivers email across isolated tenant contexts without cross-tenant failure propagation.