【发布时间】:2019-10-10 07:06:00
【问题描述】:
对于“测试意图”,我启用了Enable Webhook Call for this intent
我已正确设置 Telegram 与机器人的集成。
在完整的代码中,我使用了Payload对象的构造函数(https://dialogflow.com/docs/reference/fulfillment-library/rich-responses#new_payloadplatform_payload)and我已经指定了表示payload目标平台的字符串。请参见欢迎函数下面的代码:
const {WebhookClient} = require('dialogflow-fulfillment');
const {Text, Card, Image, Suggestion, Payload} = require('dialogflow-fulfillment');
exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => {
const agent = new WebhookClient({ request, response });
function test(agent) {
agent.add(new Payload(agent.TELEGRAM, {
"text": "Please click on button below to share your number",
"reply_markup": {
"one_time_keyboard": true,
"resize_keyboard": true,
"keyboard": [
[
{
"text": "Share my phone number",
"callback_data": "phone",
"request_contact": true
}
],
[
{
"text": "Cancel",
"callback_data": "Cancel"
}
]
]
}
}));
}
// Run the proper function handler based on the matched Dialogflow intent name
let intentMap = new Map();
intentMap.set('test Intent', test);
agent.handleRequest(intentMap);
});
Dialogflow 不会在调用意图时将履行代码中的有效负载响应返回给电报。 我查看了项目功能日志,但没有记录错误。 他们没有理由让我的代码不工作
对话流中是否已弃用有效负载类?
【问题讨论】: