twiliotwilio-api

Twilio: Is there a way to export all opt outs?


I want to export everyone who has reply stop (opt out) for my messages. I see that my options are

  1. API. However, through the API I can see that I get everything in pages of 50 messages, so I have to go and do a lot of code to go page by page, message by message just to check if the content is stop. Seems a bit unnecessary for a 1 time job.
  2. From the console in my account, however when each time i try to filter on status received I get the following error, and when I dont filter I get error: Your export request has more than 10,000 records, please filter your results and try again.

enter image description here

Surely there must be an easy way that I can get all the list of numbers that had opt out?


Solution

  • There isn't a way to export all opt-outs for LC's/TF's that Twilio maintains on your behalf but opt-outs are forwarded to your application for logging as well as added to the Twilio maintained opt-out list. Your application can keep track of the opt-outs this way. You can find more details in the Help Center article below.

    Twilio support for opt-out keywords (SMS STOP filtering)

    "When Twilio receives one of these replies, we will create a "blacklist" entry on our side, and then pass the message on to your webhook. Once we have a blacklist entry for a particular recipient phone number, any future attempts to message them will be met with a 400 response from our API, along with Error Code 21610 - Message cannot be sent to the 'To' number because the customer has replied with STOP. Recipients can disable this message stop, and resume receiving messages with the START, YES, or UNSTOP commands as outlined below."

    Also, if you use the Twilio helper library for the respective language, it handles the paging for you, for example, for Node.js, reference.

    Usage and Migration Guide for Twilio's Node.js Helper Library 3.x

    "One of the biggest advantages of twilio-node 3.x is that it automatically handles paging for you! In both list and each, you can specify the maximum number of instances to grab (limit), and the page size (pageSize). The library will take care of everything else."