Unlike voice, there's no way to block specific SMS messages or sending parties on Twilio. You can disable SMS completely for one Twilio number or the numbers within a Messaging Service, but you cannot selectively reject certain messages.
Note: Once you configure your Twilio phone number or Messaging Service to drop incoming messages, you will no longer receive any inbound SMS, and inbound messages will not be visible in your Twilio Console or messaging logs. Additionally, the original message sender will not see any sort of "failed" notification on their device.
As for inbound MMS (messages containing media), these will still show in your inbound logs and Console even if received after inbound messaging is disabled. Each will show a "Failed - 30008" error.
You will not be billed for any incoming SMS or MMS while inbound messaging is disabled.
Disable incoming SMS on a specific Twilio number:
If you would like to disable all incoming SMS to a specific Twilio number, you can simply clear out its Messaging configuration on the phone number settings in the Twilio Console. Follow these steps:
- Browse to the phone numbers list in the Twilio Console
- Click the phone number you want to edit
- Scroll to the bottom of the page, under the header "Messaging"
- For the "Configure With" drop-down menu, select "Webhooks, TwiML Bins, Functions, Studio, or Proxy"
- Under "A Message Comes In," select "Webhook"
- Leave the webhook field blank.
- Save your changes
If you do this, any messages sent to that number will not appear on your Twilio account and you will not be billed for them on Twilio.
Disable incoming SMS on a Messaging Service:
To disable incoming SMS on all Twilio phone numbers associated with a Messaging Service, follow these steps:
- Browse to the Messaging Services area in the Twilio Console.
- Click the Messaging Service you want to edit.
- Browse to the "Integration" tab in the left-hand side bar
- Toggle the Messaging Service to "Drop the message" (under the header "Incoming Messages").
After doing this you will not be charged for, nor will you receive, SMS to your Twilio number(s).
Note: If you select the "Defer to Sender's Webhook" setting on a Messaging Service rather than "Drop the Message", that service will instead utilize each individual phone number's "When a Message Comes In" setting (the same field from step 6 in the "Disable incoming SMS on a specific Twilio number:" section above) to determine handling for inbound SMS. This means that you can still receive inbound messages to some Twilio phone numbers within a Messaging Service while also blocking inbound messages to others within the same service.
What if I'm receiving messages that look like spam or abuse?
If your Twilio project is ever subject to abuse, spam, or other forms of persistent unwanted messaging being sent to your Twilio numbers, we will do everything we can to help. If this happens to you, please contact our Support team and provide specific numbers or Message SIDs of unwanted traffic to your Twilio account, and we will do our best to help.