Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added example of how to send SMS #9

Merged
merged 2 commits into from

2 participants

@connor

I saw this was missing an example on how to send an SMS (like the Python repo has), so I thought I'd throw this in there. Tested it on my setup and worked perfectly. It's just an example of how to send an SMS.

@andrewmbenton

the example is good. but either remove the reference to the sandbox number or put the sandbox pin into the message to be consistent. then i will merge.

thanks

@connor

Is that more along the lines of what you were looking for?

Thanks!

@andrewmbenton

perfect, merging

@andrewmbenton andrewmbenton merged commit a0c8495 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 18, 2011
  1. @connor
Commits on Jun 17, 2011
  1. @connor
This page is out of date. Refresh to see the latest.
Showing with 11 additions and 0 deletions.
  1. +11 −0 examples/example-rest.rb
View
11 examples/example-rest.rb
@@ -61,3 +61,14 @@
"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/Recordings/\
RE7b22d733d3e730d234e94242b9697cae", 'DELETE')
puts "code: %s" % [resp.code]
+
+# ===========================================================================
+# 6. Send an SMS Message to 415-555-1212
+# uses a HTTP POST, and a new variable t for the information (because it needs "Body")
+t = {
+ 'From' => CALLER_ID,
+ 'To' => '415-555-1212',
+ 'Body' => "Hello, world. This is a text from Twilio using Ruby!"
+}
+resp = account.request("/#{API_VERSION}/Accounts/#{Account_SID}/SMS/Messages",
+ "POST", t)
Something went wrong with that request. Please try again.