Design a Third-Party SaaS Integration Platform
Design a multi-tenant connector platform and review a vendor-backed internal API for reliable, consistent behavior across services such as Gmail and Slack.
Problem statement
For this exercise, assume you are designing a multi-tenant platform that integrates a host product with third-party SaaS vendors such as Gmail and Slack.
A tenant administrator authorizes an external account, chooses supported data to import, and the platform emits vendor-neutral integration events to internal consumers. The host product can also request a bounded outbound action, such as sending an email or posting a message.
Vendors differ in authorization, webhook support, polling APIs, ordering, idempotency, and rate limits.
The first version supports installing, configuring, monitoring, and revoking a connector; ingesting changes through signed webhooks when available and cursor-based polling otherwise; normalizing accepted changes; and reporting asynchronous outbound-action status.
Keep tenants isolated and never return or log vendor credentials. Durably accept a valid callback before acknowledging it, deduplicate overlapping webhook and polling deliveries, and use a caller-supplied idempotency key so retries create one logical outbound action.
If a vendor timeout leaves an external side effect uncertain, report an unknown state and reconcile instead of falsely claiming success.
Do not design vendor-specific user interfaces, a searchable copy of all email or chat history, or a general workflow builder. Treat vendors as external dependencies. The platform owns connection configuration, synchronization cursors, canonical integration events, outbound actions, and delivery attempts.
For the API-review portion of this exercise, assume several stateless host-product instances expose an internal read endpoint backed by a vendor API.
The supplied wrapper uses a process-local cache keyed only by resourceId, keeps entries for 24 hours, calls the vendor directly on a miss, and returns the vendor response without a version or freshness marker.
Review this code path, identify correctness and performance problems, propose a bounded optimization, and explain why two internal callers can observe different results.
What to build
- A tenant administrator can authorize, configure, inspect, and revoke a supported vendor connection without exposing vendor credentials.
- The platform ingests vendor changes through verified webhooks or cursor-based polling and emits a vendor-neutral event for each logical change.
- An internal caller can request an idempotent outbound vendor action and later inspect its pending, succeeded, failed, or unknown outcome.
- Operators can observe connection health, pause or resume work, and replay quarantined work without bypassing tenant isolation or deduplication.
- Internal callers can read a tenant-scoped vendor-backed resource through an API with a documented freshness contract and consistent cache identity across serving instances.
At scale
- For this exercise, assume 100,000 active tenant-vendor connections across the supported connector catalog.
- For this exercise, assume peaks of 50,000 inbound vendor changes per second and 5,000 outbound action requests per second.
- For this exercise, durably acknowledge a valid webhook within 500 ms at p95, make a normalized event available within 5 seconds at p95 when the vendor is healthy, and accept an outbound action request within 1 second while completing it asynchronously.
- For this exercise, target 99.9% monthly availability for connection and action-admission APIs, and retain accepted work through a vendor outage lasting up to 24 hours so the backlog can drain without exceeding vendor quotas.
- For the API-review portion, assume multiple stateless API instances currently use independent process-local 24-hour caches while vendor resources may change at any time.