如何在传入的 webhook 消息中发送超链接?

How to send a hyperlink in a incoming-webhook message?

我知道我可以在传入的 webhook 中使用 html 和降价,但是当我尝试嵌入 link 时,它不起作用。需要帮助,请

curl -H "Content-Type: application/json" -d "{\"text\": \"<a href=' www.microsoft.com'>visit</a >\"}" <my webhook url> curl -H "Content-Type: application/json" -d "{\"text\": \"[visit](www.microsoft.com)\"}" <my webhook url>

我之前遇到过类似的问题,我发现我可以使用自适应卡。它更强大!以下是示例负载。

{
    "@type": "MessageCard",
    "@context": "http://schema.org/extensions",
    "themeColor": "0076D7",
    "summary": "a summary",
    "sections": [{
        "activityTitle": "A title",
        "activitySubtitle": "a subtitle",
        "markdown": true
    }],
    "potentialAction": [{
        "@type": "ActionCard",
        "name": "Visit",
        "actions": [{
            "@type": "OpenUri",
            "name": "Visit",
                "targets": [
                    { "os": "default", "uri": "https://www.microsoft.com" }
                ]
        }]
    }]
}

可以使用标准降价:

curl --header "Content-Type: application/json" \  
     --data "{\"text\": \"[visit](https://www.microsoft.com)\"}" \  
     <my webhook url>  

请注意,OP 省略了 URI 方案,这会阻止 Teams 将 URL 识别为有效方案。