Soenneker.Twilio.RestClient
11.0.2806
Prefix Reserved
dotnet add package Soenneker.Twilio.RestClient --version 11.0.2806
NuGet\Install-Package Soenneker.Twilio.RestClient -Version 11.0.2806
<PackageReference Include="Soenneker.Twilio.RestClient" Version="11.0.2806" />
<PackageVersion Include="Soenneker.Twilio.RestClient" Version="11.0.2806" />
<PackageReference Include="Soenneker.Twilio.RestClient" />
paket add Soenneker.Twilio.RestClient --version 11.0.2806
#r "nuget: Soenneker.Twilio.RestClient, 11.0.2806"
#:package Soenneker.Twilio.RestClient@11.0.2806
#addin nuget:?package=Soenneker.Twilio.RestClient&version=11.0.2806
#tool nuget:?package=Soenneker.Twilio.RestClient&version=11.0.2806
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.919)
- Soenneker.Utils.HttpClientCache (>= 11.0.2164)
- Twilio (>= 8.2.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.2806 | 110 | 11/19/2026 |
| 11.0.2805 | 98 | 11/19/2026 |
| 11.0.2804 | 103 | 11/18/2026 |
| 11.0.2802 | 94 | 11/18/2026 |
| 11.0.2800 | 98 | 11/18/2026 |
| 11.0.2799 | 102 | 11/15/2026 |
| 11.0.2798 | 108 | 11/15/2026 |
| 11.0.2797 | 108 | 11/11/2026 |
| 11.0.2796 | 101 | 11/11/2026 |
| 11.0.2795 | 108 | 11/11/2026 |
| 11.0.2794 | 106 | 11/11/2026 |
| 11.0.2793 | 110 | 11/11/2026 |
| 11.0.2792 | 98 | 11/11/2026 |
| 11.0.2791 | 104 | 11/6/2026 |
| 11.0.2790 | 101 | 11/3/2026 |
| 11.0.2789 | 100 | 11/3/2026 |
| 11.0.2788 | 103 | 11/3/2026 |
| 11.0.2787 | 105 | 11/3/2026 |
| 11.0.2786 | 101 | 11/3/2026 |
| 11.0.2785 | 129 | 10/27/2026 |
Update dependency Soenneker.Utils.HttpClientCache to 11.0.2164 (#3378)