Sendbyte 1.0.0
dotnet add package Sendbyte --version 1.0.0
NuGet\Install-Package Sendbyte -Version 1.0.0
<PackageReference Include="Sendbyte" Version="1.0.0" />
<PackageVersion Include="Sendbyte" Version="1.0.0" />
<PackageReference Include="Sendbyte" />
paket add Sendbyte --version 1.0.0
#r "nuget: Sendbyte, 1.0.0"
#:package Sendbyte@1.0.0
#addin nuget:?package=Sendbyte&version=1.0.0
#tool nuget:?package=Sendbyte&version=1.0.0
Sendbyte .NET SDK
A .NET SDK for the SendByte API.
Status: early development. The SDK currently supports ASP.NET Core dependency injection, typed email sending, email retrieval, email listing, domain registration, domain verification, webhook endpoint management, webhook signature verification, basic validation, and API error handling.
Installation
dotnet add package Sendbyte --prerelease
ASP.NET Core Usage
Register the SDK with dependency injection:
using Sendbyte.DependencyInjection;
builder.Services.AddSendbyte(options =>
{
options.ApiKey = builder.Configuration["Sendbyte:ApiKey"]!;
});
Inject ISendbyteClient into your services:
using Sendbyte;
public sealed class NotificationService
{
private readonly ISendbyteClient _sendbyte;
private readonly ILogger<NotificationService> _logger;
public NotificationService(
ISendbyteClient sendbyte,
ILogger<NotificationService> logger)
{
_sendbyte = sendbyte;
_logger = logger;
}
}
Send an Email
using Sendbyte.Emails.Models;
var response = await _sendbyte.Emails.SendAsync(new SendEmailRequest
{
From = "PayLink <hello@example.com>",
To = new[] { "customer@example.com" },
Subject = "Receipt for ₦45,000",
Html = "<p>Your payment was received.</p>",
Text = "Your payment was received.",
Tags = new[] { "receipt", "payment" },
IdempotencyKey = "order-123-receipt"
});
_logger.LogInformation("Sendbyte accepted email {EmailId}", response.Id);
Retrieve an Email
var email = await _sendbyte.Emails.GetAsync("em_123");
_logger.LogInformation(
"Email {EmailId} has status {Status}",
email.Id,
email.Status);
List Emails
var emails = await _sendbyte.Emails.ListAsync(new ListEmailsRequest
{
Limit = 20,
Status = "delivered"
});
foreach (var email in emails.Data)
{
_logger.LogInformation(
"Email {EmailId} to {RecipientCount} recipient(s) has status {Status}",
email.Id,
email.To.Count,
email.Status);
}
Register a Domain
using Sendbyte.Domains.Models;
var domain = await _sendbyte.Domains.CreateAsync(new CreateDomainRequest
{
Domain = "paylink.ng"
});
foreach (var record in domain.DnsRecords)
{
_logger.LogInformation(
"Publish {Type} record for {Purpose}: {Host} => {Value}",
record.Type,
record.Purpose,
record.Host,
record.Value);
}
Verify a Domain
var verification = await _sendbyte.Domains.VerifyAsync("dom_123");
foreach (var check in verification.Checks)
{
_logger.LogInformation(
"Domain check {Purpose} for {Host}. Required: {Required}. Passed: {Passed}",
check.Purpose,
check.Host,
check.Required,
check.Pass);
}
Create a Webhook Endpoint
The webhook secret is returned only when the endpoint is created. Store it securely and use it for signature verification.
using Sendbyte.Webhooks;
using Sendbyte.Webhooks.Models;
var webhook = await _sendbyte.Webhooks.CreateAsync(new CreateWebhookRequest
{
Url = "https://example.com/webhooks/sendbyte",
Events = new[]
{
WebhookEventTypes.EmailDelivered,
WebhookEventTypes.EmailBounced,
WebhookEventTypes.DomainVerified
}
});
_logger.LogInformation(
"Created Sendbyte webhook {WebhookId}. Store the returned secret securely.",
webhook.Id);
List Webhook Endpoints
List responses do not include webhook secrets.
var webhooks = await _sendbyte.Webhooks.ListAsync();
foreach (var webhook in webhooks.Data)
{
_logger.LogInformation(
"Webhook {WebhookId} posts to {Url}. Disabled: {Disabled}",
webhook.Id,
webhook.Url,
webhook.Disabled);
}
Disable a Webhook Endpoint
await _sendbyte.Webhooks.DisableAsync("wh_123");
_logger.LogInformation("Disabled Sendbyte webhook {WebhookId}", "wh_123");
List Webhook Deliveries
var deliveries = await _sendbyte.Webhooks.ListDeliveriesAsync("wh_123");
foreach (var delivery in deliveries.Data)
{
_logger.LogInformation(
"Webhook delivery {DeliveryId} for {Event} has status {Status}",
delivery.Id,
delivery.Event,
delivery.Status);
}
Replay a Webhook Delivery
var delivery = await _sendbyte.Webhooks.ReplayDeliveryAsync("wd_123");
_logger.LogInformation(
"Replayed Sendbyte webhook delivery {DeliveryId}. Status: {Status}",
delivery.Id,
delivery.Status);
Webhook Signature Verification
Verify SendByte webhooks against the raw request body before trusting the payload.
using Sendbyte.Webhooks;
var isValid = SendbyteWebhookVerifier.VerifySignature(
webhookSecret,
signatureHeader,
rawBody);
if (!isValid)
{
return Results.Unauthorized();
}
The signature header name is available as:
SendbyteWebhookVerifier.SignatureHeader
Error Handling
Non-success API responses throw SendbyteException.
using Sendbyte.Exceptions;
try
{
await _sendbyte.Emails.SendAsync(request);
}
catch (SendbyteException exception)
{
_logger.LogError(
exception,
"Sendbyte request failed. StatusCode: {StatusCode}, Code: {Code}, RequestId: {RequestId}",
exception.StatusCode,
exception.Code,
exception.RequestId);
}
Supported Features
- ASP.NET Core dependency injection
- Transactional email sending
- Retrieve email by ID
- List sent emails
- Register sending domains
- Verify sending domains
- Create webhook endpoints
- List webhook endpoints
- Disable webhook endpoints
- List webhook deliveries
- Replay webhook deliveries
- Webhook signature verification
- Typed request/response models
- Basic request validation
- Basic API error handling
- Idempotency key support
Coming Soon
- Template APIs
- NuGet publishing
Development
Restore, build, and test the solution:
dotnet restore
dotnet build
dotnet test
License
MIT
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- System.Text.Json (>= 8.0.5)
-
net8.0
- Microsoft.Extensions.Http (>= 8.0.0)
- Microsoft.Extensions.Options (>= 8.0.0)
- System.Text.Json (>= 8.0.5)
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 |
|---|---|---|
| 1.0.0 | 101 | 7/4/2026 |