就我而言,我正在使用dialogflow创建一个闲聊机器人。对机器人说“嗨”时,它会用3个按钮做出响应,用户必须从中选择三个按钮。根据所做的选择,必须触发后续意图。
我能够在Slack聊天机器人中创建按钮,但无法将选择返回到dialogflow并触发所需的意图。
示例代码:
function welcome (agent) {
agent.add( new Payload(agent.SLACK, {
"text":'Welcome ',
"attachments": [
{
"text": "Please choose any of the following options",
"actions": [
{`enter code here`
"name": "General Enquiries",
"type": "button",
"text": "General Enquiries",
"value": "General Enquiries"
},
{
"name": "Account Related Queries",
"type": "button",
"text": "Account Related Queries",
"value": "Account Related Queries"
},
{
"name": "Complaints",
"type": "button",
"text": "Complaints",
"value": "Complaints"
}
]
}
]
}) );
}
function accountQueries (agent){
agent.add('Hi buddy');
}
function Complaints (agent){
agent.add('Hi teddy');
}
let intentMap = new Map();
intentMap.set(WELCOME_INTENT, welcome);
intentMap.set(ACCOUNT_RELATED_QUERIES, accountQueries);
intentMap.set(COMPLAINTS, Complaints);
agent.handleRequest(intentMap);