[Feature] Add Microsoft Teams as an alert notification channel
- Dominant language
- Java
- Stars
- 7.4k
- Forks
- 1.3k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 32
Description
### Feature Request
希望为 HertzBeat 增加 Microsoft Teams 作为告警通知渠道。
我已检索文档、现有 Issues / PRs 和代码:目前没有 Teams / msteams 相关提案或实现。项目已有 Slack、Discord、Webhook、Ntfy 等渠道。#3778 / #4249 只修了通用 Webhook 对 Power Automate URL 的编码问题,并不是 Teams 渠道。
Office 365 Incoming Webhook 已于 2026-05 退役,新实现应对接 Teams Workflows(Power Automate)webhook,发送 Adaptive Card,而不是已下线的 webhook.office.com Incoming Webhook。
如果社区认可,我愿意实现并提交 PR。开始写代码前,想请维护者确认是否接受做成独立通知渠道。
### Is your feature request related to a problem? Please describe
很多企业把告警放在 Teams 频道。现在只能用通用 Webhook 自己拼 JSON,没有 Adaptive Card、严重级别颜色,也没有帮助文档。已经在用 Teams Workflows 的用户,希望在「新增接收人」里能直接选择 Microsoft Teams。
### Describe the solution you'd like
参考现有 Slack / Ntfy,新增独立通知类型:
1. 在 alerter 新增 Teams Handler(建议 type = 16)
2. 接收人只需要 Workflows webhook URL;字段长度至少 1000
3. HTTP 发送必须走 java.net.URI,避免 Power Automate 查询参数被二次编码(同 #4249)
4. 默认把告警渲染成 Adaptive Card(按 severity 上色)
5. 前端表单、i18n、默认模板、中英文帮助文档
6. Handler 单元测试(成功 / 非 2xx / URL 校验 / URI 原样发送)
第一版不引入 Graph API / Bot OAuth。
### Describe alternatives you've considered
1. 仅在文档中说明用 Webhook 对接 Power Automate:能用,但对用户不够友好,也没有 Adaptive Card。
2. 复用 Slack 渠道:URL 域名校验写死 hooks.slack.com,且字段长度只有 300,不能复用。
### Additional context
- Microsoft 官方说明:https://devblogs.microsoft.com/microsoft365dev/retirement-of-office-365-connectors-within-microsoft-teams/
- Workflows 设置:Teams 频道 → Workflows → “Post to a channel when a webhook request is received”
请维护者帮忙确认:
- 是否欢迎做成独立通知渠道?
- 第一版是否只支持 Workflows webhook + Adaptive Card?
- 是否更建议只在文档里写 Webhook 对接方式?
如果方向 OK,我来实现并提交 PR。谢谢。
Contributor guide
Research direction
Start by examining the existing Slack and Ntfy handlers in the alerter, then trace the notification type through the frontend form, i18n, templates, and help documentation. Confirm the Teams Workflows webhook and Adaptive Card scope with maintainers; done should include the new channel, its documented configuration, and handler tests for success, non-2xx responses, URL validation, and URI preservation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend, documentation, frontend, observability-sre
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100