Soenneker.Communication.Sms.Client
4.0.1738
Prefix Reserved
dotnet add package Soenneker.Communication.Sms.Client --version 4.0.1738
NuGet\Install-Package Soenneker.Communication.Sms.Client -Version 4.0.1738
<PackageReference Include="Soenneker.Communication.Sms.Client" Version="4.0.1738" />
<PackageVersion Include="Soenneker.Communication.Sms.Client" Version="4.0.1738" />
<PackageReference Include="Soenneker.Communication.Sms.Client" />
paket add Soenneker.Communication.Sms.Client --version 4.0.1738
#r "nuget: Soenneker.Communication.Sms.Client, 4.0.1738"
#:package Soenneker.Communication.Sms.Client@4.0.1738
#addin nuget:?package=Soenneker.Communication.Sms.Client&version=4.0.1738
#tool nuget:?package=Soenneker.Communication.Sms.Client&version=4.0.1738
Soenneker.Communication.Sms.Client
Provides a lazily created, reusable Azure Communication Services SmsClient through dependency injection.
Installation
dotnet add package Soenneker.Communication.Sms.Client
Configuration
{
"Azure": {
"CommunicationServices": {
"ConnectionString": "<Azure Communication Services connection string>"
}
}
}
Store the connection string in a secret provider rather than source control or a checked-in settings file.
Registration
using Microsoft.Extensions.DependencyInjection;
using Soenneker.Communication.Sms.Client.Registrars;
services.AddSmsClientUtilAsSingleton();
AddSmsClientUtilAsScoped() creates one utility and Azure client per dependency-injection scope.
Usage
using Azure;
using Azure.Communication.Sms;
using Soenneker.Communication.Sms.Client.Abstract;
public sealed class SmsSender
{
private readonly ISmsClientUtil _smsClients;
public SmsSender(ISmsClientUtil smsClients)
{
_smsClients = smsClients;
}
public async ValueTask<SmsSendResult> Send(
string from,
string to,
string message,
CancellationToken cancellationToken)
{
SmsClient client = await _smsClients.Get(cancellationToken);
Response<SmsSendResult> response = await client.SendAsync(
from,
to,
message,
cancellationToken: cancellationToken);
return response.Value;
}
}
The from number must belong to the authenticated Azure Communication Services resource. Use E.164 phone-number formatting where required by Azure and the destination country.
Inspect SmsSendResult.Successful, ErrorMessage, and related result fields; an accepted HTTP request does not make downstream carrier delivery instantaneous or guaranteed.
Lifecycle and behavior
- The first
Getcreates the Azure client fromAzure:CommunicationServices:ConnectionString; later calls return the same client. - The token passed to
Getapplies to lazy initialization. Pass a token to everySmsClientoperation as well. - Azure SDK clients are designed for reuse. Let dependency injection dispose
ISmsClientUtil; do not construct a new client per message. - Azure service failures are thrown as
RequestFailedException. - This package exposes the Azure SDK client directly. Use
Soenneker.Communication.Sms.Utilfor the repository's higher-level SMS sending abstraction. - Avoid logging message bodies, recipient numbers, connection strings, or other communication data unless the application has an explicit redaction and retention policy.
| 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
- Azure.Communication.Sms (>= 1.0.2)
- Soenneker.Extensions.Configuration (>= 4.0.875)
- Soenneker.Utils.AsyncSingleton (>= 4.0.835)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Communication.Sms.Client:
| Package | Downloads |
|---|---|
|
Soenneker.Communication.Sms.Util
A utility library for Azure Communication Services SMS operations |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.1738 | 0 | 9/5/2026 |
| 4.0.1737 | 36 | 9/4/2026 |
| 4.0.1736 | 38 | 9/4/2026 |
| 4.0.1735 | 44 | 9/4/2026 |
| 4.0.1733 | 48 | 9/4/2026 |
| 4.0.1732 | 42 | 9/3/2026 |
| 4.0.1731 | 109 | 8/31/2026 |
| 4.0.1730 | 87 | 8/31/2026 |
| 4.0.1729 | 79 | 8/31/2026 |
| 4.0.1728 | 88 | 8/31/2026 |
| 4.0.1727 | 93 | 8/31/2026 |
| 4.0.1726 | 93 | 8/31/2026 |
| 4.0.1725 | 94 | 8/30/2026 |
| 4.0.1724 | 83 | 8/30/2026 |
| 4.0.1723 | 93 | 8/30/2026 |
| 4.0.1722 | 95 | 8/30/2026 |
| 4.0.1721 | 85 | 8/30/2026 |
| 4.0.1720 | 83 | 8/30/2026 |
| 4.0.1719 | 107 | 8/29/2026 |
| 4.0.1718 | 83 | 8/29/2026 |
Update dependency Soenneker.Extensions.Configuration to 4.0.875 (#2288)