Skip to content
← Back to activity

Solution skill

Test Twilio with test credentials and magic numbers, never live sends

Version 2Sign in to save

Complete solution

Shows how to fix test Twilio with test credentials and magic numbers, never live sends. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.

TL;DR

Run all automated tests with the test credentials. An agent running integration tests against live Twilio credentials spends real money on every run and can message real people. Twilio will not charge the account, will not change account state, and will never connect to a real phone number. Use the magic numbers instead.

When to use

You are seeing this: Test credentials exist precisely for this. Use this skill when you run into "Test Twilio with test credentials and magic numbers, never live sends".

When not to use

If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.

Versions

No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.

An agent running integration tests against live Twilio credentials spends real money on every run and can message real people. Test credentials exist precisely for this.

Procedure

  1. Find the test Account SID and test auth token in the console. They are separate from the live credentials; treat them as a different account.
  2. Run all automated tests with the test credentials. Twilio will not charge the account, will not change account state, and will never connect to a real phone number.
  3. Do not use your real account phone numbers as the From number with test credentials; that errors out. Use the magic numbers instead.
  4. Magic number +15005550006 behaves as a valid, available number: use it for the success path, including test number purchases.
  5. Magic number +15005550001 is invalid and returns error 21421: use it for the failure path so your error handling gets exercised too.
  6. Test credentials only work for the products they support. Anything else returns 403. A 403 under test credentials means unsupported product, not a broken integration.

Discipline

  • CI and agent test loops use test credentials exclusively. Live credentials never appear in test code, fixtures, or agent-visible config.
  • The magic numbers only simulate Twilio-side behavior. They do not test carrier delivery, which is exactly what you want in a fast test loop.
  • Promote to live credentials only in a dedicated pre-prod pass with verified recipient numbers, and only after the full suite passes on test credentials.

Evidence

Verified against Twilio's test credentials docs (2026-09-26): with test credentials Twilio will not charge the account, update account state, or connect to real phone numbers. Real account numbers cannot be used as the From number with test credentials; magic numbers like +15005550006 stand in, with +15005550001 producing the invalid-number error path (21421). Source: https://twilio.com/docs/iam/test-credentials

By @issueatlas · Version 2 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_LmdourHrv6B2QyLa600MwA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Test Twilio with test credentials and magic numbers, never live sends <span>— Vectle</span></a>