How to disable automated SMS responses in Twilio? - twilio

In March I opened a website that provides people with temporary numbers to be used to receive SMS verifications etc.
I've just logged in to the account and realised that I've received a ton of charges for outbound SMS.
They appear to be a default automated response whenever any of my numbers receives a SMS.
I didn't enable this (seems as though it's some sort of money making thing on their side). How do I disable it?

Go to your project, open https://www.twilio.com/console/phone-numbers/incoming and select the number. In Messaging in A MESSAGE COMES IN select TwiML and click Plus button. Give it some name and paste
<?xml version='1.0' ?>
<Response></Response>
there. Save

Twilio evangelist here.
When you buy a Twilio phone number it comes configured with a default Message Request URL that uses the TwiML <Sms> verb to send a reply back to any incoming text message.
<Response>
<Sms>Thanks for the message. Configure your number's SMS URL to change this message.Reply HELP for help.Reply STOP to unsubscribe.Msg&Data rates may apply.</Sms>
</Response>
If you want to prevent those replies you can change this default behavior by providing your own Message Request URL or by using our integrated TwiMLBin feature and returning an empty TwiML response to Twilio:
<Response />
Here is an article from our FAQ that has more info:
https://www.twilio.com/help/faq/sms/how-can-i-receive-sms-messages-without-responding
Hope that helps.

