Soenneker.Twilio.RestClient
4.0.2729
Prefix Reserved
dotnet add package Soenneker.Twilio.RestClient --version 4.0.2729
NuGet\Install-Package Soenneker.Twilio.RestClient -Version 4.0.2729
<PackageReference Include="Soenneker.Twilio.RestClient" Version="4.0.2729" />
<PackageVersion Include="Soenneker.Twilio.RestClient" Version="4.0.2729" />
<PackageReference Include="Soenneker.Twilio.RestClient" />
paket add Soenneker.Twilio.RestClient --version 4.0.2729
#r "nuget: Soenneker.Twilio.RestClient, 4.0.2729"
#:package Soenneker.Twilio.RestClient@4.0.2729
#addin nuget:?package=Soenneker.Twilio.RestClient&version=4.0.2729
#tool nuget:?package=Soenneker.Twilio.RestClient&version=4.0.2729
Soenneker.Twilio.RestClient
Provides a cached, authenticated TwilioRestClient backed by a shared HttpClient.
Installation
dotnet add package Soenneker.Twilio.RestClient
Configuration
{
"Twilio": {
"AccountSid": "AC...",
"AuthToken": "..."
}
}
Registration
using Soenneker.Twilio.RestClient.Registrars;
services.AddTwilioRestClientUtilAsScoped();
Scoped registration creates a TwilioRestClient wrapper per scope while retaining the shared cached HTTP client when a scope ends. Use AddTwilioRestClientUtilAsSingleton() to share the wrapper too; disposing that singleton removes its cached HTTP client.
Send a message
using Soenneker.Twilio.RestClient.Abstract;
using Twilio.Clients;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;
public sealed class MessageSender
{
private readonly ITwilioRestClientUtil _clients;
public MessageSender(ITwilioRestClientUtil clients)
{
_clients = clients;
}
public async ValueTask<string?> Send(string destination, string sender, string body)
{
TwilioRestClient client = await _clients.Get();
MessageResource message = await MessageResource.CreateAsync(
to: new PhoneNumber(destination),
from: new PhoneNumber(sender),
body: body,
client: client);
return message.Sid;
}
}
Pass the returned client explicitly to Twilio SDK resource methods. This avoids relying on the SDK's process-wide static TwilioClient state. Twilio API failures propagate as Twilio SDK exceptions.
| 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.891)
- Soenneker.Utils.HttpClientCache (>= 4.0.2080)
- Twilio (>= 8.0.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.2729 | 33 | 2026/9/13 |
| 4.0.2728 | 41 | 2026/9/13 |
| 4.0.2727 | 35 | 2026/9/13 |
| 4.0.2726 | 40 | 2026/9/13 |
| 4.0.2725 | 40 | 2026/9/13 |
| 4.0.2724 | 46 | 2026/9/13 |
| 4.0.2723 | 41 | 2026/9/13 |
| 4.0.2722 | 50 | 2026/9/12 |
| 4.0.2721 | 38 | 2026/9/12 |
| 4.0.2717 | 46 | 2026/9/10 |
| 4.0.2716 | 67 | 2026/9/9 |
| 4.0.2715 | 77 | 2026/9/9 |
| 4.0.2714 | 99 | 2026/9/9 |
| 4.0.2713 | 83 | 2026/9/9 |
| 4.0.2712 | 76 | 2026/9/8 |
| 4.0.2711 | 86 | 2026/9/8 |
| 4.0.2710 | 78 | 2026/9/8 |
| 4.0.2709 | 81 | 2026/9/8 |
| 4.0.2708 | 86 | 2026/9/7 |
| 4.0.2707 | 99 | 2026/9/7 |
Updated NuGet packages
NuGet-Builder-Operation: 8d95fd267163484887c5332bf25910db