Soenneker.MsTeams.Util
11.0.1367
Prefix Reserved
dotnet add package Soenneker.MsTeams.Util --version 11.0.1367
NuGet\Install-Package Soenneker.MsTeams.Util -Version 11.0.1367
<PackageReference Include="Soenneker.MsTeams.Util" Version="11.0.1367" />
<PackageVersion Include="Soenneker.MsTeams.Util" Version="11.0.1367" />
<PackageReference Include="Soenneker.MsTeams.Util" />
paket add Soenneker.MsTeams.Util --version 11.0.1367
#r "nuget: Soenneker.MsTeams.Util, 11.0.1367"
#:package Soenneker.MsTeams.Util@11.0.1367
#addin nuget:?package=Soenneker.MsTeams.Util&version=11.0.1367
#tool nuget:?package=Soenneker.MsTeams.Util&version=11.0.1367
Soenneker.MsTeams.Util
Builds Adaptive Cards for common notifications and either sends them directly to Teams or places a MsTeamsMessage on Service Bus.
Installation
dotnet add package Soenneker.MsTeams.Util
Configuration
{
"Environment": "Local",
"MsTeams": {
"UseQueue": false,
"Enabled": true,
"Errors": {
"Enabled": true,
"WebhookUrl": "https://example.webhook.office.com/webhookb2/..."
}
}
}
Each channel needs an Enabled setting. Direct sending also needs the sender's global MsTeams:Enabled switch and an absolute HTTPS WebhookUrl. Channel names cannot contain :. Keep webhook URLs in a secret provider.
MsTeams:UseQueue and per-channel Enabled values respond to configuration reloads. Environment is read when the utility is constructed; skipLocal suppresses a send only when that value is Local.
Registration
using Soenneker.MsTeams.Util.Registrars;
builder.Services.AddMsTeamsUtilAsScoped();
// or: builder.Services.AddMsTeamsUtilAsSingleton();
The scoped registration keeps the Teams sender and its underlying HTTP client infrastructure singleton while allowing the higher-level utility and its other scoped dependencies to be disposed with the scope.
Send a notification
using Soenneker.MsTeams.Util.Abstract;
await teams.SendMessage(
title: "Import completed",
channel: "Errors",
summary: "Customer import finished with warnings",
facts: new Dictionary<string, string?>
{
["Imported"] = importedCount.ToString(),
["Rejected"] = rejectedCount.ToString()
},
skipLocal: true,
cancellationToken: cancellationToken);
The exception overload defaults to the Errors channel and the title Exception thrown. SendMessage<T> builds a table from a list, while SendMessageCard accepts an already-built AdaptiveCard.
When UseQueue is false, successful completion means the Teams webhook accepted the card; a rejected send throws InvalidOperationException. When UseQueue is true, successful completion means Service Bus accepted the message, not that Teams delivered it. Disabled channels and skipLocal return without sending.
Exception details, facts, table values, summaries, and additional body text become card content. Remove credentials and personal data before calling these APIs, and account for duplicate notifications if queue delivery is retried.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.AdaptiveCards.Util (>= 11.0.57)
- Soenneker.Enums.DeployEnvironment (>= 11.0.265)
- Soenneker.MsTeams.Sender (>= 11.0.1101)
- Soenneker.ServiceBus.Transmitter (>= 11.0.4045)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Soenneker.MsTeams.Util:
| Package | Downloads |
|---|---|
|
Soenneker.Alerter.Util
A utility library for alert related operations and abstraction over other notification services |
|
|
Soenneker.Coordinators.Alerts
Handling Azure alerts from the controller |
|
|
Soenneker.Runners.Runner
An abstract task runner with methods that typically are executed on some type of schedule. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.1367 | 0 | 11/15/2026 |
| 11.0.1366 | 0 | 11/15/2026 |
| 11.0.1364 | 56 | 11/14/2026 |
| 11.0.1363 | 134 | 11/12/2026 |
| 11.0.1362 | 91 | 11/12/2026 |
| 11.0.1361 | 92 | 11/11/2026 |
| 11.0.1360 | 72 | 11/11/2026 |
| 11.0.1359 | 90 | 11/11/2026 |
| 11.0.1356 | 65 | 11/11/2026 |
| 11.0.1355 | 65 | 11/11/2026 |
| 11.0.1354 | 62 | 11/11/2026 |
| 11.0.1352 | 73 | 11/11/2026 |
| 11.0.1351 | 59 | 11/11/2026 |
| 11.0.1350 | 77 | 11/11/2026 |
| 11.0.1349 | 91 | 11/11/2026 |
| 11.0.1347 | 55 | 11/11/2026 |
| 11.0.1346 | 51 | 11/11/2026 |
| 11.0.1345 | 91 | 11/11/2026 |
| 11.0.1343 | 66 | 11/11/2026 |
| 11.0.1342 | 583 | 11/3/2026 |
Update dependency Soenneker.MsTeams.Sender to 11.0.1101 (#1876)