Soenneker.Twilio.RestClient
11.0.2785
Prefix Reserved
dotnet add package Soenneker.Twilio.RestClient --version 11.0.2785
NuGet\Install-Package Soenneker.Twilio.RestClient -Version 11.0.2785
<PackageReference Include="Soenneker.Twilio.RestClient" Version="11.0.2785" />
<PackageVersion Include="Soenneker.Twilio.RestClient" Version="11.0.2785" />
<PackageReference Include="Soenneker.Twilio.RestClient" />
paket add Soenneker.Twilio.RestClient --version 11.0.2785
#r "nuget: Soenneker.Twilio.RestClient, 11.0.2785"
#:package Soenneker.Twilio.RestClient@11.0.2785
#addin nuget:?package=Soenneker.Twilio.RestClient&version=11.0.2785
#tool nuget:?package=Soenneker.Twilio.RestClient&version=11.0.2785
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.914)
- Soenneker.Utils.HttpClientCache (>= 11.0.2139)
- Twilio (>= 8.1.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.2785 | 0 | 10/27/2026 |
| 11.0.2784 | 0 | 10/27/2026 |
| 11.0.2783 | 5 | 10/26/2026 |
| 11.0.2782 | 40 | 10/26/2026 |
| 11.0.2781 | 40 | 10/26/2026 |
| 4.0.2780 | 44 | 10/26/2026 |
| 4.0.2779 | 93 | 10/15/2026 |
| 4.0.2778 | 91 | 10/15/2026 |
| 4.0.2777 | 93 | 10/15/2026 |
| 4.0.2776 | 96 | 10/14/2026 |
| 4.0.2774 | 88 | 10/14/2026 |
| 4.0.2772 | 85 | 10/14/2026 |
| 4.0.2771 | 86 | 10/14/2026 |
| 4.0.2764 | 84 | 10/13/2026 |
| 4.0.2763 | 87 | 10/13/2026 |
| 4.0.2759 | 94 | 10/12/2026 |
| 4.0.2758 | 97 | 10/12/2026 |
| 4.0.2757 | 88 | 10/11/2026 |
| 4.0.2756 | 88 | 10/11/2026 |
| 4.0.2755 | 88 | 10/11/2026 |
Remove redundant framework conditions