webhooks - MS 团队传入 Webhook 生成 400 以发送文本格式
问题描述
我试图使用 curl 将一些来自 Azure DevOps Pipeline 通知的通知发布到 MS 团队频道。我使用了 MS 文档中的 Text Features Adaptive 卡,它无法发布消息。其他自适应卡能够使用以下 curl 命令发布通知。
curl -XPOST -H "Content-type: application/json" -d '{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": “1.0”,
"body": [
{
"type": "TextBlock",
"text": "This is some **bold** text"
},
{
"type": "TextBlock",
"text": "This is some _italic_ text"
},
{
"type": "TextBlock",
"text": "- Bullet \r- List \r",
"wrap": true
},
{
"type": "TextBlock",
"text": "1. Numbered\r2. List\r",
"wrap": true
},
{
"type": "TextBlock",
"text": "Check out"
}
]
}'https://outlook.office.com/webhook/fdb-XXXX-XXXX-XXXX/e966e859-4ec9-497a-b1b8-5e6fadb19404
(sample Income web-Hook)
我收到了无效的 webhook URL 或 HTTP 400 错误请求,并且摘要或文本是必需的消息。MS Teams 自适应卡片能否通过传入的 webhook 通知支持文本功能?
解决方案
是的,它支持“文本”功能。请参阅此处了解更多详情。
这是示例 JSON。
{
"type":"message",
"attachments":[
{
"contentType":"application/vnd.microsoft.card.adaptive",
"contentUrl":null,
"content":{
"$schema":"http://adaptivecards.io/schemas/adaptive-card.json",
"type":"AdaptiveCard",
"version":"1.2",
"body":[
{
"type": "TextBlock",
"text": "For Samples and Templates, see https://adaptivecards.io/samples](https://adaptivecards.io/samples)",
}
]
}
}
]
}
推荐阅读
- xpath - xpath 提取 URL - Scrapy
- sql - 范围内特定杂志的 SQL 计数结果
- java - 向他们发送消息后如何获取电话号码 - 什么是应用意图
- c++ - 创建模板内部 lambda 函数?
- spring-boot - Spring boot (2.0.0 to 2.1.8) & Neo4j-OGM (3.0.1 to 3.1.1) 升级 sessionFactory 问题
- ios - 命令 PhaseScriptExecution 因非零退出代码颤动而失败
- javascript - TypeError:无法在 javascript 中读取 getTotal() 处未定义的属性“减少”
- flutter - 如何在 Flutter 中使用路由制作持久抽屉?
- robotframework - 如何在 RobotFramework 中单击无 id 和无类的按钮 请参见下面的代码
- azure - 天蓝色 - 对“eusaaomssa.blob.core.windows.net”的请求是什么?