Created
August 17, 2016 19:29
-
-
Save sagnew/70f64cdf41d5dbb5ed70275cddd69266 to your computer and use it in GitHub Desktop.
Receive an SMS in Python video
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
are the double line breaks at #4 and #7 intentional?