在 Skype 中获取 dialogflow V2 的轮播列表

Getting carousel list of dialogflow's V2 in Skype

我一直在尝试获取 Skype 上的轮播列表。我使用了中指定的 JSON https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.intents#CarouselSelect 但 Skype 不呈现它或 facebook 信使。如果我使用发送卡片列表 https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.intents#Card 然后 Skype 呈现垂直列表视图,Messenger 呈现轮播列表。轮播 select 在 Dialogflow 的 V1 中使用消息对象正常工作 https://dialogflow.com/docs/reference/agent/message-objects#custom_payload_message_object_2 使用它我能够发送自定义有效负载以获取各个平台,并且还在 V2 中的有效负载中发送它没有帮助。 有没有办法使用 DialogFlow V2 在 Skype 中实现轮播列表?如果可以使用 payload 实现这一点,请回复 JSON.

提前致谢!

终于破解了!

Messenger 中轮播的默认列表视图和 Skype 的默认列表视图是正常的垂直列表视图。对于我看到的有关 Skype 机器人开发的大多数官方文档,Skype 鼓励其开发人员使用定义的库,使用这些库创建 JSON 并将其发送到机器人。另一方面,Messenger 有许多 JSON 格式的资源。

在 DialogFlow V1 中: 在消息对象中,我们可以添加详细信息,例如有效载荷的类型和我们希望将其发送到的平台。更多可以阅读 https://dialogflow.com/docs/reference/agent/message-objects

所以Skype中的轮播是通过添加Skype bot的属性实现的 attachmentType 这指定该项目是否为轮播,否则为普通列表视图。 JSON 格式指定于 https://miningbusinessdata.com/dialogflow-api-ai-skype-integration/

这是将自定义负载数据发送到 Skype bot 的方式。在这里,我们可以发送 attachments 数组中的项目列表以及类型,Skype 将对其进行解释。

在 DialogFlow V2-Beta 中: 我已经确定了 2 种方法,我们可以使用这些方法使用 V2-Beta 将数据发送到 Skype/Messenger。

  1. 使用dialogflow给出的预定义模板 https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.intents#Message 这提供了 card, image, carousel 视图。当 card 个对象的列表发送到 Skype 时,它​​将显示为垂直列表,而当发送到 Messenger 时,它显示为轮播列表。但是,Skype 和 Messenger 似乎不支持 carousel 模板 所以我们剩下的另一个选择是在自定义负载中发送数据。

  2. 为了在自定义负载中发送它,V2 中有 2 个负载。 webHookResponseMessage 对象内部 https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/projects.agent.intents#Message

另一个有效载荷在我们将要发送的 webHookResponse 中。 https://dialogflow.com/docs/reference/api-v2/rest/v2beta1/WebhookResponse

这两个都是 JSON 对象,并且在 Message 对象中发送它实际上有效,并且具有适当的 JSON 格式。作为自定义负载发送时,Skype 的 JSON 格式可用资源非常少。

"platform":"SKYPE",
"payload":
       {
        "skype":
            {
              "attachmentLayout":"carousel",                                                                    
              "attachments":[
                      {        
                        "contentType":"application/vnd.microsoft.card.hero",
                        "content":{
                                    "title":
                                    "subtitle":
                                    "images":[{"url":}],
                                    "buttons":[{
                                        "type":"postBack",
                                        "title": 
                                        "value": 
                                    }]
                          }
                 ]
             }
        }

使用此卡列表发送到 Skype,列表显示为轮播列表。在后来的搜索中我发现 https://tsmatz.wordpress.com/2016/08/31/microsoft-bot-framework-messages-howto-image-html-card-button-etc/ 它有我们可以发送到 Skype

的不同 JSON 列表

编码愉快!