DEV Community

Daniel
Daniel

Posted on

How to Handle Twilio Verify 30005 and 30006 errors

We've implemented Twilio Verify's SMS service, and it works 99% of the time. However, we ran into an issue recently where an SMS was unable to be delivered and produced error codes 30005 and 30006.

The problem is that those error codes are not returned in the response when the verification instance is first created. All I get is a 201 and the status is pending.

I tried setting up a webhook using https://www.twilio.com/docs/verify/verify-events but the payload I received was different from what's in the console log. The webhook says the delivery status is "SENT" but the console log shows "Underliverable" with the 30005 error. There's no error code key in the webhook event payload.

So, my question is, how am I supposed to build error handling around these error codes when there's seemingly no way programmatically to know they resulted in an error? I've tried using every available ID key to search the messages API, but they always return no results.

I can't seem to find documentation on this either.

Meanwhile, my user is left waiting for a code that will never arrive because his mobile carrier, unbeknownst to him, has blocked the message. AND my app doesn't even know an error occurred.

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more