Search code examples
twilio

How to see all numbers that have sent opt-out keyword text messages to a Twilio phone number?


How to see all numbers that have sent opt-out keyword text messages (eg. https://support.twilio.com/hc/en-us/articles/223134027-Twilio-support-for-opt-out-keywords-SMS-STOP-filtering-#h_01FBWGDY78H0PYY28VC341JPKE) to a Twilio phone number? Anyway to view these numbers via API request?

When I go to Phone Numbers > Active Numbers > (my phone number of interest) > Messages Log > View all my messaging logs, I can only search by date, to/from, and message SID. Any way to search by message content?

I would like to be able to answer the questions "Who has unsubscribed from messages from this number?", "Who has STARTed receiving messages?", etc. Is there anywhere I can see this info?


Solution

  • Twilio developer evangelist here.

    That information is not available through the API. My recommendation is that you hook up your webhook and inspect messages that are sent to your Twilio number for the opt out/in keywords that we support (these messages are still sent through to your application). You can then keep a record of which numbers have opted out or back in again. If you have been sending messages, but not keeping this record, then you can tell if a number has opted out by catching error 21610 when you try to send a message to a number.