如何更改 MS 团队留言卡的文字颜色

问题描述 投票:0回答:3

我将 AWS Lambda 与 webhook 结合使用以发布到 Teams 频道。如何更改卡片中的文字颜色?

AFAIK,Adaptive Cards 还不是 webhook 的选项。我曾尝试使用消息卡游乐场,但没有用于旧版消息卡的选项,而且我查看过的其他网站也没有文本颜色选项。

我想改变标题的颜色,但是以下没有奏效

我试过的代码:

data = {
            "@context": "https://schema.org/extensions",
            "@type": "MessageCard",
            "themeColor": "0072C6",
            "color": "FF0000",
            "title": self.title + " Severity: " + str(self.severity),
            "text": self.findings + "\n Account: "+self.account+" \nTags: " + json.dumps(self.tags)} ```
webhooks microsoft-teams
3个回答
3
投票

可以通过 HTML 格式设置,例如。在标题或正文中。对我有用

<strong style="color:blue;"> My title </strong>

1
投票

如@Trinetra-MSFT 所述,MS 消息卡中没有更改文本颜色的选项。


0
投票

有可能!使用简单的 html 格式。

json_data = {
    "@type": "MessageCard",
    "themeColor": "0bd700",
    "summary": "Successful Bamboo Deployment",
    "sections": 
    [{
        "activityTitle": '<h1 style="color:green;"> Successful Deployment </h1>',
    }]
}

Click here to see what it does

© www.soinside.com 2019 - 2024. All rights reserved.