- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试将 DialogFlow 机器人与 Hangouts Chat(适用于 G Suite)集成。我在 DialogFlow 上启用了集成,基本意图运行良好。
为了使用 fulfillment 执行后端操作,我创建了一个 firebase 云函数并将其添加为 DialogFlow fulfillment 页面上的 webhook URL。
我已经编写了云函数代码来识别意图,并为简单的文本响应生成 Webhook 响应格式。这是有效的,我看到 firestore 数据正在根据意图进行修改。
然而,对于更复杂的意图,我希望更多地使用 Chat 提供的基于动态卡片的响应。为了实现这一点,我查看了 dialogflow 卡响应的文档。
我在 https://cloud.google.com/dialogflow/docs/integrations/hangouts 看到了以下代码。当我将其粘贴到 hangouts 自定义负载下的 dialogflow 意图编辑器 UI 中时(在禁用 webhook 集成之后),它起作用了
{
"hangouts": {
"header": {
"title": "Pizza Bot Customer Support",
"subtitle": "pizzabot@example.com",
"imageUrl": "..."
},
"sections": [{
"widgets": [{
"keyValue": {
"icon": "TRAIN",
"topLabel": "Order No.",
"content": "12345"
}
},
{
"keyValue": {
"topLabel": "Status",
"content": "In Delivery"
}
}]
},
{
"header": "Location",
"widgets": [{
"image": {
"imageUrl": "https://dummyimage.com/600x400/000/fff"
}
}]
},
{
"header": "Buttons - i could leave the header out",
"widgets": [{
"buttons": [{
"textButton": {
"text": "OPEN ORDER",
"onClick": {
"openLink": {
"url": "https://example.com/orders/..."
}
}
}
}]
}]
}]
}
}
这正是我所需要的,但我需要来自 webhook 的响应。 我没有得到正确的响应格式来映射两者。
当我尝试将相同的代码与 webhook 集成时,我在环聊聊天中没有收到任何回复。当我检查 dialogflow UI 的历史部分时,这里是原始交互日志中提到的响应结构
{
"queryText": "<redacted>",
"parameters": {},
"intent": {
"id": "<redacted>",
"displayName": "<redacted>",
"priority": 500000,
"webhookState": "WEBHOOK_STATE_ENABLED"
},
"intentDetectionConfidence": 1,
"diagnosticInfo": {
"webhook_latency_ms": 284
},
"languageCode": "en",
"slotfillingMetadata": {
"allRequiredParamsPresent": true
},
"id": "<redacted>",
"sessionId": "<redacted>",
"timestamp": "2020-07-30T12:05:29.094Z",
"source": "agent",
"webhookStatus": {
"webhookUsed": true,
"webhookPayload": {
"hangouts": {
"header": {
"subtitle": "pizzabot@example.com",
"title": "Pizza Bot Customer Support",
"imageUrl": "..."
},
"sections": [
{
"widgets": [
{
"keyValue": {
"content": "12345",
"topLabel": "Order No.",
"icon": "TRAIN"
}
},
{
"keyValue": {
"topLabel": "Status",
"content": "In Delivery"
}
}
]
},
{
"widgets": [
{
"image": {
"imageUrl": "https://dummyimage.com/600x400/000/fff"
}
}
],
"header": "Location"
},
{
"widgets": [
{
"buttons": [
{
"textButton": {
"text": "OPEN ORDER",
"onClick": {
"openLink": {
"url": "https://example.com/orders/..."
}
}
}
}
]
}
],
"header": "Buttons - i could leave the header out"
}
]
}
},
"webhookStatus": {
"message": "Webhook execution successful"
}
},
"agentEnvironmentId": {
"agentId": "<redacted>",
"cloudProjectId": "<redacted>"
}
}
我还在聊天文档上找到了这个链接,它解释了如何显示基于 UI https://developers.google.com/hangouts/chat/how-tos/cards-onclick 的交互式卡片。但是我无法理解如何将其与 webhook 集成。
更新我遵循了 https://www.leeboonstra.com/Bots/custom-payloads-rich-cards-dialogflow/ 上的教程,并能够使用他们提到的示例代码显示卡片响应。它正在使用这个已弃用的库 ( https://github.com/dialogflow/dialogflow-fulfillment-nodejs )。这是工作的代码,
let payload = new Payload("hangouts", json, {
rawPayload: true,
sendAsMessage: true,
});
agent.add(payload);
这里的json变量应该就是我之前提到的JSON结构。所以现在,我可以使用已弃用的 API 映射到正确的响应格式。但是,我无法获得向后端发送正确响应的按钮 。这是我从之前的 json 修改的按钮字段,
"buttons": [
{
"textButton": {
"text": "Click Me",
"onClick": {
"action": {
"actionMethodName": "snooze",
"parameters": [
{
"key": "time",
"value": "1 day"
},
{
"key": "id",
"value": "123456"
}
]
}
}
}
}
]
最佳答案
据我所知,在使用直接 Dialogflow 集成时无法响应 Google Chat(以前称为 Hangouts Chat)按钮。
问题是按钮响应可以通过以下两种方式之一发送:
onClick.openLink.url
属性,正如您的大部分测试所示。这会将点击它的人带到有问题的 URL。但一旦到达那里,您就会被排除在机器人流程之外。但是,Hangouts Chat integration 的文档with Dialogflow 没有提供有关此事件如何传递给 Dialogflow 的任何信息,我上次测试它时也没有提供任何信息。
您可以使用 Google Chat 的 API 在类似 Cloud Functions 上编写自己的集成或 Apps Script并让您的脚本调用 Dialogflow 的 Detect Intent API以确定用户将触发什么 Intent(并确定回复或调用 webhook 进行额外处理)。在此方案下,您可以选择如何处理 onClick 事件。进行自己的集成也为您提供了一种方法来做 Incoming Webhooks ,这在使用 Dialogflow 集成时是不可能的。
关于dialogflow-es - 使用 dialogflow fulfillment webhook 的 Google 聊天自定义卡片,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63172678/
自从我将 Dialogflow 升级为使用 v2 API 后,出现以下错误: Dialogflow IntentHandler not found for intent: myIntent 由于某些原
PermissionDenied:拒绝了“projects/XXXX-live/agent”上的403 IAM权限“dialogflow.sessions.detectIntent”。 创建服务时,我
基本上,我的代理人是法国人,当我输入 10h(12 小时格式为上午 10 点)时,我的 DialogFlow 代理人理解 22h(晚上 10 点),但我希望他理解上午 10 点。 (我想要 24 小时
我和我的团队正在使用 Dialogflow 为 Facebook Messenger 构建一个机器人,但由于我们的用户不会说同一种语言(西类牙语是项目中的默认语言),我们想要实现我们项目的英文版本,但
我是新来的 DialogFlow ,我开始创建代理,从smaltalk从头开始。问题是如何将更多预构建代理(例如警报和应用程序管理,以及货币转换器)附加到新创建的代理中? 谢谢你的帮助。 最佳答案 您
在 Dialogflow 中,通过扩展设置为自动化的“训练实体”的最佳方法是什么。在训练短语中添加实体和在实体屏幕中简单地添加示例值之间有什么区别吗? Dialogflow 培训是否比另一个更重视?创
我正在尝试训练 Dialogflow 机器人来识别不同的旅行请求(航类预订、酒店预订等)。我发现如果没有将时间指定为 12 小时格式(使用 AM/PM),它就不能正确解析时间。 我需要周六 08:00
我正在使用 webhook 在 dialogflow 上制作一个机器人。我收到一个错误:DEADLINE_EXCEEDED。我的 webhook 需要 5 秒多一点的时间来返回响应。有没有办法允许超过
我正在使用 Dialogflow 为银行创建一个机器人。我想保留与客户代表交谈的选择权。如果客户想与客户代表交谈,机器人应该停止,客户代表开始与客户聊天。在 Dialogflow 中如何实现。 最佳答
每当我输入 6 月 37 日作为输入时,它都不会给出错误,而是将日期视为 6 月 30 日。我想要做的是在输入 6 月 37 日时创建一个错误提示。 我在一个非常简单的意图上使用@sys.date,它
有没有办法以编程方式获取 Dialogflow 代理的对话历史记录? 我使用 Dialogflow 制作了一个聊天机器人。现在我需要以编程方式获取代理的对话历史记录。 最佳答案 That featur
我正在研究 dialogflow 跟进意图。结构是这样的。 它为每个新意图创建新上下文。 例如在重复意图中看到 每当我创建任何新意图时,它都会为其创建新上下文。正如你在图片中看到的那样。当我尝试删除这
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 4 年前。 Improve this qu
例如,如果您有 IntentA 并添加了 2 个后续意图:IntentB、IntentC,它工作正常,它应该添加一个上下文,因为它还没有输出上下文。但这就是问题所在。有时如果你添加另一个,例如 Fal
我正在使用 dialogflow 开发语音助手,我对意图的生命周期有疑问。据我了解,生命周期值为我提供了此意图中可能的交互次数。它在每次交互时递减,当等于 0 时,该值不能被识别为意图的可能值。 生命
我创建了一个聊天机器人,它会通知用户我(大)家庭成员的姓名以及他们的生活地点。我用 MySQL 创建了一个小型数据库,其中存储了这些数据,并在适当的时候使用 PHP 脚本获取它们,具体取决于用户与聊天
我想使用 dialogflow 进行注册。例如:我想让机器人问以下问题: 你叫什么名字?你的邮箱是多少? 等等。 我尝试实现此功能,但无法正确管理意图。我应该怎么做才能实现这一目标?谢谢 最佳答案 首
我希望尽可能生成动态文本而不需要创建 webhook。我知道创建动态文本的唯一方法是根据参数创建不同的路由或通过 using inline system functions像文本实现中的 $sys.f
我使用 创建了一个聊天机器人对话流 并与 集成Telegram、Facebook Messenger 和 Web . Dialogflow 的响应是通过 创建的履行用 Python 编写。 在 Tel
我使用 Dialogflow 创建了多个代理,其中许多都在生产中。但是,Dialogflow 项目突然消失了,现在我只能看到创建新代理的选项。 但是,我看到生产代理运行良好。我通过我创建的连接到 Di
我是一名优秀的程序员,十分优秀!