File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ from flask import Flask , request , jsonify
2
+
3
+ app = Flask (__name__ )
4
+
5
+ @app .route ("/webhooks/answer" )
6
+ def answer_call ():
7
+ ncco = [{
8
+ "action" : "talk" ,
9
+ "text" : "Thanks for calling the notification line"
10
+ },
11
+ {
12
+ "action" : "notify" ,
13
+ "payload" : {
14
+ "foo" : "bar"
15
+ },
16
+ "eventUrl" : [
17
+ "{url_root}webhooks/notification" .format (url_root = request .url_root )
18
+ ]
19
+ },
20
+ {
21
+ "action" : "talk" ,
22
+ "text" : "You will never hear me as the notification URL will return an NCCO "
23
+ }]
24
+ return jsonify (ncco )
25
+
26
+ @app .route ("/webhooks/notification" , methods = ['POST' ])
27
+ def notification ():
28
+ ncco = [{
29
+ "action" : "talk" ,
30
+ "text" : "Your notification has been received, loud and clear"
31
+ }]
32
+ return jsonify (ncco )
33
+
34
+ @app .route ("/webhooks/event" , methods = ['POST' ])
35
+ def event ():
36
+ return "OK"
37
+
38
+ if __name__ == '__main__' :
39
+ app .run (host = "localhost" , port = 3000 )
You can’t perform that action at this time.
0 commit comments