SMS Forwarding with Twilio - php

I've been trying to build an app that forwards an sms to a URL
with twilio, i.e, a user sends an sms to a twilio number, the sms gets forwarded to a specified url, can't seems to find the resource on that, any experienced person in that area
to give a hint, plus what is the format of the sms forwarded to the url.
Thanks

Twilio evangelist here.
I'd suggest working through the SMS and MMS Messages Quickstart. It will walk you through the PHP needed to receive a text message:
https://www.twilio.com/docs/quickstart/php/sms
Hope that helps.

At last, I was able to find what I was looking for. Phew!
$_REQUEST['Body'] retrieves the body of the sms message and I can do whatever I like with that.
Twilio rocks!

Related

Nexmo Forward Message to my number

I have a virtual number in nexmo 447775*****, then my goal is If someone texted me on that number the message will be forwarded to my personal number 55699*****. I read the documentation on how webhook works but I didn't quite sure if that is what I'm looking for. I already search google for a day to search for a tutorial but I didn't find any. Can someone provide me some reference or provide an example? Btw I'm using php.
You could setup your Nexmo virtual to "forward" to your personal number however you need to code your backed as such. Nexmo provides an API to facilitate sending/receiving SMS but it's not a forwarding service. Google Voice would be what you are looking if you want something out of the box. A Webhook is basically a URL that Nexmo would call when you receive an incoming SMS message. Your API/service would receive the message, parse it and do something with it. Hope this helps.

Share Contact Via Twillion to iPhone

I am looking to create a script to send a contact from Twillio to my iPhone. The purpose is the contact I send from Twillio to phone should look exactly the way contact shared by iPhone. Can someone help me,
PS: Is it doable ?
Twilio developer evangelist here.
This kind of depends. Contacts are sent as MMS messages (as it's a file of information). Twilio supports sending MMS messages in the US and Canada, so you can do this if that is where you are sending your messages. If you are sending elsewhere in the world, then I'm afraid you can't do so with Twilio and make it look the same as a shared contact.
Let me know if that helps at all.

How to record and store Twilio SMS in MySQL with no additional action?

What I am trying to accomplish is quite simple. I want to store all received SMS messages from a Twilio number in a database. Upon checking Twilio's documentation, their TwiML word should be able to do this, but no attribute relates to this:
https://www.twilio.com/docs/api/twiml/sms
Twilio developer evangelist here.
When your Twilio number gets sent an SMS, your application receives a webhook at the URL you supply in the settings for the number. For each messages, the webhook sends a number of parameters telling you about the message. The documentation for that can be found here: https://www.twilio.com/docs/api/twiml/sms/twilio_request.
You might want to take a look at our PHP Quickstart tutorial which will give you a good idea of how to get the details from the request. You will then just have to pick which attributes you want to store in your database.
Let me know if this helps.

How to receive SMS to a twilio number

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.
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

Twilio sms question

Uptill now I have been using Twilio for phone calls. Now I want to be able to have a network monitoring tool that texts when there is a problem to a number. I would like to make it so that when twilio receives the text it will execute the script that I have put into its URL...I really don't know how to get started with sms it seems very hard and complicated as compared to phone calls...Any help on the sms is greatly appreciated to get me started.
If you've already figured Twilio voice calls, you'll find SMS easier once you figure out what they're doing. Which is essentially:
Carrier delivers an SMS to Twilio for a number you're renting from them.
Twilio makes an HTTP POST or GET (you choose) to the URL you setup in their web admin. The content of the text message will be a parameter in there.
You do whatever you want with the POST or GET, returning a TwiML if you want an SMS reply sent or nothing if not.
Note, Twilio can't execute a script for you, unless it's TwiML, in which case you're just returning TwiML as the response to the HTTP call from #3. So if you want to do something in response to an SMS, you'll need build that something into the logic that handles the URL you've given Twilio. If you're still lost a bit, tell us about how you're trying to do this, e.g., you've a Rails app, a PHP website, or just a Bash script you want to run and nothing else yet...
Why not avoid Twilio and have your network monitoring tool execute the script itself?

Categories