Any way to determine which text message is being responded to? - sms

I use Twilio with my team management system. A text message is automatically sent out for each game. The receiver can then reply with YES or NO. My issue is that when I send two text messages, I have no way to tell if the reply is for the first message I sent, or the second.
Does Twilio have any way to determine which text message it was a response to?

Twilio developer evangelist here.
If you are sending two messages from one Twilio number to the same user number there is nothing within the SMS specification that allows a user to reply to a specific message, so there is nothing you can do with Twilio to detect that.
If you are sending two messages to two different numbers and you get replies from those numbers, you can match against the from number and see what the last message sent from that number was and attach the reply to that.
Alternatively, if you want to get replies from one user to different messages, you could send them from different Twilio numbers. That way you can match the outgoing number to the message and the answer. This is mostly used for phone number masking to enable anonymous communications and there is a good tutorial available on this in the Twilio documentation.
Let me know if that helps at all.

Related

How to implement SMS tracking in Twilio where multiple SMS been sent to the same number

We are implementing an SMS tracking feature for our app using Twilio where we will send an SMS to our customer and once they reply with Yes/No
we will take action accordingly. For normal case, where each customer has one single phone number we can easily track the replies and
take action. But if the customer use the same phone number for multiple accounts and we send multiple SMS to the same customer
(eventually in a same phone number) we are not able to track which specific SMS they have replied for.
Lets take an example,
User Tom has three accounts with us. Each of the three accounts uses the same phone number P.
Twilio SMS are tracked by a combination of From/To pair.
Assuming, we are using one Twilio proxy number as sending number which is S.
Case 1: Tom has one booking canceled for a short notice period. An SMS has been sent from S->P. When a reply is received, we can easily track the reply and take the action.
Case 2: Tom has two or more bookings canceled due to a short notice period.
For each canceled booking, an SMS has been sent from S->P. When the user replies, we are unable to detect which booking to mark the reply for.
It is not possible to know which message a person has responded to in SMS. The only way to efficiently handle this is to send messages from different numbers. So, if a user signs up with the same phone number as another user then you need to assign a new Twilio number to them. Then you can tell which user you are contacting or receiving messages from by the number.
If you send out messages about bookings on the same account at the same time, then you need to be even more granular with the number access. Each notification should assign a number to use and then when a reply comes to that number it was about that notification. Then if you need to send a second message simultaneously, you attach a different Twilio number to it. And so on for more messages.

SMS to Twilio Number with Extension

I'd like users to be able to text my Twilio number and have the text forwarded to various recipients based on the number's extension. i.e. texting to 555-555-5555,2 should route to a different receiver than 555-555-5555,3.
This Quora answer hints that this is possible, but I haven't found any further documentation: https://www.quora.com/Is-it-possible-to-send-a-text-message-from-my-Android-to-a-phone-number-with-an-extension-number
I tried using Twilio Studio to implement something like an IVR or message/response, but that only produced a text prompt which didn't seem to respond to the number entered after the comma.
This not possible by appending data to the destination number. You would need to place directives in the SMS message body and have your Twilio (Studio) logic parse the message body to determine how to deliver the SMS (which Phone number to deliver the SMS to).

Unique replies to multiple sms messages

Our scenario is as follows:
We have a marketplace where sellers will receive multiple messages throughout the day from users.
We want to send message notifications etc via sms to sellers
We would like sellers to be able to reply to a sms message notification on their phone. We want what they text to appear as their reply on our site. Is this possible?
Say a seller checks their phone as sees that they have 5 notifications, is there a way they can reply to a specific message rather than the last one sent?
Any help would be much appreciated.
As you describe the use case, it is not possible. As you suspect, there's no way to link one inbound message to a particular outbound message. I'd suggest borrowing an idea from Twitter and including a Base-36 code in the notification. If a reply contains that code, then it's in response to that original message. For example...
Notitification: A seller is interested in your widget. LFLR
Reply: #LFLR Sorry. We are sold out of the widgets.
It will take a slight bit of effort from the sellers. But, then, they are motivated to sell. Using a Base-36 code will keep the number of characters to type under five even for a million plus messages.

How do some SMS messages transmit the senders name?

I have noticed that certain SMS messages that I receive from companies come with a 'sender name'. eg. Just today I received an SMS from a number I have never used before (not im my contacts), however the senders name showed up as 'Adobe'. I get this from other companies too. eg Facebook, Google & Banking.
Is it similar to how a email server works? (you tell the server who you 'are' before you send the message) Is this the case with a carrier's cell tower?
I guess I'm wondering what the service is called and how it works? (ie. can you send 'header info' with SMS messages or is the cell tower just spoofing the message's 'sender number' and replacing it with characters?)
(hopefully this is the right place to ask this question...)
The MAP protocol (the one used for sending SMS messages among others) allow specifying either a phone number or an alphanumeric number as the sender.
AFAIK this cannot be set from your phone where the sender number will be always your public phone number but SMS Centers can allow sending such messages on other interfaces like the ones used by banks and the companies mentioned by you (usually using the SMPP or UCP protocoll).
Please note that some Telcos do not allow this kind of sender address in messages originated elsewhere but sent to their customers (or they don't allow it for everybody). They use SMS spam filters/firewalls called Home Routers for this.
Mobile communication in GSM, UMTS and LTE is governed by 3GPP.
The TP-OA field in SMS-DELIVER TPDU in an incoming SMS typically contains the number of a sender.
The network fills the TP-OA field with usually an MSISDN.
Please see 3GPP TS 23.040 Figure C.10.
But in case of a company name, TP-OA can be made alphanumeric using the Type of Number Information Element as 7-bit default alphabet
I suggest you to read 3GPP TS 24.011 and 23.040 to get an idea of how SMSes work.
However, I must point out that since a sender does not send TP-OA, it can't be easily spoofed.

Any way to tell what text message another message is in response to?

Are there any texting services out there (like Twilio) with APIs that allow you to see what message another message is in response to? For example: I want to tell whether message 3 is in response to 1 or 2.
A->B: Do you like ice cream?
A->B: Do you like pizza?
B->A: Yes.
I'm guessing that there's just no threadedness to text messages, and this is impossible. But might as well have a canonical answer out there.... Reasons for this belief:
When you send emails to a phone number at txt.att.net, it uses a different number each time.
The texting services that I've looked at don't offer the feature
The phone UIs I've used all present it as a flat message list rather than a threaded list
Can someone confirm this?
There is no native support for this type of functionality in SMS. Message threading for SMS is inferred on the client side from context. When I send a text to person 1, if I receive a reply from person 1 within a given time-frame, I can assume that it was part of the same "conversation". (I actually implemented something like this for a chat client that I was working on)
I have also seen where the original message is included with the response, and the client can group the messages accordingly (take a look at gmail), but this could be messy if your clients were not the same.
Just a few thoughts.

Resources