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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.MsTeams.Sender" Version="4.0.1020" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.MsTeams.Sender" Version="4.0.1020" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.MsTeams.Sender" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.MsTeams.Sender --version 4.0.1020
                    
#r "nuget: Soenneker.MsTeams.Sender, 4.0.1020"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.MsTeams.Sender@4.0.1020
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.MsTeams.Sender&version=4.0.1020
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.MsTeams.Sender&version=4.0.1020
                    
Install as a Cake Tool

Soenneker.MsTeams.Sender

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
Loading failed

-hf