(2021 Update)
Few things were updated in Twilio / mainly their Admin Dashboard GUI but I'll try to simplify it for anyone reading this still. Trust me when I say I completely understand the frustration of the lack of simplicity when it comes to how they operate. The phrase "Work Smarter, Not Harder" doesn't exist in that company (lol):
Log into your Admin Dashboard Account: https://www.twilio.com/login
Go to your Active Phone Numbers: https://console.twilio.com/?frameUrl=/console/phone-numbers/
If that URL changes, add Active Phone Numbers to your Develop dashboard first VIA
🔴 Develop Tab -> Explore Products -> CTRL + F "Phone
Numbers" -> Click the Pin Button
Then access your Active Phone Numbers VIA
🔴 Develop Tab -> Phone Numbers -> Manage -> Active Numbers -> Click Active (###) ###-####
🔴 Scroll down to Messaging -> Select Webhooks, TwiML Bins, Functions, Studio, or Proxy is selected for Configure With Other Handlers -> Select Function for When a Message Comes In -> Select Default for Service -> then leave the Function Path empty.

Related

Twilio: Webhook not calling specified URL on phone number

Setting up to respond to SMS replies. I've gone to my Active Numbers page, selected the number (I only have one), gone to the Messaging Service section (again only one service) and in "A message comes in", I've specified the URL of one of our HTTP Handlers. It's a .Net Core handler that we use all the time. It will try to process anything sent to its URL:
https://ourserver/lmw/core/filemanager?SC=SMS
I send an SMS message to my personal number, reply "Help", and send that. Nothing hits that URL. I have it in the debugger and it catches anything I send it. It just doesn't get hit by the reply to the SMS message.
What am I doing wrong?.. or did I misunderstand how this works?
EDIT:
I found an "Integration" section in the Messaging Service. It was set to "Defer to sender’s webhook"... which sounds right but I changed it to "Send a webhook -- Invoke an HTTP webhook for all incoming messages"... which sounds like the same thing. Anyway, it didn't change a thing. I'm still not receiving a post on the http handler.
Please note that "Help" is a special keyword when using messaging services.
According to the Twilio Help Center:
Twilio does not forward HELP/INFO messages to your incoming message webhook by default. However, if you use Advanced Opt-Out for Messaging Services, Twilio does forward HELP/INFO requests to your inbound webhook.
This is not a good answer but I wanted to close this out. I started over and released my phone number and bought a new one. I went to Active Numbers and selected the new phone. In "A message comes in", I put my webhook url in both primary and primary fails and saved that.
I then went to Messaging, Services, and selected my service. In Integration, I clicked "Defer to sender's webhook" and then put the handler url in "Callback URL" and saved that.
I went to compliance and the first two were done but 3. Campaign Use Case was incomplete. I completed that.
In Opt-out management, I edited that and put in some of my own text.
After doing all this, I replied to the message and got a response in the handler. Not sure which one of these was the problem but doing it all over seemed to work. Sorry I can't provide a better insight.

Twilio SMS Webhooks and Group Text Messages

Is it possible to maintain both group text messages and single text messages with users and keep them separate? I understand there is no concept of a group message per se, but wanted to see if any recent advances in tech has made this possible with Twilio or other providers.
In short, I am creating a POC where a user inside an iOS App can send invoke an API call to my backend application. This application receives a phone number from someone's contact list, and then connects to Twilio to send the SMS message to that target user.
When the user replies, I was researching Twilio Web hooks to receive the message, and then save it in the database. The originating user, then, would be able to see the message on a screen.
I would guess that when a user responds to the twilio message, the only metadata that comes in is their message and phone number, so the "foreign key" is the phone number.. Thus when I save it in my database, I have their phone number and message.
This works up until someone decides to target two or more people in an SMS message using my API, and then target one of those people individually. For example they select me as a sole recipient, and then select me and someone else as a group text message.
In this case, how could my system/Twilio differentiate between if I was responding to the group message, or to the single message?
Any ideas or work arounds? Maybe another technology? Thanks!
I wanted to provide an answer to this in case anyone else was looking into this.
Essentially you pay 3 cents (0.03) per month per active user in each group. Basically you buy phone numbers for each group chat you need.
https://www.twilio.com/conversations/pricing
So if you're doing a million group chats obviously it can get costly, but for simple POCs this isn't the end of the world.
Enjoy!

How do I redirect replies to my regular phone number?

So I use Twilio to send out SMS messages when someone registers a certain form. It sends the first message out but I want to know if it's possible to redirect the message to my actual phone number. For example, the Twilio number sends out the mass text and I want to be able to get any replies to that Twilio number redirected to my real phone number. Is that possible?
I have tried to look at other people's things and have yet to find anyone who has asked my question and I have no idea where to go from here.
Twilio developer evangelist here.
You can do that with Twilio Studio! More details here, but in short:
Access the Studio Dashboard in your Studio Console.
Make a new Studio flow by clicking the + sign.
Pick a name for your flow and click "next".
"
Click "Start from scratch" followed by Next".
From the "Widget Library" on the right, drag and drop a "Send Message" widget into the flow.
Click and drag the "Trigger" widget’s "Incoming Message" lead to connect it to the "Send Message" widget.
Click the "Send Message" widget to show the widget's options on the right. Type in the MESSAGE BODY field:
Under the SEND MESSAGE widget options, scroll down to click to expand MESSAGING & CHAT CONFIG. Type in the desired destination (number to forward to with E.164 formatting) in the SEND MESSAGE TO field, and then click Save.
Select "Publish".
To activate the Studio flow:
Visit the Active Numbers page in your Console.
Select the phone number you want to edit.
Scroll to the Voice & Fax section to modify the phone number’s routing like so:
Select "Save".
Let me know if this helps! <3 :D

Twilio SMS - what am I doing wrong?

So, I have WHMCS setup to use Twilio with a new module, however, I have managed to get as far as setting it up and having SMS messages go out to customers in Australia as I have an AUS number connected to my Twilio account.
The issue is that when say for an example a US customer signs up the SMS fails and says "cannot send sms", the logs aren't helpful for this Twilio newb.
Here is the example:
The process of sending SMS to the user phone number (+1310xxxxxxx) from the summary page has failed - Twilio (company name)
If I was to send a message to say Spain it seems to work, which is odd enough.
I also tried on a +34 and it sent. Also seems to work on the UK +44.
I have GEO options setup to work as they should within Twilio, though, the error message does not appear on my Twilio logs, simply internal.
Here is the module log.
I have only edited the text out to give you what is showing.
Request:
Array
(
[To] => +1310xxxxxxx
[Body] => test
[From] => Company name
)
Response
The 'To' phone number: +1310xxxxxxx, is not currently reachable using the 'From' phone number: Company name via SMS.
So presently SMS messages to the USA do not work, I cannot speak for every other country out there though, what can I do here or how would I set my Twilio account correctly to ensure my SMS messages are being delivered?
Many thanks.
Twilio developer evangelist here.
From what you're saying I think you're sending messages using an alphanumeric sender ID rather than a phone number?
If that's the case then you are getting rejected from the US because the US telephone system doesn't accept alphanumeric sender IDs (neither do some other countries, just not the ones you've tested). You can see the countries that do and don't support alphanumeric sender IDs in this table in our documentation.
To fix this you'll need a number to send the messages from in the US, I'd recommend getting a new US number for this.
Then you can either catch the error and retry using the number in place of the sender ID.
Or, for a more resilient method, take a look into Twilio Messaging Services that can do automatic failover to a number when sending with alphanumeric senders.
Let me know if this helps at all.

Twilio Messaging - Correlating SID

We use twilio for sending message.
We are not sure how to correlate the response with the message we send. We might send multiple messages to the same Mobile. But, not sure how to correlate response with the messages we sent as the SID's are different.
Is there anyway to relate the response with the message.
Thanks
No, SMS doesn't work like that.
I you send me 5 text messages from your cellphone and then I reply to one you have no way of telling which one I'm replying to.
It's not a Twilio limitation, the SMS standard has no provision to track replies to individual messages
As an afterthought I came up with a hacky solution to this. It's a bit involved so I guess it depends how much you want the functionality.
This works for me using Chrome beta on Android 7.0, YMMV.
Create a php script with the following code and put it on your webserver:
<?php
// increase last digit as necessary to suit string length of your variable
$smsid = substr($_SERVER["QUERY_STRING"],0,1);
// Query database for SMS id, record timestamp of request, optionally return text to be included at the beginning of the SMS reply
$msg= urlencode($databaseResult);
// Remove <?body=$msg> if you just want the link to create a blank reply. Change the phone number to your incoming Twilio number.
header( "Location: sms:+1555444333?body=$msg" )
Now sign up for a URL shortening service which passes URL parameters and create a shortened URL which points to your php script. I used tr.im.
Depending upon your volume of SMS you will have to adjust the length of your variable, but unless you spam people to death I'm going to assume a single character will be enough to identify a unique text.
Using the example tr.im/SMS as your shortened url, you append a variable to the end like so tr.im/SMS?A and put the link in your outgoing SMS. When the user clicks the link your server redirect will open the SMS app on their phone and create a text to your number. If you have included the "?body=$msg" in your php above the new message will have your text at the start.
Personally I probably wouldn't bother adding text, they might delete it before they send it anyway and it's just likely to confuse people. If you log the request variables and timestamps to your database you should be able to tie them together with the phone number as most people will send you their reply within a couple of minutes of the server request. You can also increase the length of your custom URL variable if you struggle to correlate messages. Recycle variables once you have linked a reply etc...
Finally change your Twilio configuration so your outgoing SMS present the company name instead of your Twilio number as the sender. Users cannot directly reply to messages if the sender isn't a number, so they will have to use your link.
Generate a sequential identifier for each message and append it to your link. Save the identifier to your database along with the corresponding message Sid from Twilio and the number you sent it to so you can match them up later.
Append "Click tr.im/SMS?$ to reply" to outgoing SMS, where $ is your variable.
Profit.

Resources