SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Is there a way to block incoming SMS on my Twilio phone number?

Question 

Is there a way to block incoming SMS on my Twilio phone number?

Product

Programmable Messaging

Answer

There's no way to block specific SMS messages or sending parties on Twilio but you can choose to trigger a webhook or not when messages come in. You can disable webhooks completely for one Twilio number or the numbers within a Messaging Service, but you cannot selectively choose not to trigger a webhook on certain messages.

Disable webhooks for incoming messages on a specific Twilio number

If you would like to disable all webhooks for incoming messages to a specific Twilio number, you can clear out its Messaging configuration on the phone number settings in the Twilio Console. Follow these steps:

  1. Browse to the phone numbers list in the Twilio Console
  2. Click the phone number you want to edit
  3. Scroll to the bottom of the page, under the header "Messaging"
  4. For the "Configure With" drop-down menu, select "Webhooks, TwiML Bins, Functions, Studio, or Proxy"
  5. Under "A Message Comes In," select "Webhook"
  6. Leave the webhook field blank.
  7. Save your changes

If you do this, any messages sent to that number will appear in your messaging logs in a received status and you will still be billed for them but they will not trigger a webhook. If you have Event Streams set up for "incoming messages", these will still be triggered.

Disable incoming SMS on a Messaging Service

To disable webhooks for incoming messages on all Twilio phone numbers associated with a Messaging Service, follow these steps:

  1. Browse to the Messaging Services area in the Twilio Console.
  2. Click the Messaging Service you want to edit.
  3. Browse to the "Integration" tab in the left-hand side bar
  4. Toggle the Messaging Service to "Receive the message" (under the header "Incoming Messages").

If you do this, any messages sent to numbers in the Messaging Service will appear in your messaging logs in a received status and you will still be billed for them, but they will not trigger any webhook. If you have Event Streams set up for “incoming messages”, these will still be triggered.

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 webhooks for incoming messages on a specific Twilio number" section above) to determine handling for inbound messages. This means that you can still receive inbound message webhooks to some Twilio phone numbers within a Messaging Service while also preventing inbound message webhooks to others within the same service.

 

Additional Information

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, first try to send a message with the keyword “STOP” and if that does not help, 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. Please note that we cannot guarantee that we can block incoming messages.

Have more questions? Submit a request
Powered by Zendesk