Twilio: How to get answers from message log with just phone number - twilio

I want to get received messages of the same day of a phone number with the help of API or anything.
(I have purchased ofcourse a phone number)
**
Requirement :
**
I have a twilio app which sends 5 questions to 1000 user and users reply's to it. Like a survey. App is deployed on Azure.
I will get 5000 messages in log.
I am planning to retrieve messages by phone number and update my database from the user.
Implemented :
Implemented this https://www.twilio.com/docs/guides/sms/how-to-receive-and-reply-in-csharp. Any other idea for the requirement is also appreciated.

Twilio developer evangelist here.
I see that you've implemented the basic flow for responding to incoming SMS messages. If you are implementing surveys across a number of users my advice would be to expand on that application.
Firstly, you would need to run through your database to get all your users' phone numbers and send the first question to all of them using the Twilio REST API to send each a text message.
Then, when you receive an incoming message from one of your respondents you can find out the number that sent the message by inspecting the From parameter on the incoming request body. You can then look up your user in your database by phone number and save that response for them. Then you can use the TwiML <Message> to respond to the user and send them the next question.
This way you can collect the responses as they come in, rather than call the REST API to list all responses.
Let me know if that helps at all.

Related

How to track different conversation threads between 2 participants in twilio?

I have an application which uses Twilio to send SMSs.
There is a situation where the application sends multiple messages to a person, for example a message with info about product P1, then another message with information about product P2, and so on. So my question is, when the person replys the SMS, how could I know to exactly what SMS he is replying?
Or is it possible that each SMS that my application sends to the same person creates different conversations in Twilio, so I can track each response per each different SMS?, if so, how I can do it?
If you trigger the SMS messages by API it's hard to know what messages the customers answer.
We got to solve this problem using Twilio Sync (https://www.twilio.com/docs/sync/api/document-resource) which is basically cloud storage, so when we need to trigger an SMS or Whatsapp message, we save some information on Twilio Sync, like Twilio number, client number and the messages that were sent.
When the customer answers the message, we send him to a Twilio Studio that runs a Function that read the Sync document and check if this customer comes from a message response, if yes, we get the triggered message and added on the conversations, so we know the message that customer answered.
The Sync isn't a database and has a limit, so depending on your message volume, it can not work well.

Twilio Response from a non-twilio number

When my friends text my Twilio bot, Twilio responds from another number which is not even Twilio's and is named "SMSInfo". I expect the bot to respond from the same number. I assure you that I haven't set any logic there that a response should come from another number. Also, note that "SMSInfo" is a number which often sends them verification codes for Fiverr or other things.
I just submitted a ticket to Twilio support and a bot automatically suggested me few articles. One of them solved the issue.
Sender ID change may occur when you send messages from a Twilio number
that is not local to your recipients, for example using a US Twilio
number to send SMS to Polish mobile users. This is often done to
comply with local regulations, or to ensure the highest possible
delivery rate for your messages.

how to hide my twilio number from receiver when sending response

I am developing an app in android which send messages to users. I am using php for my api. when user send a message from the app, php sends back a response based on what they send.
Is there a way I can hide the twilio number from been known to the users or convert the number to a string when sending back response to the user?
Can you elaborate on what you're trying to accomplish?
If preventing the user from seeing the actual phone number, you could look at Twilio's Proxy service (in Beta). https://www.twilio.com/docs/proxy/api
Another option would be to register a short code with the phone number. https://www.twilio.com/docs/glossary/what-is-a-short-code

Twilio Parallel Process Result Page Update

I'm wanting to update a div or some area on a page that allows the user to progress, after a Twilio text goes out and receives either a 1 (true) or 0 (false) from a remote user. I'd like to give the user 5 minutes to answer the text, and have the page display the conditional result based on that answer.
Anybody know of a way to poll a result in order to display the two options? The user sends back a 1 to Twilio, which somehow goes to my server with parameters. I'm still learning how that can be done.
So I am looking for two items:
How to receive parameters from remote SMS using Twilio, passed to my server page, basically text number, sessionID, and user choice (1 or 0)
same page display of updated response from above. I'd like to not rely on page refresh.
Twilio developer evangelist here.
When you receive an SMS message on a Twilio phone number, Twilio makes an HTTP request to your application, at a URL that you supply, with all the details about the message, including the number it was from and the body of the message.
I would recommend checking out the quick start guides that we have on the site that will get you up and running sending and receiving messages using Twilio.
Once you've got the receiving messages bit sorted you then need to connect that incoming message to the browser the user was using. I'd take a look at either Server Sent Events (which I wrote about in a different context here) or web sockets, both ways of connecting the server to the browser without needing to poll or refresh. You'll have to figure out how to create channels for your users so that they only receive their own update to the page.

how to associate received sms messages (via twilio) to specific user in my rails app

I'm making an app that sends text messages to a group of people and then people can respond to the text. I want to be able to record the response, know who sent it, and associate it with the user who sent the original message. I've gotten the sending working, and I've begun putting together receiving sms messages but i'm confused. If twilio sends a post request to my server with the from number and message, how will I know which of my users sent the original message?
what if two different users send a message to the same person around the same time? what's the best way to handle this? do I need a separate 'to' number for each of my users? seems like that would get quite expensive. also, if each user has multiple campaigns (messages), how would I associate a response to a specific campaign?
i'm building a rails app.thanks
You'll want to use a different Twilio number for each contact a user sends to. This will establish a unique mapping between the 2 mobile devices and a Twilio number. This allows you to forward incoming messages sent to the Twilio number back to the appropriately mapped mobile phone. You'll do the lookup on your mapping based on who the incoming message is From.
You won't need a Twilio number for every one of your users, but you will need a pool of numbers which is the maximum number of contacts a single person can make.
There is an article on Twilio's site which gives additional information:
https://www.twilio.com/help/faq/sms/how-can-i-have-users-send-text-messages-to-each-other-over-twilio

Resources