airq-dev / hazebot

Building the 411 for air quality in the United States: a texting platform accessible to all, that provides actionable local information to protect your and your community.
https://www.hazebot.org/
MIT License
9 stars 1 forks source link

Handle Twilio error responses appropriately #128

Closed ianhoffman closed 4 years ago

ianhoffman commented 4 years ago

Noticed this in the logs:

2020-09-16 20:10:33[2020-09-17 03:10:33,083] INFO in http_client: POST Response: 400 {"code": 21610, "message": "The message From/To pair violates a blacklist rule.", "more_info": "https://www.twilio.com/docs/errors/21610", "status": 400}779396a2-5448-49c2-b661-b59b6dac1f75
[2020-09-17 03:10:33,083] INFO in http_client: POST Response: 400 {"code": 21610, "message": "The message From/To pair violates a blacklist rule.", "more_info": "https://www.twilio.com/docs/errors/21610", "status": 400}

We should handle the 21610 error code by unsubscribing the client.