php - 如何格式化 JSON 数据以使用 POSTMAN 或 PHP cURL 以表格格式向 Microsoft Teams 发送消息
问题描述
我有一个特定频道的 MS Teams 的 webhook。我必须以表格格式向该频道发送消息。该表将有一个标题和正文。我可以使用 POSTMAN 和 PHP cURL 向 MS Teams 频道发送简单的短信。
JSON 格式应在此处有效:https ://messagecardplayground.azurewebsites.net
解决方案
您可以使用自适应卡片中的列集来呈现类似卡片的表格
示例:卡片 Json -
{
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.2",
"body": [
{
"type": "ColumnSet",
"columns": [
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "TItle1",
"separator": true
},
{
"type": "TextBlock",
"separator": true,
"text": "body1"
},
{
"type": "TextBlock",
"separator": true,
"text": "body4"
}
],
"width": "stretch",
"style": "accent"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "title2"
},
{
"type": "TextBlock",
"separator": true,
"text": "body2"
},
{
"type": "TextBlock",
"separator": true,
"text": "body5"
}
],
"width": "stretch",
"style": "good"
},
{
"type": "Column",
"items": [
{
"type": "TextBlock",
"weight": "Bolder",
"text": "title3"
},
{
"type": "TextBlock",
"separator": true,
"text": "body3"
},
{
"type": "TextBlock",
"separator": true,
"text": "body6"
}
],
"width": "stretch",
"style": "warning"
}
]
}
]
}
卡片呈现如下:
推荐阅读
- ios - 在带有个人资料图片的条形按钮项目上设置掩码
- groovy - Gremlin 更新现有顶点的元属性
- python - GRU 如何输出以下值?
- python - Selenium:移动元素的奇怪问题(将其拖到另一个元素)
- reactjs - 将通过 JSON 接收的数据共享到其他文件
- javascript - 根据Javascript中的其他属性值过滤对象数组中的前n个值
- regex - 使用 RewriteRule 解析 cookie 和 POST 数据到 SetEnv
- javascript - 在JS中转换数据结构
- kdb - kdb:从 HDB 获取一行
- python - TypeError: 使用 open() 打开文件时需要 str、bytes 或 os.PathLike 对象,而不是 TextIOWrapper