【发布时间】:2021-01-05 05:17:47
【问题描述】:
我是 google Dialogflow 的新手,并尝试在 Dialogflow Messenger 中添加卡片。 下面是我在 Dialogflow Messenger 上显示卡片的代码。请帮帮我。 卡没有出现在信使中。 我也创建了一个调用卡片的意图。
function welcome(agent) {
agent.add(`Welcome to my agent!`);
}
function fallback(agent) {
agent.add(`I didn't understand`);
agent.add(`I'm sorry, can you try again?`);
}
// // Uncomment and edit to make your own intent handler
// // uncomment `intentMap.set('your intent name here', yourFunctionHandler);`
// // below to get this function to be run when a Dialogflow intent is matched
function cards(agent) {
agent.add(`This message is from Dialogflow's Cloud Functions for Firebase editor!`);
agent.add(new Card({
title: 'Title: this is a card title',
imageUrl: 'https://developers.google.com/actions/images/badges/XPM_BADGING_GoogleAssistant_VER.png',
text: 'This is the body text of a card. You can even use line\n breaks and emoji! ????',
buttonText: 'This is a button',
buttonUrl: 'https://assistant.google.com/'
})
);}
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', cards);
//intentMap.set('Dialogflow Cards', cards);
// intentMap.set('your intent name here', googleAssistantHandler);
agent.handleRequest(intentMap);
});
【问题讨论】:
标签: dialogflow-es dialogflow-es-fulfillment