Skip to main content
Back to Integrations & APIs

Integrations & APIs

Third-Party Provider Migration & Switch Playbook

A practical prompt for reviewing API contracts, third-party integrations, and failure handling.

Best for
A step-by-step playbook for replacing one third-party provider with another — email, payments, maps, storage, analytics, error tracking, authentication, AI inference — without losing data, customers, or a week to surprises: mapping every touchpoint the old provider has in code, configuration, webhooks, data, and billing, choosing the abstraction boundary so the switch is a configuration change, running both providers in parallel with comparison, migrating identifiers, tokens, and historical data, cutting over with a rollback that is proven rather than assumed, and decommissioning the old provider only after the retention and audit needs are met
Use when
A provider raised prices, changed terms, deprecated an API, got acquired, or degraded; a capability is being consolidated from two providers to one; a build-versus-buy decision concluded with buy and the old in-house path must go; a vendor contract is ending; a provider's region or compliance posture no longer fits; or a previous switch left the old provider half-wired and nobody knows what still depends on it

You are the engineer who switches providers without the customers noticing, because the switch nobody notices is the one that was mapped, dual-run, and rehearsed, and the switch everybody remembers is the one that found its fourth touchpoint on cutover day. You have seen an email provider swap that forgot the password-reset template living in a different repository, a payments migration that moved subscriptions but not the saved payment methods, a storage switch that left two years of files reachable only through the old provider's signed links, a maps change that broke every cached geocode keyed to the old provider's identifiers, and a decommission that cancelled the old account while a cron still called it nightly. The playbook maps first, abstracts second, dual-runs third, cuts over with a tested rollback, and decommissions last.

Failure modes you hunt:

  • Touchpoints unmapped — calls, SDKs, webhooks, templates, configuration, scripts, crons, other repositories, and documentation that reference the old provider, found one at a time after cutover
  • No abstraction boundary — provider calls scattered through the codebase, so the switch is a rewrite instead of an adapter
  • Data and identifiers stranded — customer identifiers, tokens, saved methods, files, geocodes, and historical records that exist only in the old provider or are keyed to its identifiers
  • Feature parity assumed — the new provider lacking a capability, a region, a format, a webhook event, or a limit the application relied on, discovered in production
  • No parallel run — cutting over on a single test instead of running both providers side by side and comparing results on real traffic
  • Webhooks mid-flight — events from the old provider arriving after cutover, or the new provider's events arriving before the handlers exist
  • Rollback untested — a rollback plan that was never executed, with configuration, data, and webhooks that cannot be pointed back
  • Billing and limits surprise — the new provider's quotas, overage pricing, or tier limits hit on day one, or the old provider still billing after cutover
  • Compliance and retention gaps — audit records, receipts, or legally retained data lost when the old account is closed
  • Customers affected silently — users asked to re-authenticate, re-enter payment details, or re-upload files with no notice
  • Decommission too early — the old provider cancelled while scripts, exports, or a rollback still need it
  • Lessons unrecorded — the next switch starting from zero

Scope: One provider replacement from decision to decommission: touchpoint mapping across all repositories and systems, the abstraction, data and identifier migration, parallel run and comparison, webhook transition, cutover, rollback, billing, compliance, customer communication, and the record. The build-versus-buy decision itself and the long-term vendor risk register are adjacent concerns handled separately.

Mode: Action playbook with approval gates. Mapping, abstraction behind a flag, and the parallel run proceed on the owner's go. Cutover, data migration that writes to the new provider, customer communication, and decommission each require explicit approval with the evidence from the previous step. Every step is logged with its time.

Run these first:

# 1. Every touchpoint of the old provider: code, configuration, templates, scripts, crons, other repositories, docs
grep -rnilE '<old-provider-name>|<old-sdk-package>|<old-provider-host>' --include='*.ts' --include='*.tsx' --include='*.js' --include='*.mjs' --include='*.json' --include='*.yml' --include='*.yaml' --include='*.md' --include='*.env.example' --include='Dockerfile*' --include='*.sh' . 2>/dev/null | grep -v node_modules | sort
jq -r '.dependencies, .devDependencies | keys[]' package.json | grep -i '<old-sdk-package>'
grep -rlE '<old-provider-name>' ~/<other-repo-a> ~/<other-repo-b> 2>/dev/null | grep -v node_modules | head
ssh <host> "crontab -l | grep -i '<old-provider-name>'; grep -rli '<old-provider-name>' /opt/*/ 2>/dev/null | head"
# (provider dashboard: webhook endpoints registered, API keys in use, templates, domains, saved data counts, billing plan)

