json - 如何使用 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 发送多行消息的方法是什么?任何指导在这里表示赞赏。
解决方案
请尝试使用\n\n
并检查。
推荐阅读
- c++ - 如何定义全局函数指针并分配给特定地址
- java - 使用 ... extend Thread 在线程内创建方法
- html - 非登录状态时不会出现来自静态文件夹的图像 [Spring MVC & Thymeleaf]
- matrix - 从基本矩阵解释相机矩阵?
- laravel - Guzzle POST 请求总是返回 400 Bad Request
- python - Python Pygame 按两个方向键和另一个键射击没有子弹
- php - 使用 symfony 进程运行 mjml cli
- python - 如何在 PySpark 中进行聚合和转置?
- android - 有时getcount函数在firebase android中返回0
- bash - 无法通过 bash osascript shell 脚本传递名称中带有空格的变量