Zindua for .NET
ASP.NET Core, Azure App Service, Minimal APIs. Send OTP email and WhatsApp with Zindua.Sdk v1.0.1. Same API as Node, PHP, and Python.
Starter project
ASP.NET OTP example
Minimal API sample with email and WhatsApp OTP via Zindua.Sdk. Unzip, set your API key, run with dotnet run.
Server-side only. Never put ZINDUA_API_KEY in Blazor WebAssembly, SPA, or mobile apps. Use ASP.NET Core API routes as a BFF.
Server-side only
ASP.NET Core, Azure App Service, Functions. Never put the API key in Blazor WASM.
Typed validation
Email, E.164 WhatsApp, and template slugs validated locally before the HTTP call.
Email + WhatsApp
One SendAsync for both channels. Same templates as Node, PHP, and Python.
Native HttpClient
IHttpClientFactory + Options pattern. No RestSharp required.
DI ready
services.AddZindua(configuration). Inject IZinduaClient anywhere.
CLI companion
Smoke-test with @zindua/cli before deploying .NET code.
Install and send
Three steps from NuGet to your first OTP.
dotnet add package Zindua.Sdk
# appsettings.json or env
ZINDUA_API_KEY=znd_test_your_key_hereEmail OTP (Minimal API)
using Zindua;
using Zindua.DependencyInjection;
builder.Services.AddZindua(builder.Configuration);
app.MapPost("/auth/otp", async (IZinduaClient zindua, OtpRequest req) =>
{
var result = await zindua.SendAsync(new ZinduaSendOptions
{
To = req.Email,
Template = "otp-verification",
Lang = "en",
Variables = new Dictionary<string, string>
{
["code"] = req.Code,
["appName"] = "MyShop",
},
});
return Results.Ok(new { result.LogId });
});
record OtpRequest(string Email, string Code);WhatsApp OTP
await zindua.SendAsync(new ZinduaSendOptions
{
To = "+243812345678",
Channel = "whatsapp",
Template = "otp-verification",
Variables = new Dictionary<string, string> { ["code"] = "482910" },
});Step by step
Create a Zindua project
Sign up at zindua.run, create a project, copy the API key. Connect email and/or WhatsApp in the dashboard.
Install the SDK
dotnet add package Zindua.Sdk in your ASP.NET Core or worker project.
Register and send
builder.Services.AddZindua(builder.Configuration) then inject IZinduaClient and call SendAsync.
Deploy with secrets
Set ZINDUA_API_KEY in Azure App Settings or User Secrets. Never commit live keys.
Methods
Parity with @zindua/sdk TypeScript.
| Method | Endpoint | Description |
|---|---|---|
| SendAsync() | POST /send | Queue email or WhatsApp message |
| GetProjectAsync() | GET /project | Project, plan, channel status |
| GetTemplatesAsync() | GET /templates | Synced slugs, langs, variables |
| GetLogAsync() | GET /logs/{id} | Delivery status for a logId |
| ConnectAsync() | POST /connect | Bind API key to site URL |
DI and Azure
Dependency injection
// Program.cs
builder.Services.AddZindua(builder.Configuration);
// Or configure inline:
builder.Services.AddZindua(o =>
{
o.ApiKey = builder.Configuration["Zindua:ApiKey"]!;
o.TimeoutMs = 30_000;
});Azure App Service
# Azure App Service: Application settings
ZINDUA_API_KEY=znd_live_xxxxxxxxxxxxxxxxxxxxxxxx
# Or Key Vault reference
ZINDUA_API_KEY=@Microsoft.KeyVault(SecretUri=https://.../secrets/zindua-api-key/)Variables
| Variable | Required | Example | Notes |
|---|---|---|---|
| ZINDUA_API_KEY | Yes | znd_test_xxxxxxxxxxxxxxxxxxxxxxxx | From Dashboard → Projects |
| ZINDUA_API_BASE_URL | No | https://zindua.run/api/v1 | Optional API override |
| ZINDUA_SITE_URL | No | https://myshop.com | For bound keys |
Test first with the CLI
Smoke test your API key before deploying .NET code.
npx @zindua/cli@latest doctor