from twilio.twiml.messaging_response import MessagingResponse
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
@app.route("/sms", methods=['POST'])
def sms_reply():
# Get the message sent to the Twilio number
message = request.form.get('Body')
# Create a response object to send back a message
resp = MessagingResponse()
# Add a message to the response
resp.message("You said: {}".format(message))
return str(resp)
if __name__ == "__main__":
app.run()
from flask import Flask, request
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
@app.route("/sms", methods=['POST'])
def sms_reply():
# Get the message sent to the Twilio number
message = request.form.get('Body')
# Create a response object to send back a message
resp = MessagingResponse()
# Add a message to the response
resp.message("You said: {}".format(message))
return str(resp)
if __name__ == "__main__":
app.run()
No comments:
Post a Comment
Tell us how you like it.