-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
39 lines (27 loc) · 852 Bytes
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from flask import Flask, request, redirect
from twilio.twiml.messaging_response import MessagingResponse
from main import msgs
#print(msgs)
app = Flask(__name__)
def reply():
"""Send a dynamic reply to an incoming text message"""
# Get the message the user sent our Twilio number
body = request.values.get('Body', None)
# Start our TwiML response
resp = MessagingResponse()
# Determine the right reply for this message
if body == 'Check' or body == 'check':
resp.message(msgs)
elif body == 'Bye':
resp.message("Goodbye")
elif body == 'Hi':
resp.message('Hello user....')
return str(resp)
@app.route("/")
def hello():
return "Hello World"
@app.route("/sms", methods=['GET', 'POST'])
def incoming_sms():
return reply()
if __name__ == "__main__":
app.run(debug=True)