wjc0930

Controller - Template Sample Workflow

......@@ -18,6 +18,8 @@ exports.handleMessage = (sender_psid, received_message) => {
callSendAPI(sender_psid, response);
}
// Handle postback(=button) events
exports.handlePostback = (sender_psid, received_postback) => {
let response;
......@@ -36,7 +38,7 @@ exports.handlePostback = (sender_psid, received_postback) => {
callSendAPI(sender_psid, template.askTemplate('Show me more'));
});
} else if(payload === 'GET_STARTED'){
response = template.askTemplate('Are you a Cat or Dog Person?');
response = template.greetingTemplate();
callSendAPI(sender_psid, response);
}
// Send the message to acknowledge the postback
......
let images = require("./pics");
let greetingText = "안녕하세요! 컴공/소융 강의평가 봇이에요. 아래에 버튼 3개를 눌러주세요."; // 인사말
let greetingTitle = ["교수명으로 검색", "강의명으로 검색", "HELP"];
exports.greetingTemplate = () => {
return {
"attachment":{
"type":"template",
"payload":{
"template_type":"button",
"text": greetingText,
"buttons":[
{
"type":"postback",
"title":greetingTitle[0],
"payload":"CHOICE_BY_PROF"
},
{
"type":"postback",
"title":greetingTitle[1],
"payload":"CHOICE_BY_LECT"
}
{
"type":"postback",
"title":greetingTitle[2],
"payload":"CHOICE_BY_HELP"
}
]
}
}
}
}
exports.askTemplate = (text) => {
return {
......