Ternwire 0.2.0

dotnet add package Ternwire --version 0.2.0
                    
NuGet\Install-Package Ternwire -Version 0.2.0
                    
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="Ternwire" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Ternwire" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="Ternwire" />
                    
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 Ternwire --version 0.2.0
                    
#r "nuget: Ternwire, 0.2.0"
                    
#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 Ternwire@0.2.0
                    
#: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=Ternwire&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=Ternwire&version=0.2.0
                    
Install as a Cake Tool

Ternwire .NET SDK

C# client for the Ternwire transactional email API, targeting .NET 8+. Uses HttpClient and System.Text.Json without third-party dependencies.

dotnet add package Ternwire

Usage

using System.Text.Json.Nodes;
using Ternwire;

using var client = new TernwireClient(apiKey);
var message = await client.SubmitEmailAsync(new JsonObject
{
    ["from"] = "notifications@your-verified-domain.com",
    ["to"] = new JsonArray(JsonValue.Create("recipient@example.com")),
    ["subject"] = "Your receipt",
    ["text"] = "Thanks for your order."
}, "order-123-receipt");

The client sends requests to TernwireClient.DefaultBaseUrl, https://ternwire.com. To use a local or staging API, pass its origin without /v1, and optionally a timeout (default 30 seconds):

using var client = new TernwireClient(apiKey, "http://localhost:3001", TimeSpan.FromSeconds(10));

The origin must use https unless it points at localhost or a loopback address.

All 17 operations have PascalCase names ending in Async. Inputs and responses are JsonObject values with the API's camelCase fields. Template deletion returns null. Every operation accepts an optional final CancellationToken. Reuse a client for its application's lifetime, then dispose it. ListEmailTemplatesAsync(cursor: null, limit: null) returns one page of summaries; pass the previous page.nextCursor as cursor to fetch the next page. Pass a cancellation token to it by name, as in cancellationToken: token.

Catch TernwireApiException to inspect Status, Body, RawBody, and Headers. HttpClient failures and cancellation exceptions propagate separately.

Use Webhooks.Verify(signatureHeader, rawBodyBytes, signingSecret) before parsing the request body. The optional fourth argument is tolerance seconds, default 300.

Set TERNWIRE_API_KEY, TERNWIRE_FROM, and TERNWIRE_TO before deliberately running dotnet run --project examples/Send. It submits an email. Set TERNWIRE_API_ORIGIN only to send to a local or staging API instead of production.

Read the full documentation at ternwire.com/docs, or contact support@ternwire.com. Released under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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.
  • net8.0

    • No dependencies.

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
0.2.0 113 10/15/2026
0.1.0 109 10/15/2026