Skip to content

Instantly share code, notes, and snippets.

@sagnew
Created August 17, 2016 19:29
Show Gist options
  • Save sagnew/70f64cdf41d5dbb5ed70275cddd69266 to your computer and use it in GitHub Desktop.
Save sagnew/70f64cdf41d5dbb5ed70275cddd69266 to your computer and use it in GitHub Desktop.
Receive an SMS in Python video
from flask import Flask, request
from twilio import twiml
app = Flask(__name__)
@app.route('/sms', methods=['POST'])
def sms():
number = request.form['From']
message_body = request.form['Body']
resp = twiml.Response()
resp.message('Hello {}, you said: {}'.format(number, message_body))
return str(resp)
if __name__ == '__main__':
app.run()
@GregBaugues
Copy link

are the double line breaks at #4 and #7 intentional?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment