Skip to content

Instantly share code, notes, and snippets.

@benheymink
Created January 16, 2013 09:23
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save benheymink/4545811 to your computer and use it in GitHub Desktop.
Simple TwilioApp
from flask import Flask, render_template, request
from twilio.rest import TwilioRestClient
app = Flask(__name__)
account = "MY_ACCOUNT_SID"
token = "MY_ACCOUNT_TOKEN"
client = TwilioRestClient(account, token))
@app.route('/')
def ReturnForm():
return render_template('form.html')
@app.route('/', methods=['POST'])
def FormPost():
message = client.sms.messages.create(to="MY_NUMBER", from_="MY_TWILIO_NUMBER",
body=request.form['Message'])
return render_template('success.html')
if __name__ == '__main__':
app.run(host='0.0.0.0', port=5000)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment