Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to receive SMS to a twilio number

Tags:

php

twilio

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.

like image 449
BIJU Avatar asked May 27 '13 11:05

BIJU


People also ask

How do I text a Twilio number?

Twilio Phone Numbers and Hosted SMS numbers Any SMS-enabled Twilio phone number or Hosted SMS number on your account can be used to send SMS messages. To use a phone number for sending messages, input your phone number in the From parameter of your API request using E. 164 formatting.

Can Twilio receive SMS from short code?

By default, Twilio long code numbers cannot receive messages from short code numbers. Upon request, Twilio can enable your account(s) to receive incoming messages from short codes. This will allow long code phone numbers on your account to receive messages from short codes.

Is Twilio SMS free?

Talk to a Twilio expert to find the best fit for your needs. Otherwise, start sending SMS for free by signing up for Twilio's free trial.


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

like image 195
Devin Rader Avatar answered Oct 30 '22 13:10

Devin Rader