【问题标题】:How can send Team ID and Channel id through adaptive card from ms teams app如何通过 ms 团队应用程序中的自适应卡发送团队 ID 和频道 ID
【发布时间】:2022-01-21 14:40:12
【问题描述】:

我正在 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"
                    }
                ],
            }
        ],
    }
],

}

【问题讨论】:

    标签: botframework microsoft-teams adaptive-cards


    【解决方案1】:

    请按照以下步骤动态发送 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://8840-103-132-3-2.ngrok.io/projects/new?teamId=xxxxx-xxxxx-xxxxx",
                            "title": "Link"
                        }
                    ],
                }
            ],
        }
    ],
    }
    
    1. 现在,如果您点击 Adaptive Card 按钮,它会将其重定向到正确的 URL。

    【讨论】:

    • 当我点击链接“无法访问该应用,请稍后再试”时显示错误
    • 您需要提供您在应用程序中配置的正确 URL。
    • 我提供它是正确的,它在 2 天前工作正常,但现在它开始给我错误
    • @usmanimtiaz - 您能否分享您所面临的错误日志?
    • @usmanimtiaz-能否请您重新验证您的配置并测试一次?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-08-13
    • 1970-01-01
    • 2020-10-08
    • 2021-11-26
    • 2019-10-19
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多