공정훈

Add block connection

Showing 1 changed file with 59 additions and 14 deletions
...@@ -34,29 +34,74 @@ apiRouter.post('/sayHello', function(req, res) { ...@@ -34,29 +34,74 @@ apiRouter.post('/sayHello', function(req, res) {
34 res.status(200).send(responseBody); 34 res.status(200).send(responseBody);
35 }); 35 });
36 36
37 -apiRouter.post('/question1', (req, res) => { 37 +apiRouter.post('/test', (req, res) => {
38 - const responseBody = { 38 + var utt = req.body.userRequest.utterance;
39 + var data = {
40 + version: "2.0",
41 + template: {
42 + outputs: [
43 + {
44 + simpleText: {
45 + text: utt
46 + }
47 + }
48 + ],
49 + quickReplies: [{
50 + action: "block",
51 + label: "테스트 시작",
52 + message: "테스트 시작",
53 + data: {
54 + "blockId": "628b8005055a574d7df54466",
55 + "extra": {
56 + "": ""
57 + }
58 + }
59 + }]
60 + }
61 + }
62 + res.json(data);
63 +});
64 +
65 +app.post('/question1', (req, res) => {
66 + var mesg = req.body.userRequest;
67 + console.log('[user message] ', mesg);
68 + var data = {
39 version: "2.0", 69 version: "2.0",
40 template: { 70 template: {
41 outputs: [ 71 outputs: [
42 { 72 {
43 - basicCard: { 73 + simpleText: {
44 - title: "사람들과 어울리는 것을 좋아하나요?", 74 + text: '사람들과 어울리는 것을 좋아하시나요?'
45 - buttons: [
46 - {
47 - label: 'Yes',
48 - action: 'message'
49 - }, {
50 - label: 'No',
51 - action: 'message'
52 - }
53 - ]
54 } 75 }
55 } 76 }
77 + ],
78 + quickReplies: [
79 + {
80 + action: "block",
81 + label: "네",
82 + message: "네",
83 + data: {
84 + "blockId": "628e8cb07bd2fd433357f878",
85 + "extra": {
86 + "": ""
87 + }
88 + }
89 + },
90 + {
91 + action: "block",
92 + label: "아니오",
93 + message: "아니오",
94 + data: {
95 + "blockId": "628e8cb07bd2fd433357f878",
96 + "extra": {
97 + "": ""
98 + }
99 + }
100 + }
56 ] 101 ]
57 } 102 }
58 } 103 }
59 - res.json(responseBody); 104 + res.json(data);
60 }); 105 });
61 106
62 apiRouter.post('/question3', function(req, res) { 107 apiRouter.post('/question3', function(req, res) {
......