Soenneker.Twilio.RestClient
11.0.2831
Prefix Reserved
dotnet add package Soenneker.Twilio.RestClient --version 11.0.2831
NuGet\Install-Package Soenneker.Twilio.RestClient -Version 11.0.2831
<PackageReference Include="Soenneker.Twilio.RestClient" Version="11.0.2831" />
<PackageVersion Include="Soenneker.Twilio.RestClient" Version="11.0.2831" />
<PackageReference Include="Soenneker.Twilio.RestClient" />
paket add Soenneker.Twilio.RestClient --version 11.0.2831
#r "nuget: Soenneker.Twilio.RestClient, 11.0.2831"
#:package Soenneker.Twilio.RestClient@11.0.2831
#addin nuget:?package=Soenneker.Twilio.RestClient&version=11.0.2831
#tool nuget:?package=Soenneker.Twilio.RestClient&version=11.0.2831
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 | net11.0 is compatible. |
-
net11.0
- Soenneker.Extensions.Configuration (>= 11.0.921)
- Soenneker.Utils.HttpClientCache (>= 11.0.2188)
- Twilio (>= 8.3.0)
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 |
|---|---|---|
| 11.0.2831 | 54 | 12/3/2026 |
| 11.0.2830 | 58 | 12/3/2026 |
| 11.0.2829 | 73 | 12/3/2026 |
| 11.0.2828 | 78 | 12/3/2026 |
| 11.0.2827 | 77 | 12/3/2026 |
| 11.0.2826 | 83 | 12/3/2026 |
| 11.0.2825 | 69 | 12/2/2026 |
| 11.0.2824 | 77 | 12/2/2026 |
| 11.0.2823 | 73 | 12/2/2026 |
| 11.0.2822 | 72 | 12/2/2026 |
| 11.0.2821 | 73 | 12/2/2026 |
| 11.0.2820 | 91 | 12/2/2026 |
| 11.0.2819 | 90 | 12/2/2026 |
| 11.0.2818 | 88 | 12/2/2026 |
| 11.0.2817 | 77 | 12/2/2026 |
| 11.0.2816 | 95 | 12/1/2026 |
| 11.0.2815 | 100 | 12/1/2026 |
| 11.0.2814 | 85 | 12/1/2026 |
| 11.0.2813 | 82 | 12/1/2026 |
| 11.0.2812 | 94 | 12/1/2026 |
Updated Multiple NuGet packages