I have created a free account in twilio for sending SMS through my website. After my registration I got a twilio number like XXX-XXX-XXXX. I am able to send message to mobile numbers but I don't know how to use this twilio number for receiving SMS. Please help me out on this.
1 Answers
Twilio evangelist here.
The way Twilio notifies you of both incoming SMS message and incoming voice phone calls is by using something called a webhook. This is basically an HTTP request that Twilio makes to a URL that you tell us about. Normally this URL is a web app that you've created and published to a public website.
http://en.wikipedia.org/wiki/Webhook
In your Twilio dashboard, click on the Numbers tab and you will see your trial number.
https://www.twilio.com/user/account/phone-numbers/incoming
Click the phone number and you will see two input fields, one for a Voice URL and one for a SMS url. Just put your URL's there and click the save button.
Now if you send a text message to your number, Twilio will make an HTTP request to the URL you've told us about. You can think of this like a standard Form submit. Twilio will send along parameters like the number the SMS is coming from and the body of the message. The full list of parameters we send to the SMS url is here:
https://www.twilio.com/docs/api/twiml/sms/twilio_request
Your app can grab those parameters and use them however it wants. Your app can also return TwiML instructions to us that tell us to respond to the SMS.
https://www.twilio.com/docs/api/twiml/sms/your_response
You might want to check out our quickstarts for examples of how to receive a text message and and howtos for lots more examples of both sending and receiving SMS messages.
https://www.twilio.com/docs/quickstart/php/sms/hello-monkey https://www.twilio.com/docs/howto
Hope that helps.
Devin

- 10,260
- 1
- 20
- 32
-
Hi @Devin, i making an app that need to keep track my customer reply status. I want to know will Twilio keep making request attempt if my webhook is down until the request is successfully? If yes, how frequent does Twilio making request attempt? – Nerdynosaur May 30 '16 at 10:23
-
Check out the fallback URL: https://www.twilio.com/docs/api/security/availability-reliability – Devin Rader May 31 '16 at 01:59
-
There's basically two ways. Ask Twilio for Messages.csv and explode the results (for example) or you can have Twilio come to you via "webhook." If I had more time I'd post code. – PJ Brunet Mar 17 '18 at 17:20