javascript - 有没有办法从 Fulfillment Webhook 发回快速回复?
问题描述
我一直在玩 DialogFlow 和 Fulfillment 但直到现在我总是将 FulfillmentText 从我的 webhook 返回到我的机器人,如下所示:
response = {
fulfillmentText: "Some message!"
};
有没有办法在这里返回一组选项(快速回复)?基本上我想返回 3 个按钮,选项 a、b 和 c 各一个。这可能吗?
谢谢!
编辑:
我可以使用以下代码发回一张卡片,但我找不到任何可以发回快速回复而不是卡片的样本。
"fulfillmentMessages": [
{
"card": {
"title": "card title",
"subtitle": "card text",
"imageUri": "https://assistant.google.com/static/images/molecule/Molecule-Formation-stop.png",
"buttons": [
{
"text": "button text",
"postback": "https://assistant.google.com/"
}
]
}
}
],
解决方案
这是一个例子:
fulfillmentMessages: [
{
quickReplies: {
title: 'Hello',
quickReplies: [
'First Reply',
'Second Reply',
],
},
platform: 'FACEBOOK'
},
};
推荐阅读
- python - “条目”对象在 Django 中没有属性“主题”问题
- sql - SQl 查询以获取类似于图像的输出
- random - 如何纠正 TypeError 与选择()缺少 1 个必需的位置参数:“人口”
- java - 如何将“对象”转换为未知的自定义数据类型/类对象?
- java - 如何在 Android 中的多个活动和片段中保留对象?
- node.js - mongodb 连接大约需要 10 秒
- python - 据称正确的 SPARQL 查询(Wikidata)在 Python 中没有产生任何结果
- python - 有没有办法使用熊猫将多个标志列汇总为一个?
- python-3.x - 如何从python数组创建对象
- python - 使用 numpy 数组 Pandas 修改数据框中多列的快速方法