首页 > 解决方案 > 如何使用 Teams Webhooks 发布多行消息?

问题描述

我有一个 webhook 设置,可以将消息发布到我们的 Teams Team 频道之一。我正在使用此处给出的团队 webhook 示例之一:https ://docs.microsoft.com/en-us/microsoftteams/platform/task-modules-and-cards/cards/cards-reference#hero-card 。

我遇到的问题是我无法显示多行。在下面的示例中,我想在单独的行中分离出“Test1”和“Test2”。但是,在 JSON 中使用 \n 或 \n 不会转换为 Teams 中的多行格式。截图结果附在下面。

    "type": "message",
    "attachments": [
        {
            "contentType": "application/vnd.microsoft.card.hero",
            "content": {
                "title": "Alerts",
                "text": "*Test1 \n *Test\n",
                "buttons": [
                    {
                        "type": "openUrl",
                        "title": "Open in SumoLogic",
                        "value": ""
                    }
                ]
            }
        }
    ]
}

使用 webhook 向 Teams 发送多行消息的方法是什么?任何指导在这里表示赞赏。

目前团队的结果如何

标签: jsonmicrosoft-teams

解决方案


请尝试使用\n\n并检查。


推荐阅读