如何使用 Dialogflow Fulfillment 显示丰富的响应按钮(“筹码”)?

问题描述 投票:0回答:2

根据在线示例,我想尝试使用 Dialogflow Fulfillment 和内联编辑器添加丰富响应按钮和基本卡,但我没有在 Dialogflow Messenger 客户端中呈现任何内容。丰富的回复不完全支持吗? enter image description here

enter image description here

google-cloud-platform dialogflow-es dialogflow-es-fulfillment
2个回答
2
投票

根据自述文件,Dialogflow Fulfillment 库不再维护;因此,您似乎无法直接使用此库在 Dialogflow Messenger 中使用丰富的响应。

基于此,如果您想通过 Dialogflow Messenger 使用丰富的响应,您可以创建一个 webhook 服务。要开始测试此功能,我建议您执行以下操作:

1- 使用 Cloud Functions 创建 HTTP 函数。此文档提到了从 Cloud Console 创建文档的过程。请在第二步中考虑到这一点:

  • 运行时:Python 3.8
  • 入口点:entry_function
  • 在内联编辑器中,复制并粘贴以下代码:
from flask import jsonify
 
def entry_function(request):
 
   response_json = jsonify(
       fulfillment_text="This message is from Dialogflow's testing!",
       fulfillment_messages=[
           {
               "payload": {
                   "richContent": [[{
                       "actionLink": "https://assistant.google.com/",
                       "subtitle": "This is the body text of a card.  You can even use line\n  breaks and emoji! 💁",
                       "title": "Title: this is a card title",
                       "type": "info"
                   }]]
               }
           }
       ]
   )
   return response_json

部署功能。之后,输入您的函数并在“TRIGGER”部分中复制触发器 URL

2- 在 Dialogflow 中启用和管理履行

3- 测试您的 Dialogflow Messenger。

enter image description here


0
投票

为什么所有的丰富消息(筹码)都会进入另一行。我不能把它们合并成一个吗?

© www.soinside.com 2019 - 2024. All rights reserved.