How Does Message Filtering Work?

This guide discusses SMS filtering that can affect delivery of your Twilio Programmable SMS messages. This is done to enforce Twilio’s Messaging Policy or Acceptable Use Policy, or to comply with regulations and wireless carriers’ messaging policies.

Filtering of your outgoing Twilio Programmable SMS messages can vary somewhat between carriers and countries. We have compiled the following information to help you understand why a message might have been filtered.

Why do message filtering systems exist?

Message filtering systems exist for two reasons:

1. Protecting mobile subscribers from unwanted messaging such as spam, fraud, or abuse

Unwanted messaging is a huge issue in the messaging industry; unwanted messages can result in complaints, fines, or outright disconnection by carriers. Mobile users who receive lots of spam or other unwanted messages may decide to start opting out of or ignoring all messages from businesses, even legitimate ones who follow all rules and best practices.

For these reasons, it is in everyone’s interest – Twilio, wireless carriers, regulators, and most importantly our customers – to ensure that unwanted messaging is not allowed over Twilio’s carrier connections.

2. Enforcing rules or regulations about what types of messaging are allowed to that country or mobile network

Depending on the country, laws or regulations may put restrictions on certain types of messaging, or even forbid certain things altogether. Messages which violate these rules may be subject to filtering.

These rules and regulations may also change over time. In the U.S. and Canada, application-to-person (A2P) type messaging was historically not allowed to be sent using local 10-digit long code phone numbers. As of March 2021, Verizon and AT&T treat long code numbers as a valid A2P channel, however messages to T-Mobile (including Sprint) may still be subject to filtering on the basis of being A2P-type traffic until the full launch of their A2P 10DLC solution (complete details to be announced).

For more information about U.S./Canada message filtering, see SMS Carrier Filtering in the United States and Canada. For information about the upcoming A2P 10DLC changes by U.S. carriers, see What is A2P 10DLC?

How does message filtering work?

Message filtering can range from a simple static list of prohibited terms, to advanced machine learning systems that constantly adapt based on the messages passing through them.

Twilio uses filtering to target messaging that is in violation of our Messaging Policy and Acceptable Use Policy (AUP). Twilio’s goal is to protect mobile users from fraud, spam, and other forms of unwanted messaging, as well as to comply with rules and regulations imposed by carriers and regulators.

In addition, carriers filter messages to enforce their rules, as well as to prevent spam and other forms of abuse.

How do I know if my messages are being filtered?

When we know that filtering has taken place, you will see your messages with the “Undelivered” status and Error 30007.

It is not always possible to know for certain when a message has been filtered by a carrier. In rare cases, carriers may falsely report filtered messages as “delivered” to prevent spammers from reverse engineering filtering systems.

If Twilio knows that a message has been filtered, we will pass this information to you in two ways:

  • By updating the message status to Undelivered, and flagging error code 30007 in your Programmable SMS Logs.
  • Sending a request to your status callback URL, if you provided one when you sent the message.

How do I prevent my messages from being filtered?

In short, follow the guidelines in Twilio’s AUP and Messaging Policy and avoid sending spam or fraudulent traffic. In addition, check Twilio’s SMS Guidelines for the country you are sending messages to. Twilio keeps these pages up to date with best practices for each country.

Below are some guidelines that will greatly reduce the chances that you will have messages filtered.

Consent and Opt-In

  • Ensure that you only send messages to mobile users who have provided consent (opted-in) to receive messages from you. 
  • Ensure that your messages clearly identify who is sending the message, and how to opt-out (for example, “Reply STOP to unsubscribe”). If you are contacting the same recipients multiple times per month, you do not need to provide opt-out instructions in every message, but you must do it at least once per month.
  • If you are sending messages to users repeatedly over a long period of time, you should check in with your recipients at least once every 18 months to ensure they still want to receive messages from you. The mobile number you are sending messages to may have changed owners, or the recipient may not remember giving consent to receive messages from you.
  • For certain use cases including job alerts, sweepstakes, and lead generation services, Twilio requires you receive double opt-in consent from recipients. 

Use Case and Sender Selection

  • Check Twilio’s SMS Guidelines for the country you are sending messages to. Twilio keeps these pages up to date with best practices for each country.
  • If you are sending application-to-person (A2P) traffic, the carriers in the country you are sending to may require that this traffic be sent from a short code (What is a short code?) or from a pre-registered Alphanumeric Sender ID, if available. These are both ways that carriers can review your messaging use case in advance, and offer better delivery as a result. In addition, some countries (such as France) have prohibitions against local numbers from that country being used for A2P traffic. In such cases, Alpha Sender ID (if available) or a number from a different country is a good solution for 1-way A2P messaging. If in doubt, check the SMS Guidelines page for the country in question.

Message Contents

  • Do not send links that have been shortened using free public URL shorteners, such as or links. US carrier policies forbid the use of free public URL shorteners, due to the frequency of use by spammers.
  • If you want to include shortened URLs in your messages, we recommend using a dedicated short domain that belongs to your business, or a URL shortener service which offers a unique non-shared domain for your URLs (this is a paid feature on some URL shortener services).

Avoid account takeover

if your Twilio Account SID and Auth Token accidentally fall into the wrong hands (for example, posted in public code on a site like Github), your account could be used to send bad messaging traffic. We strongly recommend you keep your Twilio account credentials safe to prevent account takeovers.

Why am I charged for filtered messages?

Messages are still billed when they are filtered, whether they are filtered by Twilio's internal spam filtering system or by a downstream carrier.

By proactively detecting and preventing messages that violate our policies and those of carriers, Twilio is able to ensure trusted communications and prevent disruptions to service as a result of carrier concerns. This ultimately allows us to offer better quality to our customers. Twilio also gains more insight into filtering causes, and can empower you with better information to improve your messaging and eliminate filtering.

However, running an effective filtering system also creates operational costs. For example, our Compliance team works with customers to address and eliminate causes of unwanted messaging.

In the case of messages filtered by carriers, Twilio has also incurred the cost of sending the message to the carrier prior to the message being filtered.

I think my messages are being filtered by mistake. What can I do?

Twilio works hard to ensure that customers do not see filtering on legitimate messaging that follows all applicable rules. However, no automatic system is perfect. If you have reviewed the above information thoroughly, and you believe your messages are compliant with Twilio and carrier policies, please collect 3 or more examples of Message SIDs that have the “undelivered” status with error 30007, and then contact our Support team. We can help review your messaging and determine if an error was made, and put you in touch with our Compliance team if needed.

United States and Canada SMS filtering

The landscape of wireless carrier filtering in the U.S. and Canada is changing rapidly. In order to better answer customers' questions, we have created a separate guide. For full details, please see SMS Carrier Filtering in the United States and Canada.



This overview should help to give you a better understanding of how wireless carrier filtering works for Twilio Programmable SMS messages. For more information, please see the following resources:

Have more questions? Submit a request
Powered by Zendesk