-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.py
47 lines (37 loc) · 1.09 KB
/
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
40
41
42
43
44
45
46
47
from flask import Flask, request
from twilio.twiml.messaging_response import MessagingResponse
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello, World!"
c = 0
@app.route("/sms", methods=['POST'])
def sms_reply():
global c
"""Respond to incoming calls with a simple text message."""
# Fetch the message
msg = request.form.get('Body')
# Create reply
# resp = MessagingResponse()
# resp.message("You said: {}".format(msg))
p = ['hi', 'hey', 'hola', 'heya', 'howdy', 'hello', 'heyy', 'hey', 'hi']
q = ['heth', 'chirag']
if msg.lower() in p:
txt = "Can you enter the name of the student?"
resp = MessagingResponse()
resp.message(txt)
c = c+1
return str(resp)
if c == 1:
txt = "Okay"
resp = MessagingResponse()
resp.message(txt)
c = c+1
return str(resp)
if c == 2:
txt = "Bye"
resp = MessagingResponse()
resp.message(txt)
return str(resp)
if __name__ == "__main__":
app.run(debug=True)