Showing
2 changed files
with
35 additions
and
1 deletions
... | @@ -18,6 +18,8 @@ exports.handleMessage = (sender_psid, received_message) => { | ... | @@ -18,6 +18,8 @@ exports.handleMessage = (sender_psid, received_message) => { |
18 | callSendAPI(sender_psid, response); | 18 | callSendAPI(sender_psid, response); |
19 | } | 19 | } |
20 | 20 | ||
21 | + | ||
22 | +// Handle postback(=button) events | ||
21 | exports.handlePostback = (sender_psid, received_postback) => { | 23 | exports.handlePostback = (sender_psid, received_postback) => { |
22 | let response; | 24 | let response; |
23 | 25 | ||
... | @@ -36,7 +38,7 @@ exports.handlePostback = (sender_psid, received_postback) => { | ... | @@ -36,7 +38,7 @@ exports.handlePostback = (sender_psid, received_postback) => { |
36 | callSendAPI(sender_psid, template.askTemplate('Show me more')); | 38 | callSendAPI(sender_psid, template.askTemplate('Show me more')); |
37 | }); | 39 | }); |
38 | } else if(payload === 'GET_STARTED'){ | 40 | } else if(payload === 'GET_STARTED'){ |
39 | - response = template.askTemplate('Are you a Cat or Dog Person?'); | 41 | + response = template.greetingTemplate(); |
40 | callSendAPI(sender_psid, response); | 42 | callSendAPI(sender_psid, response); |
41 | } | 43 | } |
42 | // Send the message to acknowledge the postback | 44 | // Send the message to acknowledge the postback | ... | ... |
1 | let images = require("./pics"); | 1 | let images = require("./pics"); |
2 | 2 | ||
3 | +let greetingText = "안녕하세요! 컴공/소융 강의평가 봇이에요. 아래에 버튼 3개를 눌러주세요."; // 인사말 | ||
4 | +let greetingTitle = ["교수명으로 검색", "강의명으로 검색", "HELP"]; | ||
5 | + | ||
6 | + | ||
7 | +exports.greetingTemplate = () => { | ||
8 | + return { | ||
9 | + "attachment":{ | ||
10 | + "type":"template", | ||
11 | + "payload":{ | ||
12 | + "template_type":"button", | ||
13 | + "text": greetingText, | ||
14 | + "buttons":[ | ||
15 | + { | ||
16 | + "type":"postback", | ||
17 | + "title":greetingTitle[0], | ||
18 | + "payload":"CHOICE_BY_PROF" | ||
19 | + }, | ||
20 | + { | ||
21 | + "type":"postback", | ||
22 | + "title":greetingTitle[1], | ||
23 | + "payload":"CHOICE_BY_LECT" | ||
24 | + } | ||
25 | + { | ||
26 | + "type":"postback", | ||
27 | + "title":greetingTitle[2], | ||
28 | + "payload":"CHOICE_BY_HELP" | ||
29 | + } | ||
30 | + ] | ||
31 | + } | ||
32 | + } | ||
33 | + } | ||
34 | +} | ||
3 | 35 | ||
4 | exports.askTemplate = (text) => { | 36 | exports.askTemplate = (text) => { |
5 | return { | 37 | return { | ... | ... |
-
Please register or login to post a comment