Soenneker.MsTeams.Sender
4.0.1020
Prefix Reserved
dotnet add package Soenneker.MsTeams.Sender --version 4.0.1020
NuGet\Install-Package Soenneker.MsTeams.Sender -Version 4.0.1020
<PackageReference Include="Soenneker.MsTeams.Sender" Version="4.0.1020" />
<PackageVersion Include="Soenneker.MsTeams.Sender" Version="4.0.1020" />
<PackageReference Include="Soenneker.MsTeams.Sender" />
paket add Soenneker.MsTeams.Sender --version 4.0.1020
#r "nuget: Soenneker.MsTeams.Sender, 4.0.1020"
#:package Soenneker.MsTeams.Sender@4.0.1020
#addin nuget:?package=Soenneker.MsTeams.Sender&version=4.0.1020
#tool nuget:?package=Soenneker.MsTeams.Sender&version=4.0.1020
Soenneker.MsTeams.Sender
Routes Adaptive Card payloads to named Microsoft Teams HTTPS webhooks.
Installation
dotnet add package Soenneker.MsTeams.Sender
Configuration
Configure the feature switch and one webhook per logical channel:
{
"MsTeams": {
"Enabled": true,
"EngineeringAlerts": {
"WebhookUrl": "https://example.webhook.office.com/webhookb2/..."
}
}
}
The webhook must be an absolute HTTPS URL. Treat it as a credential: keep it in a secret provider, do not commit it to source control, and do not include it in logs. Channel names cannot contain :.
Registration
Choose the sender lifetime that matches how webhook configuration is refreshed:
using Soenneker.MsTeams.Sender.Registrars;
builder.Services.AddMsTeamsSenderAsSingleton();
// or: builder.Services.AddMsTeamsSenderAsScoped();
Both registrations keep the underlying HTTP client cache singleton. A scoped sender can be discarded while the shared client remains available. Each sender caches the first webhook URL resolved for a channel, so a singleton sender requires an application restart to pick up a changed URL; a scoped sender resolves it again in a new scope. The MsTeams:Enabled switch is read on every send.
Send a card
using Soenneker.Dtos.MsTeams.Card;
using Soenneker.MsTeams.Sender.Abstract;
public sealed class DeploymentNotifier(IMsTeamsSender teams)
{
public Task<bool> Notify(MsTeamsCard card, CancellationToken cancellationToken) =>
teams.SendCard(card, "EngineeringAlerts", cancellationToken);
}
SendMessage accepts a MsTeamsMessage and reads its MsTeamsCard and Channel fields. SendCard sends the card directly.
The methods return true only for a successful HTTP status. Disabled sending, rate limiting (429), and other non-success responses return false and are logged without response bodies. Configuration errors, serialization failures, transport errors, and cancellation are surfaced as exceptions.
SendMessage disables Hangfire automatic retries through its interface attribute. If delivery must be retried, define an explicit policy that accounts for duplicate webhook delivery and the false result.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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
- Soenneker.Extensions.Configuration (>= 4.0.898)
- Soenneker.Messages.MsTeams (>= 4.0.409)
- Soenneker.Utils.HttpClientCache (>= 4.0.2101)
- Soenneker.Utils.Json (>= 4.0.2735)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on Soenneker.MsTeams.Sender:
| Package | Downloads |
|---|---|
|
Soenneker.MsTeams.Util
A centralized utility for sending rich, configurable Adaptive Card messages to Microsoft Teams channels via a service bus, with environment-aware filtering and dynamic content generation. |
|
|
Soenneker.ServiceBus.Receptors.MsTeams
Consumes Microsoft Teams queue messages and enqueues deserialized payloads for Hangfire-backed webhook delivery. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1020 | 84 | 10/2/2026 |
| 4.0.1018 | 86 | 10/1/2026 |
| 4.0.1017 | 100 | 9/30/2026 |
| 4.0.1016 | 59 | 9/30/2026 |
| 4.0.1015 | 61 | 9/30/2026 |
| 4.0.1014 | 73 | 9/30/2026 |
| 4.0.1013 | 66 | 9/30/2026 |
| 4.0.1012 | 58 | 9/30/2026 |
| 4.0.1011 | 65 | 9/30/2026 |
| 4.0.1010 | 413 | 9/30/2026 |
| 4.0.1009 | 131 | 9/29/2026 |
| 4.0.1008 | 108 | 9/29/2026 |
| 4.0.1007 | 138 | 9/29/2026 |
| 4.0.1006 | 107 | 9/29/2026 |
| 4.0.1005 | 149 | 9/28/2026 |
| 4.0.1004 | 182 | 9/26/2026 |
| 4.0.1003 | 262 | 9/26/2026 |
| 4.0.1002 | 172 | 9/25/2026 |
| 4.0.1001 | 201 | 9/25/2026 |
| 4.0.999 | 151 | 9/25/2026 |
-hf