Skip to content

Instantly share code, notes, and snippets.

@mtaran-google
Forked from jpf/helloworld.py
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mtaran-google/71dd6d2d89836c60c58a to your computer and use it in GitHub Desktop.
Save mtaran-google/71dd6d2d89836c60c58a to your computer and use it in GitHub Desktop.
import webapp2
from twilio import twiml
from twilio.rest import TwilioRestClient
class HelloMonkey(webapp2.RequestHandler):
def post(self):
r = twiml.Response()
r.say("Hello Monkey!")
self.response.headers['Content-Type'] = 'text/xml'
self.response.write(str(r))
class SendSMS(webapp2.RequestHandler):
def get(self):
# replace with your credentials from: https://www.twilio.com/user/account
account_sid = "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
auth_token = "xxxxxxxxxxxxxxxxxxxxxxxxxx"
client = TwilioRestClient(account_sid, auth_token)
# replace "to" and "from_" with real numbers
rv = client.messages.create(to="+14155551212",
from_="+14085551212",
body="Hello Monkey!")
self.response.write(str(rv))
app = webapp2.WSGIApplication([('/twiml', HelloMonkey),
('/send_sms', SendSMS)],
debug=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment