CastBricks Docs

C# SDK

Install and use the CastBrick C# (.NET) SDK

C# SDK

Install via NuGet:

dotnet add package CastBrick

Initialize:

using CastBrick;

var client = new CastBrickClient(Environment.GetEnvironmentVariable("CASTBRICK_API_KEY"));

Send email:

var resp = await client.Email.SendAsync(new EmailRequest {
  From = "no-reply@yourdomain.com",
  To = new[] { "alice@example.com" },
  Subject = "Welcome",
  Html = "<p>Hello Alice</p>"
});

Send SMS:

var resp = await client.Sms.SendAsync(new SmsRequest {
  From = "+15551234567",
  To = new[] { "+15557654321" },
  Body = "Your code is 123456"
});

Errors are returned as exceptions with structured error data.

On this page