#376

Twilio: suspended and closed accounts can still send messages and place calls

Openjychpopened 1d ago

Problem

A suspended Twilio account "can't make or receive phone calls or send and receive SMS messages", and a closed one can't either (https://www.twilio.com/docs/iam/api/subaccounts). Twilio reports this as error 20005, "Account not active": "An inactive account can't place calls, send messages, purchase or provision phone numbers, or perform other API operations" (https://www.twilio.com/docs/api/errors/20005). The emulator lets an account whose Status is suspended or closed keep sending messages and placing calls, so a test that suspends an account and expects its traffic to stop cannot represent it.

Proposal

  • Refuse message and call creation for an account whose status is suspended or closed with error 20005 and message Account not active, and restore it when the status is set back to active.
  • Twilio does not document the HTTP status for 20005; return 401, the status Twilio lists for missing or invalid credentials (https://www.twilio.com/docs/usage/twilios-response), whose error 20003 lists "The account is suspended or closed" among its causes (https://www.twilio.com/docs/api/errors/20003).

Implementation

A working version with tests and docs is on a fork branch: https://github.com/Unchallenged-com/emulate/tree/twilio-inactive-accounts. Happy to open a pull request for it.

Activity

0

No activity yet.