CastBricks Docs

Go SDK

Install and use the CastBrick Go SDK

Go SDK

Install:

go get github.com/castbrick/castbrick-go

Initialize:

import (
  "os"
  castbrick "github.com/castbrick/castbrick-go"
)

client := castbrick.New(os.Getenv("CASTBRICK_API_KEY"))

Send email:

resp, err := client.Email.Send(castbrick.EmailRequest{
  From: "no-reply@yourdomain.com",
  To: []string{"alice@example.com"},
  Subject: "Welcome",
  HTML: "<p>Hello Alice</p>",
})

Send SMS:

resp, err := client.SMS.Send(castbrick.SMSRequest{
  From: "+15551234567",
  To: []string{"+15557654321"},
  Body: "Your code is 123456",
})

Handle errors by checking err and inspecting response fields.

On this page