- API & Docs
Did you know you can also send SMS when someone calls your Twilio number? The <Sms> verb is actually a valid response to an incoming call. Give this a try:
require 'rubygems' require 'twilio-ruby' require 'sinatra' get '/sms-quickstart' do Twilio::TwiML::Response.new do |r| r.Say "Hello Monkey! You will get an SMS message soon." r.Sms "Here it is!" end.text end
If you go that that app in your browser, you should see TwiML that looks like this:
<?xml version="1.0" encoding="UTF-8"?> <Response> <Say>Hello Monkey! You will get an SMS message soon.</Say> <Sms>Here it is!</Sms> </Response>
Save a publicly-accessible URL to return that XML. Then, configure that URL to be the Voice URL of your Twilio phone number.
Call that number from a mobile phone -- you should hear a message and get a text message in response.
And that's all she wrote folks! Back to Quickstarts.