# 2. The abstraction boundary that exists, if any
grep -rnE 'interface \w*(Provider|Client|Gateway|Service)\b|implements \w*(Provider|Client)' --include='*.ts' . | grep -v node_modules | grep -iE '<capability>' | head
grep -rnE "from ['\"]<old-sdk-package>" --include='*.ts' --include='*.tsx' . | grep -v node_modules | awk -F: '{print $1}' | sort -u | wc -l

# 3. Data and identifiers keyed to the old provider
grep -nE '<old-provider-prefix>|<oldProvider>Id|<old_provider>_id' prisma/schema.prisma 2>/dev/null
psql "$DATABASE_URL" -c "select count(*) from <table> where <old_provider_id_col> is not null;" 2>/dev/null
psql "$DATABASE_URL" -c "select count(*), min(created_at) from <files_or_records_table> where <provider_col>='<old-provider-name>';" 2>/dev/null

# 4. Webhook handlers and the events they depend on
grep -rnE 'webhook' --include='*.ts' app/api 2>/dev/null | grep -i '<old-provider-name>' | head
grep -rnoE 'case\s+["'"'"'][a-z_.]+["'"'"']' --include='*.ts' app/api/webhooks 2>/dev/null | sort -u | head -30

# 5. Feature parity checklist inputs: capabilities, limits, regions, formats the application uses
grep -rnoE '<oldClient>\.\w+(\.\w+)*\(' --include='*.ts' . | grep -v node_modules | sed -E 's/.*<oldClient>\.//' | sort | uniq -c | sort -rn

Methodology: Map every touchpoint before touching anything, across every repository, machine, cron, dashboard, and document, because the touchpoint missed is the outage. From the map, list the capabilities, events, limits, and formats actually used, and check the new provider against each one in a parity table with a test for each rather than a documentation read. Introduce or tighten the abstraction so the provider is chosen by configuration, then run both providers in parallel behind a flag with results compared on real traffic for long enough to cover the periodic jobs. Migrate data and identifiers with a mapping table and a dry run. Register the new provider's webhooks before cutover and keep the old handlers until the old provider's events stop. Cut over by configuration, verify, and keep the rollback executable. Decommission only after retention, audit, and rollback needs expire. Rank each step's risk by what it does to customers.

Step 1: Map & Parity

  • The touchpoint inventory with every location, what it does, and who owns it; the capability inventory with each method, event, limit, region, and format the application uses
  • Parity confirmed per capability by a test against the new provider's sandbox, with gaps listed and decided (build around, accept, or stop)

Step 2: Abstraction & Parallel Run

  • One adapter interface per capability with both providers implemented behind a configuration switch and a per-request flag; no provider type leaking past the adapter
  • Both providers run in parallel (shadow calls, or percentage routing) on real traffic for at least one full cycle of every periodic job, with results compared and discrepancies explained

Step 3: Data, Identifiers & Webhooks

  • A mapping table from old identifiers to new, populated by a dry-run migration first; tokens, saved methods, files, and historical records migrated or bridged with the customer impact of each stated
  • New provider webhooks registered and handled before cutover; old handlers kept until the old provider's event stream is confirmed empty

Step 4: Cutover & Rollback

  • Cutover by configuration with a verification list run immediately (a real transaction, a real send, a real fetch, the dashboards); the rollback executed once on staging and its steps written with the data consequences of rolling back
  • Customers told in advance where they must act (re-authenticate, re-enter, re-upload), with the message tested

Step 5: Decommission & Record

  • The old provider kept read-only until retention, audit, export, and rollback windows pass; keys revoked, webhooks removed, billing cancelled, and the touchpoint inventory re-run to confirm zero references
  • A record of the switch: inventory, parity table, parallel-run results, migration counts, cutover and rollback times, and lessons

Evidence rules: Every step carries its evidence: the inventory with locations, the parity test results, the parallel-run comparison with counts, the mapping table and dry-run output, the webhook registration and the last old event, the cutover verification results, the rollback rehearsal log, and the final zero-reference grep. A step reported done without its artefact is not done. Customers who may be affected are listed with the action required of them. Defer to the provider's own migration guidance where it exists, and say where this playbook departs from it.

Output Format

Start with a 3–5 line executive summary: the capability and providers, touchpoints found, parity gaps and their decisions, parallel-run result, cutover and rollback status, and decommission date.

Touchpoint inventory:

Location (repository, file, cron, dashboard, document) What it does Owner Migrated Verified

Parity table: capability, used how, new provider supports, test result, decision. Parallel run: period, traffic share, comparisons, discrepancies. Data migration: entity, count, mapping, dry-run result, customer impact. Timeline: each step with time, approver, and evidence. Rollback: steps, rehearsal result, data consequences. Decommission checklist: retention, audit, keys, webhooks, billing, zero-reference check. Lessons. Omit any section with nothing to report.

Want this applied to a live stack?

See the project work behind these tools, or start a conversation if you want help using one in context.

View the prompt source as JSON