NetEvolve.HealthPublishers.MicrosoftTeams
1.13.10
Prefix Reserved
dotnet add package NetEvolve.HealthPublishers.MicrosoftTeams --version 1.13.10
NuGet\Install-Package NetEvolve.HealthPublishers.MicrosoftTeams -Version 1.13.10
<PackageReference Include="NetEvolve.HealthPublishers.MicrosoftTeams" Version="1.13.10" />
<PackageVersion Include="NetEvolve.HealthPublishers.MicrosoftTeams" Version="1.13.10" />
<PackageReference Include="NetEvolve.HealthPublishers.MicrosoftTeams" />
paket add NetEvolve.HealthPublishers.MicrosoftTeams --version 1.13.10
#r "nuget: NetEvolve.HealthPublishers.MicrosoftTeams, 1.13.10"
#:package NetEvolve.HealthPublishers.MicrosoftTeams@1.13.10
#addin nuget:?package=NetEvolve.HealthPublishers.MicrosoftTeams&version=1.13.10
#tool nuget:?package=NetEvolve.HealthPublishers.MicrosoftTeams&version=1.13.10
NetEvolve.HealthPublishers.MicrosoftTeams
An IHealthCheckPublisher implementation that pushes HealthReport results to a Microsoft Teams channel, using an incoming webhook or a Power Automate workflow connector, posting an Adaptive Card directly over HTTP.
Features
- Posts a single Adaptive Card per publish, summarizing the overall report status, elapsed time, and a per-check breakdown
- Maps
HealthStatusto an Adaptive Card text color (Healthy→good,Degraded→warning,Unhealthy→attention) - Tags every card with the machine name and a required, free-form
SystemIdentifierto tell instances apart - Configuration- or builder-based setup, consistent with the
NetEvolve.HealthChecks.*conventions - Named registrations to publish to multiple Microsoft Teams channels side by side
- No Microsoft Teams/Bot Framework client dependency - just
HttpClientviaIHttpClientFactory - Debounces notifications instead of posting on every publish: a worsening status is posted immediately, while an improving status must stay sustained for a configurable delay before a "recovery" card is posted
Installation
NuGet Package Manager
Install-Package NetEvolve.HealthPublishers.MicrosoftTeams
.NET CLI
dotnet add package NetEvolve.HealthPublishers.MicrosoftTeams
PackageReference
<PackageReference Include="NetEvolve.HealthPublishers.MicrosoftTeams" Version="x.x.x" />
Quick Start
using NetEvolve.HealthPublishers.MicrosoftTeams;
var builder = services.AddHealthChecks();
builder.AddMicrosoftTeamsPublisher(options =>
{
options.WebhookUrl = new Uri("https://example.webhook.office.com/webhookb2/...");
options.SystemIdentifier = "checkout-service";
});
Usage
Basic Example
Register under the default name ("Default"), configured via code:
var builder = services.AddHealthChecks();
builder.AddMicrosoftTeamsPublisher(options =>
{
options.WebhookUrl = new Uri("https://example.webhook.office.com/webhookb2/..."); // Required
options.SystemIdentifier = "checkout-service"; // Required, tags the card alongside the machine name
});
Notification Behavior
The publisher keeps track of the HealthStatus it last actually posted about (per registered instance) and does not
post a card for every PublishAsync call:
- Same status as last notified: no card is posted.
- Worsening status (e.g.
Healthy→Degraded,Degraded→Unhealthy, orHealthy→Unhealthy): a card is posted immediately, regardless ofRecoveryConfirmationDelay. - Improving status (e.g.
Degraded→Healthy,Unhealthy→Degraded, orUnhealthy→Healthy): the improvement must be sustained for at leastRecoveryConfirmationDelaybefore a "recovery" card is posted. If the status regresses back to the last-notified status before the delay elapses, no card is posted and the delay resets; a later improvement starts a new delay from scratch. If the status regresses to something worse than the last-notified status instead, that is treated as a new worsening event and is posted immediately.
Advanced Example
Register multiple named Microsoft Teams targets, each pushing the same health reports to a different channel:
var builder = services.AddHealthChecks();
builder.AddMicrosoftTeamsPublisher("Ops", options =>
{
options.WebhookUrl = new Uri("https://example.webhook.office.com/webhookb2/ops...");
options.SystemIdentifier = "checkout-service";
});
builder.AddMicrosoftTeamsPublisher("OnCall", options =>
{
options.WebhookUrl = new Uri("https://example.webhook.office.com/webhookb2/oncall...");
options.SystemIdentifier = "checkout-service";
});
Configuration
Code-based
builder.AddMicrosoftTeamsPublisher(options =>
{
options.WebhookUrl = new Uri("https://example.webhook.office.com/webhookb2/..."); // Required
options.SystemIdentifier = "checkout-service"; // Required
options.RecoveryConfirmationDelay = TimeSpan.FromMinutes(10); // Optional, defaults to 5 minutes, minimum 5 minutes
});
appsettings.json-based
builder.AddMicrosoftTeamsPublisher(); // reads the "Default" section below
{
"HealthPublishers": {
"MicrosoftTeams": {
"Default": {
"WebhookUrl": "https://example.webhook.office.com/webhookb2/...",
"SystemIdentifier": "checkout-service",
"RecoveryConfirmationDelay": "00:10:00"
}
}
}
}
When using an explicit name, the section key must match: builder.AddMicrosoftTeamsPublisher("Ops") reads HealthPublishers:MicrosoftTeams:Ops.
Requirements
- .NET 8.0 or higher
- A Microsoft Teams incoming webhook, or a Power Automate workflow configured to receive Adaptive Cards
Related Packages
- NetEvolve.HealthPublishers.Abstractions - Shared abstractions used by all
NetEvolve.HealthPublishers.*packages
Documentation
For complete documentation, please visit the official documentation.
Contributing
Contributions are welcome! Please read the Contributing Guidelines before submitting a pull request.
Support
- Issues: Report bugs or request features on GitHub Issues
- Documentation: Read the full documentation at https://github.com/dailydevops/healthpublishers
License
This project is licensed under the MIT License - see the LICENSE file for details.
Made with ❤️ by the NetEvolve Team Visit us at https://www.daily-devops.net for more information about our services and solutions.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.11)
-
net8.0
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.11)
-
net9.0
- Microsoft.Extensions.Configuration (>= 10.0.11)
- Microsoft.Extensions.Configuration.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Configuration.Binder (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection (>= 10.0.11)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 10.0.11)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 10.0.11)
- Microsoft.Extensions.Http (>= 10.0.11)
- Microsoft.Extensions.Options (>= 10.0.11)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 10.0.11)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.13.10 | 26 | 8/23/2026 |