Soenneker.Twilio.RestClient 4.0.2504

Prefix Reserved
dotnet add package Soenneker.Twilio.RestClient --version 4.0.2504
                    
NuGet\Install-Package Soenneker.Twilio.RestClient -Version 4.0.2504
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Soenneker.Twilio.RestClient" Version="4.0.2504" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Soenneker.Twilio.RestClient" Version="4.0.2504" />
                    
Directory.Packages.props
<PackageReference Include="Soenneker.Twilio.RestClient" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Soenneker.Twilio.RestClient --version 4.0.2504
                    
#r "nuget: Soenneker.Twilio.RestClient, 4.0.2504"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Soenneker.Twilio.RestClient@4.0.2504
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Soenneker.Twilio.RestClient&version=4.0.2504
                    
Install as a Cake Addin
#tool nuget:?package=Soenneker.Twilio.RestClient&version=4.0.2504
                    
Install as a Cake Tool

alternate text is missing from this package README image alternate text is missing from this package README image alternate text is missing from this package README image

alternate text is missing from this package README image Soenneker.Twilio.RestClient

An async thread-safe singleton for a Twilio RestClient

Installation

dotnet add package Soenneker.Twilio.RestClient

Why?

This library provides a singleton of a TwilioRestClient.

Internally it implements an HttpClient singleton. This HttpClient has less overhead than new instances of HttpClient and IHttpClientFactory all while correctly handling connection pooling for DNS changes.

See soenneker.utils.httpclientcache for more information.

Usage

  1. Register ITwilioRestClientUtil with DI.
public static async Task Main(string[] args)
{
    ...
    builder.Services.AddTwilioRestClientUtilAsSingleton();
}
  1. Inject ITwilioRestClientUtil via constructor, and retrieve a TwilioRestClient.
public class TestClass
{
    ITwilioRestClientUtil _twilioRestClientUtil;

    public TestClass(ITwilioRestClientUtil twilioRestClientUtil)
    {
        _twilioRestClientUtil = twilioRestClientUtil;
    }

    public async ValueTask SendMessage()
    {
        var message = await MessageResource.CreateAsync(
            new PhoneNumber("+11234567890"),
            from: new PhoneNumber("+10987654321"),
            body: "Hello World!",
            client: await _twilioRestClientUtil.Get()
        );

        Console.WriteLine(message.Sid);
    }
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2504 37 2/28/2026
4.0.2503 32 2/28/2026
4.0.2502 37 2/28/2026
4.0.2501 38 2/28/2026
4.0.2500 35 2/28/2026
4.0.2499 35 2/27/2026
4.0.2498 37 2/27/2026
4.0.2497 35 2/27/2026
4.0.2496 36 2/27/2026
4.0.2495 35 2/27/2026
4.0.2494 35 2/26/2026
4.0.2493 45 2/26/2026
4.0.2492 34 2/26/2026
4.0.2491 88 2/22/2026
4.0.2490 84 2/22/2026
4.0.2489 83 2/22/2026
4.0.2488 87 2/21/2026
4.0.2487 88 2/20/2026
4.0.2486 86 2/20/2026
4.0.2485 89 2/12/2026
Loading failed