최원섭

[Develop] Bot Message API

Showing 1 changed file with 20 additions and 0 deletions
...@@ -16,5 +16,25 @@ app.get('/keyboard', function(req, res) { ...@@ -16,5 +16,25 @@ app.get('/keyboard', function(req, res) {
16 }).send(JSON.stringify(menu)); 16 }).send(JSON.stringify(menu));
17 }); 17 });
18 18
19 +app.post('/message', function(req, res) {
20 + const _obj = {
21 + user_key: req.body.user_key,
22 + type: req.body.type,
23 + content: req.body.content
24 + };
25 +
26 + console.log(_obj.content)
27 +
28 + let massage = {
29 + "message": {
30 + "text": _obj.content
31 + },
32 + };
33 +
34 + res.set({
35 + 'content-type': 'application/json'
36 + }).send(JSON.stringify(massage));
37 +});
38 +
19 app.listen(80, function(){ 39 app.listen(80, function(){
20 }); 40 });
......