The Twilio C#/.NET SDK makes it easy to interact with the Twilio API from your .NET application. The most recent version of the library can be found on NuGet. The Twilio C# SDK supports .NET applications written in C#, VB.Net, and F# that utilize the .NET Framework version 3.5 or higher or any .NET runtime supporting .NET Standard v1.4. If you are interested in migrating to the newer 5.x version of the Twilio C# SDK from the 4.x version, check out this guide.
If you are building with the .NET Core command line tools, then you can run the following command from within your project directory:
dotnet add package Twilio
Try sending yourself an SMS message, like this:
If you are using the .NET Framework version 4.5.1 or higher or .NET Core 1.0 or higher, you can also make API calls asynchronously:
The library automatically handles paging for you. With the
Read method, you can specify the number of records you want to receive (
limit) and the maximum size you want each page fetch to be (
pageSize). The library will then handle the task for you, fetching new pages under the hood as you iterate over the records.
For more information, view the auto-generated library docs.
DateTime values in the C# helper library are in your local timezone (
Kind=Local). Learn more details here on how to convert this to UTC or set UTC as your default.
Once you're up and running with the C# SDK, you'll find code samples using the latest version in our REST API docs and in the documentation for every Twilio product. You can also find auto-generated library docs for the latest SDK here.
The most recent version of the C# SDK is not API compatible with the previous 4.x version of the C# SDK you may have used in previous Twilio applications. The older version will continue to work, and you will continue to find sample code for this version throughout our documentation. Should you need to install this version with NuGet, you can do so with the following command:
Install-Package Twilio -Version 4.7.2
Note that the 4.x version of the SDK is not compatible with .NET Core.
We'd love to hear your feedback on the C# SDK, and help you past any issues you may encounter. Feel free to drop us a line, and we'll make sure to get you sorted!