繁体   English   中英

如何通过 ms 团队应用程序中的自适应卡发送团队 ID 和频道 ID

[英]How can send Team ID and Channel id through adaptive card from ms teams app

我正在 ms 团队中创建一个应用程序。 我想动态发送团队 ID 和频道 ID,但是当我在参数中添加团队 ID 时,链接按钮不起作用。 我阅读了很多文档,但找不到任何发送动态值的方法

{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
    {
        "type": "Container",
        "items": [
            {
                "type": "ActionSet",
                "actions": [
                    {
                        "type": "Action.OpenUrl",
                        "url": "https://9056-39-42-13-187.ngrok.io/projects/new?teamId={teamId}",
                        "title": "Link"
                    }
                ],
            }
        ],
    }
],

}

请按照以下步骤动态发送 Team id 和 Channel id:-

  1. 您必须在您的频道中安装机器人
  2. 如果您在频道中发送任何命令或消息,请求将来自服务器,然后您可以从 TurnContext 获取团队和频道 ID 的值并将其绑定到您的自适应卡。
  3. 现在您可以发送自适应卡作为响应,并带有团队 ID:

文本

{
"type": "AdaptiveCard",
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"version": "1.2",
"body": [
    {
        "type": "Container",
        "items": [
            {
                "type": "ActionSet",
                "actions": [
                    {
                        "type": "Action.OpenUrl",
                        "url": "https:// https://8840-103-132-3-2.ngrok.io/projects/new?teamId=xxxxx-xxxxx-xxxxx",
                        "title": "Link"
                    }
                ],
            }
        ],
    }
],
}
  1. 现在,如果您单击 Adaptive Card 按钮,它将重定向到正确的 URL。

暂无
暂无

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

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