-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.py
36 lines (30 loc) · 1.33 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
from flask import Flask, request
from twilio.twiml.messaging_response import Message, MessagingResponse
from sendAlertMessage import *
app = Flask(__name__)
def possibleResponses(input):
response = None
if input == 'options':
response = 'Welcome to Twext! Type in a keyword for the information:\n ' + 'WildfireUpdate: For wildfire updates near you \n' +'WildfireTweets: For recent tweets about the wildfire near you.\n'+'Events: For Events happening near you\n' +'Safety: For safety updates near you (missing person, tragic event, etc)\n'
elif input == 'WildfireTweets':
response = str(tweetMessage())
elif input == 'WildfireUpdate':
response = str(warningMessage())
elif input == 'Events' or input == 'Safety':
response = 'This feature is under construction'
else:
response = 'Invalid input, please try again or text options. '
return response
@app.route('/sms', methods=['POST'])
def sms():
number = request.form['From']
message_body = request.form['Body']
# resp = MessagingResponse()
# resp.message('Hello {}, you said: {}'.format(number, message_body))
# return str(resp)
sendingMessage = possibleResponses(str(message_body))
resp = MessagingResponse()
resp.message(sendingMessage)
return str(resp)
if __name__ == '__main__':
app.run()