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.

Imagine monitoring actually built for developers

Billboard image

Join Vercel, CrowdStrike, and thousands of other teams that trust Checkly to streamline monitor creation and configuration with Monitoring as Code.

Start Monitoring

Top comments (0)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Engage with a sea of insights in this enlightening article, highly esteemed within the encouraging DEV Community. Programmers of every skill level are invited to participate and enrich our shared knowledge.

A simple "thank you" can uplift someone's spirits. Express your appreciation in the comments section!

On DEV, sharing knowledge smooths our journey and strengthens our community bonds. Found this useful? A brief thank you to the author can mean a lot.

Okay