public
Last active

SMS Birthday Card: Full Gist

  • Download Gist
app.py
Python
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
from flask import request
import os
from random import choice
 
 
app = Flask(__name__)
 
 
@app.route('/sms', methods=['POST'])
def sms():
r = twiml.Response()
if request.form['Body'].upper() == "HELP":
r.sms("Welcome to the Reasons Sonya Is Awesome Hotline. Text GIMME " \
"to get one random reason Sonya is awesome.")
else:
r.sms(choice(reasons))
return str(r)
 
 
reasons = [
'Alex: You hate the Giants.',
'Kent: You have a great sense of humor.',
'Ellen: Your brain is is awesome.',
'Becca: You are a good listener and has a fantastic perspective.',
'Rob: Your family comes first.',
'Bill: You speak Russian. LOUD.']
 
 
if __name__ == '__main__':
port = int(os.environ.get('PORT', 5000))
 
if port == 5000:
app.debug = True
 
app.run(host='0.0.0.0', port=port)

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.