繁体   English   中英

由传出 webhook 提供的 msteams 的 Adaptive Card 的 messageBack 操作失败,并显示“资源 URL 格式错误”。

[英]Adaptive Card's messageBack action for msteams provided by outgoing webhook fails with "The resource URL is misformatted."

我遵循了扩展 Microsoft Teams 练习 - 创建传出 webhooks 3-exercise-outgoing-webhooks来构建 MS Teams Outgoing webhook,并成功返回了以星球为主题的自适应卡片。

但是,当我按照特定于 Microsoft Teams 频道的特殊自适应卡功能的指导添加新的 messageBack 操作时,它在回复 webhook 时失败。

我使用的添加操作是逐字复制的,并添加到planetDisplayCard.json的操作列表中:

  "actions": [
    {
      "type": "Action.OpenUrl",
      "title": "Learn more on Wikipedia"
    },
    {
      "type": "Action.Submit",
      "title": "Click me for messageBack",
      "data": {
        "msteams": {
            "type": "messageBack",
            "displayText": "I clicked this button",
            "text": "text to bots",
            "value": "{\"bfKey\": \"bfVal\", \"conflictKey\": \"from value\"}"
        }
      }
    }

该卡在 Teams 中呈现,但单击按钮时会发生以下情况:

  • 意外:我们看到Something went wrong. Please try again. Something went wrong. Please try again.
  • 预期:聊天包括显示displayText “我点击了这个按钮”
  • 意外:开发工具报告400代码从POST返回到https://emea.ng.msg.teams.microsoft.com/v1/agents/xxxxxx-xxxx-xxxx-xxxx-redacted/invoke with body {"errorCode":201,"message":"The resource URL is misformatted."}
    • 工具显示请求正文{clientMessageId: "11862533962269802517" conversation: {id: "19:xxxxxxxxxxxxxxxxxxxredacted@thread.skype;messageid=1603494001316"} imdisplayname: "My Name" messageType: "RichText/Media_Card" name: "messageback" serverMessageId: "1603539459992" text: "text to bots" value: {bfKey: "bfVal", conflictKey: "from value"} bfKey: "bfVal" conflictKey: "from value"}

我在自己托管的 webhook 服务的 HeroCard messageBack CardAction 中也看到了同样的问题; 但是在尝试诊断问题时,我在本地开发环境中使用 Yeoman Generator for Microsoft Teams 重现了同样的失败。

一张图来说明我的开发环境出问题了

messageBack操作是否与 MS Teams 中的传出 Webhook 一起使用?

我还没有测试过这个确切的场景,但传出的 webhook 在某些方面与机器人相似,但功能不全,并且据我所知无法处理这样的操作中的多个步骤。 您链接到的“卡片操作”文章基本上在介绍段落中说了同样多的话:

机器人和消息扩展使用的卡片...

因此,我建议为这种情况构建一个成熟的 Teams 机器人。 你可以看看这里开始,当然,如果你被卡住了,可以在 S.overflow 上提出任何问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM