-
Notifications
You must be signed in to change notification settings - Fork 2
/
app.py
32 lines (25 loc) · 823 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
"""
APP - Flask server endpoint
Sets up a super-simple HTTP POST endpoint, for the
GroupMe API to ping with new messages from the group
Flask parts were made almost entirely with this tutorial:
http://www.apnorton.com/blog/2017/02/28/How-I-wrote-a-Groupme-Chatbot-in-24-hours/
"""
import firstblood
from flask import Flask, request
app = Flask(__name__)
print(app.config)
@app.route("/", methods=['POST','GET'])
def webhook():
data = request.get_json()
print(data)
print(type(data))
print(data['name'])
print(type(data['name']))
if data['name'] != "firstblood":
# msg = 'You (name={}) sent "{}"'.format(data['name'], data['text'])
# send_message(msg)
firstblood.incoming_message(data)
return "ok", 200
# if __name__ == '__main__':
# app.run(use_reloader=False)