Overview
Integrations fail in ordinary ways: timeouts, duplicates, out-of-order events. We design for those first.
Every write is idempotent and every external call has a timeout, a retry policy and a dead-letter path.
Trade-offs
- Webhooks vs polling
- Webhooks are timely but can be lost; pair them with periodic reconciliation.
- Schema versioning
- Additive changes only; version the contract when meaning changes.
Architecture
Integration layer
Moves data between systems reliably. Every message is queued, retried on failure and deduplicated so nothing posts twice.
- REST & webhook adapters
- Queue with retries
- Idempotency keys
- Schema mapping
Illustrative diagram. For the end-to-end view, see the architecture on the Developers home.
Workflow
Map
Which system owns which field.
What we design for
- Duplicate records after retries
- Silent field mapping drift
- Rate limits during peak volume
Idempotent write
async function upsertInvoice(evt: InvoiceEvent) {
const key = `inv:${evt.source}:${evt.id}:${evt.version}`;
if (await seen(key)) return "duplicate-ignored";
await db.invoices.upsert(evt);
await markSeen(key);
}