공정훈

Add block connection

Showing 1 changed file with 57 additions and 12 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 = {
39 version: "2.0", 40 version: "2.0",
40 template: { 41 template: {
41 outputs: [ 42 outputs: [
42 { 43 {
43 - basicCard: { 44 + simpleText: {
44 - title: "사람들과 어울리는 것을 좋아하나요?", 45 + text: utt
45 - buttons: [ 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 = {
69 + version: "2.0",
70 + template: {
71 + outputs: [
46 { 72 {
47 - label: 'Yes', 73 + simpleText: {
48 - action: 'message' 74 + text: '사람들과 어울리는 것을 좋아하시나요?'
49 - }, { 75 + }
50 - label: 'No', 76 + }
51 - action: 'message' 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 + "": ""
52 } 98 }
53 - ]
54 } 99 }
55 } 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) {
......