Soenneker.Communication.Sms.Client
11.0.1799
Prefix Reserved
See the version list below for details.
dotnet add package Soenneker.Communication.Sms.Client --version 11.0.1799
NuGet\Install-Package Soenneker.Communication.Sms.Client -Version 11.0.1799
<PackageReference Include="Soenneker.Communication.Sms.Client" Version="11.0.1799" />
<PackageVersion Include="Soenneker.Communication.Sms.Client" Version="11.0.1799" />
<PackageReference Include="Soenneker.Communication.Sms.Client" />
paket add Soenneker.Communication.Sms.Client --version 11.0.1799
#r "nuget: Soenneker.Communication.Sms.Client, 11.0.1799"
#:package Soenneker.Communication.Sms.Client@11.0.1799
#addin nuget:?package=Soenneker.Communication.Sms.Client&version=11.0.1799
#tool nuget:?package=Soenneker.Communication.Sms.Client&version=11.0.1799
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 | net11.0 is compatible. |
-
net11.0
- Azure.Communication.Sms (>= 1.0.2)
- Soenneker.Extensions.Configuration (>= 11.0.913)
- Soenneker.Utils.AsyncSingleton (>= 11.0.882)
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 |
|---|---|---|
| 11.0.1805 | 87 | 10/27/2026 |
| 11.0.1804 | 136 | 10/26/2026 |
| 11.0.1802 | 85 | 10/26/2026 |
| 11.0.1801 | 59 | 10/26/2026 |
| 11.0.1800 | 56 | 10/26/2026 |
| 11.0.1799 | 65 | 10/26/2026 |
| 11.0.1798 | 69 | 10/26/2026 |
| 4.0.1797 | 81 | 10/26/2026 |
| 4.0.1796 | 232 | 10/15/2026 |
| 4.0.1795 | 95 | 10/15/2026 |
| 4.0.1794 | 100 | 10/14/2026 |
| 4.0.1793 | 105 | 10/14/2026 |
| 4.0.1792 | 87 | 10/14/2026 |
| 4.0.1790 | 116 | 10/14/2026 |
| 4.0.1789 | 98 | 10/14/2026 |
| 4.0.1788 | 94 | 10/14/2026 |
| 4.0.1783 | 116 | 10/13/2026 |
| 4.0.1782 | 94 | 10/13/2026 |
| 4.0.1780 | 109 | 10/12/2026 |
| 4.0.1778 | 103 | 10/12/2026 |
Update dependency Soenneker.Utils.AsyncSingleton to v11 (#2390)