wazobiamail

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 11, 2026 License: MIT Imports: 16 Imported by: 0

README

WazobiaMail Go SDK

The official Go client for WazobiaMail — transactional email through an API or SMTP, with sending domains, hosted mailboxes and deliverability tools.

Start free with 3,000 emails/month.

Go Reference Go Report Card

WazobiaMail is a Resend alternative for Go applications: send through the REST API or SMTP, manage verified domains and DNS, provision hosted mailboxes, and inspect delivery, open and click activity.

Install

go get github.com/WazobiaMail/wazobiamail-go@v0.1.0
import wazobiamail "github.com/WazobiaMail/wazobiamail-go"

Requires Go 1.22+ and has no third-party dependencies.

Quick start

package main

import (
	"context"
	"fmt"
	"log"

	wazobiamail "github.com/WazobiaMail/wazobiamail-go"
)

func main() {
	client, err := wazobiamail.NewClient("wz_live_your_api_key")
	if err != nil {
		log.Fatal(err)
	}

	resp, err := client.Messages.Send(context.Background(), wazobiamail.SendMessageRequest{
		To:      []string{"customer@example.com"},
		From:    "Billing <billing@example.com>",
		Subject: "Your receipt",
		HTML:    "<p>Thanks for your order.</p>",
		Text:    "Thanks for your order.",
	})
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println(resp.Data.Result.TrackingID)
}

NewClient reads WAZOBIA_API_KEY or WAZOBIAMAIL_API_KEY when the key is empty, so you can also call wazobiamail.NewClientFromEnv().

Configuration

client, err := wazobiamail.NewClient(
	"wz_live_your_api_key",
	wazobiamail.WithTimeout(15*time.Second),
	wazobiamail.WithUserAgent("my-app/2.0"),
	wazobiamail.WithHeader("X-Trace-Id", requestID),
)
Option Purpose
WithBaseURL Override https://app.wazobiamail.com/api/v1 (staging/proxy/tests).
WithHTTPClient Bring your own *http.Client for tracing, proxies or mocks.
WithTimeout Request timeout; default 30s.
WithAccessToken Authenticate with an account Bearer token instead of X-API-Key.
WithHeader Add a header to every request.
WithAllowUnauthenticated Construct a client for public endpoints without a key.

The *Client is safe for concurrent use. Pass a context.Context to every method for cancellation and deadlines.

Sending email

SendMessageRequest is flat and ergonomic; the SDK builds the canonical nested payload for you.

resp, err := client.Messages.Send(ctx, wazobiamail.SendMessageRequest{
	To:      []string{"ada@example.com", "ops@example.com"},
	Cc:      []string{"finance@example.com"},
	Bcc:     []string{"archive@example.com"},
	From:    "Billing <billing@example.com>",
	Subject: "Invoice INV-2026-001",
	HTML:    "<h1>Invoice</h1><p>Your invoice is attached.</p>",
	Text:    "Invoice attached.",
	ReplyTo: "support@example.com",
	Attachments: []wazobiamail.URLAttachment{
		{URL: "https://cdn.example.com/invoice.pdf", FileName: "invoice.pdf"},
	},
	IdempotencyKey: "invoice-INV-2026-001",
})

Idempotency keys prevent duplicate sends when a request is retried. The API stores the receipt in resp.Data.Result (TrackingID, Status, Recipients).

Binary attachments
resp, err := client.Messages.SendWithAttachments(ctx, message,
	[]wazobiamail.FileUpload{
		{FileName: "invoice.pdf", ContentType: "application/pdf", Content: pdfBytes},
	},
)

Or upload first and use the public URL:

upload, err := client.Messages.UploadAttachment(ctx, wazobiamail.FileUpload{
	FileName: "logo.png",
	ContentType: "image/png",
	Content: logoBytes,
})
fmt.Println(upload.Data.File.PublicURL)

Reading spam-check scores

Messages.SpamCheck returns a penalty score, a threshold, an isSpam boolean and an inverse deliverabilityScore (0–100, higher is better).

score rating isSpam deliverabilityScore Decision
0.0 – 1.9 low_risk false 81 – 100 Okay to send. Clean or only minor findings.
2.0 – 4.9 moderate_risk false 51 – 80 Review first. Fix the highest-point rules before sending.
5.0 + high_risk true 0 – 50 Do not send. Fix the findings and re-run the check.

IsSpam is authoritative: it is true when Score >= Threshold. Read Threshold from the response instead of hard-coding 5.0. A green score is not a delivery guarantee.

report, err := client.Messages.SpamCheck(ctx, wazobiamail.SpamCheckRequest{
	Subject: "Your account summary",
	HTML:    "<p>Your summary is ready.</p>",
	Text:    "Your summary is ready.",
})

if report.Data.IsSpam {
	for _, rule := range report.Data.Rules {
		log.Printf("%s (+%.1f): %s", rule.Code, rule.Points, rule.Recommendation)
	}
}

Full guide: Spam and deliverability scores.

Sending domains and DNS

created, err := client.Domains.Create(ctx, wazobiamail.CreateDomainRequest{
	Domain: "example.com",
})

dns, err := client.Domains.DNSRecords(ctx, created.Data.Domain.ID)
for _, record := range dns.Data.Domain.Records {
	fmt.Printf("%s %s %s\n", record.RecordType, record.Host, record.Value)
}

verified, err := client.Domains.Verify(ctx, created.Data.Domain.ID, true)
fmt.Println(verified.Data.Verification.VerificationStatus)

Available: List, Create, Get, Update, Delete, DNSRecords, Verify, RefreshDNS, and Cloudflare CloudflareStatus, CloudflareConnect, CloudflareSync, CloudflareDisconnect.

Hosted mailboxes

mailbox, err := client.Mailboxes.Create(ctx, wazobiamail.CreateMailboxRequest{
	DomainID:    domainID,
	LocalPart:   "ada",
	DisplayName: "Ada Lovelace",
})

connection, err := client.Mailboxes.Connection(ctx, mailbox.Data.ID)
fmt.Println(connection.Data.SMTP["host"])

messages, err := client.Mailboxes.ListMessages(ctx, mailbox.Data.ID,
	wazobiamail.ListMessagesParams{UnreadOnly: true, Limit: 20})

Also available: List, Get, Update, Delete, CreateCredential, RotateCredential, RevokeCredential, Storage, GetMessage, DeleteMessage.

API keys, SMTP relays and access

key, err := client.APIKeys.Create(ctx, wazobiamail.CreateAPIKeyRequest{
	Name:  "production",
	Scope: "full",
})
fmt.Println(key.Data.APIKey.APIKey) // one-time secret

relay, err := client.SMTP.CreateRelay(ctx, wazobiamail.CreateSMTPRelayRequest{
	Name:         "primary",
	SMTPHost:     "smtp.example.com",
	SMTPPort:     587,
	SMTPUsername: "user",
	SMTPPassword: "password",
	SMTPSecurity: "starttls",
})

access, err := client.SMTP.Access(ctx)
fmt.Println(access.Data.Enabled)

Billing, units, plans and status

invoices, err := client.Billing.ListInvoices(ctx)
pdf, headers, err := client.Billing.DownloadInvoice(ctx, invoiceID)
subscription, err := client.Billing.CurrentSubscription(ctx, "email")

summary, err := client.Units.Summary(ctx)
packs, err := client.Units.Packs(ctx)
ledger, err := client.Units.Ledger(ctx, 1, 25)

plans, err := client.Plans.List(ctx)
limits, err := client.Plans.EffectiveLimits(ctx)
status, err := client.Status.Get(ctx)

Templates and support

template, err := client.Templates.Create(ctx, wazobiamail.CreateTemplateRequest{
	Name:    "Welcome",
	Subject: "Welcome, {{name}}",
	Body:    "<p>Hi {{name}}</p>",
})

preview, err := client.Templates.Preview(ctx, template.Data.ID,
	wazobiamail.PreviewTemplateRequest{SampleVariables: map[string]any{"name": "Ada"}})

ticket, err := client.Support.Create(ctx, wazobiamail.CreateSupportTicketRequest{
	Name:     "Ada",
	Email:    "ada@example.com",
	Subject:  "DNS help",
	Category: "deliverability",
	Priority: "normal",
	Message:  "My domain is still pending.",
})

Templates require Enterprise access (or an admin account). Support tickets can include base64 SupportUpload attachments up to 5 MiB each.

Webhooks

Verify the raw request body before decoding it:

signature := r.Header.Get(wazobiamail.WebhookSignatureHeader)

var event struct {
	Type string `json:"type"`
	Data struct {
		TrackingID string `json:"trackingId"`
	} `json:"data"`
}

if err := client.Webhooks.ConstructEvent(body, signature, secret, &event); err != nil {
	if errors.Is(err, wazobiamail.ErrInvalidWebhookSignature) {
		http.Error(w, "invalid signature", http.StatusUnauthorized)
		return
	}
	http.Error(w, "bad payload", http.StatusBadRequest)
	return
}

VerifySignature accepts the hex HMAC SHA-256 value and an optional sha256= prefix. Sign is useful in tests.

Errors

var apiErr *wazobiamail.APIError
if errors.As(err, &apiErr) {
	switch {
	case apiErr.IsValidation():
		fmt.Println(apiErr.Errors)
	case apiErr.IsRateLimited():
		time.Sleep(apiErr.RetryAfter)
	case apiErr.IsNotFound():
		// ...
	}
}

APIError exposes StatusCode, Message, Code, Errors, Body and RetryAfter. IsUnauthorized, IsForbidden, IsValidation, IsNotFound and IsRateLimited are convenience helpers.

Feature summary

Service Methods
Messages Send, SendWithAttachments, UploadAttachment, SpamCheck, ListTracked, GetTracked, ListEmailLogs
Domains List, Create, Get, Update, Delete, DNSRecords, Verify, RefreshDNS, Cloudflare connect/sync/status/disconnect
Mailboxes List, Create, Get, Update, Delete, credentials, Storage, messages
APIKeys List, Create, Regenerate, Revoke
SMTP relays CRUD/activate/deactivate, Access, UpdateAccess
Billing ListInvoices, DownloadInvoice, CurrentSubscription
Units Summary, Packs, Ledger, Purchase
Plans List, EffectiveLimits
Status Get
Support Create, List, Get, Reply, MarkRead, DownloadAttachment
Templates List, Create, Get, Update, Delete, Preview, SyncMeta
Webhooks VerifySignature, ConstructEvent, Sign

Development

git clone https://github.com/WazobiaMail/wazobiamail-go.git
cd wazobiamail-go
go test -race -cover ./...
go vet ./...
gofmt -l .

License

MIT © Bonifade Technologies

Documentation

Overview

Package wazobiamail is the official Go SDK for the WazobiaMail API.

WazobiaMail is a Resend alternative for transactional email through an API or SMTP, with sending domains, hosted mailboxes and deliverability tools. Start free with 3,000 emails/month.

Index

Constants

View Source
const (
	// Version is the SDK version.
	Version = "0.1.0"
	// DefaultBaseURL is the production WazobiaMail API root.
	DefaultBaseURL = "https://app.wazobiamail.com/api/v1"
	// DefaultTimeout is the default HTTP timeout.
	DefaultTimeout = 30 * time.Second
	// DefaultUserAgent identifies the SDK to the API.
	DefaultUserAgent = "wazobiamail-go/" + Version
)
View Source
const (
	// WebhookSignatureHeader is the header that carries the hex HMAC SHA-256 signature.
	WebhookSignatureHeader = "X-Wazobia-Signature"
	// WebhookSecretEnv is the conventional environment variable for the signing secret.
	WebhookSecretEnv = "WAZOBIA_WEBHOOK_SECRET"
)

Variables

View Source
var ErrInvalidWebhookSignature = errors.New("wazobiamail: invalid webhook signature")

ErrInvalidWebhookSignature is returned when a webhook signature does not match.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Message    string
	Code       string
	Errors     map[string]any
	Body       []byte
	RetryAfter time.Duration
}

APIError is returned for non-2xx API responses.

func (*APIError) Error

func (e *APIError) Error() string

Error implements error.

func (*APIError) IsForbidden

func (e *APIError) IsForbidden() bool

IsForbidden reports whether the API returned 403.

func (*APIError) IsNotFound

func (e *APIError) IsNotFound() bool

IsNotFound reports whether the API returned 404.

func (*APIError) IsRateLimited

func (e *APIError) IsRateLimited() bool

IsRateLimited reports whether the API returned 429.

func (*APIError) IsUnauthorized

func (e *APIError) IsUnauthorized() bool

IsUnauthorized reports whether the API returned 401.

func (*APIError) IsValidation

func (e *APIError) IsValidation() bool

IsValidation reports whether the API returned 422 (or a 400 with field errors).

type APIKey

type APIKey struct {
	ID         string  `json:"id"`
	Name       string  `json:"name"`
	Scope      string  `json:"scope"`
	DomainID   *string `json:"domainId"`
	Domain     *string `json:"domain"`
	KeyPrefix  string  `json:"keyPrefix"`
	LastUsedAt *string `json:"lastUsedAt"`
	ExpiresAt  *string `json:"expiresAt"`
	RevokedAt  *string `json:"revokedAt"`
	CreatedAt  string  `json:"createdAt"`
}

APIKey is a scoped sending API key.

type APIKeyEnvelope

type APIKeyEnvelope struct {
	APIKey CreatedAPIKey `json:"apiKey"`
}

APIKeyEnvelope is {"apiKey":{...}}.

type APIKeysService

type APIKeysService struct {
	// contains filtered or unexported fields
}

APIKeysService manages sending API keys.

func (*APIKeysService) Create

func (*APIKeysService) List

func (*APIKeysService) Regenerate

func (s *APIKeysService) Regenerate(ctx context.Context, keyID string) (*APIResponse[APIKeyEnvelope], error)

func (*APIKeysService) Revoke

func (s *APIKeysService) Revoke(ctx context.Context, keyID string) (*APIResponse[map[string]string], error)

type APIResponse

type APIResponse[T any] struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

APIResponse is the standard WazobiaMail success envelope.

type AccountStatus

type AccountStatus struct {
	Plan  map[string]any `json:"plan"`
	Units map[string]any `json:"units"`
}

AccountStatus is the /status response.

type BillingService

type BillingService struct {
	// contains filtered or unexported fields
}

BillingService reads invoices and subscriptions.

func (*BillingService) CurrentSubscription

func (s *BillingService) CurrentSubscription(ctx context.Context, product string) (*APIResponse[SubscriptionEnvelope], error)

func (*BillingService) DownloadInvoice

func (s *BillingService) DownloadInvoice(ctx context.Context, invoiceID string) ([]byte, http.Header, error)

func (*BillingService) ListInvoices

func (s *BillingService) ListInvoices(ctx context.Context) (*APIResponse[Page[Invoice]], error)

type Client

type Client struct {
	Messages  *MessagesService
	Domains   *DomainsService
	Mailboxes *MailboxesService
	APIKeys   *APIKeysService
	SMTP      *SMTPService
	Billing   *BillingService
	Units     *UnitsService
	Plans     *PlansService
	Status    *StatusService
	Support   *SupportService
	Templates *TemplatesService
	Webhooks  *WebhooksService
	// contains filtered or unexported fields
}

Client is a WazobiaMail API client. It is safe for concurrent use.

func NewClient

func NewClient(apiKey string, options ...Option) (*Client, error)

NewClient creates a client. An empty apiKey falls back to WAZOBIA_API_KEY or WAZOBIAMAIL_API_KEY.

func NewClientFromEnv

func NewClientFromEnv(options ...Option) (*Client, error)

NewClientFromEnv creates a client from WAZOBIA_API_KEY or WAZOBIAMAIL_API_KEY.

func (*Client) BaseURL

func (c *Client) BaseURL() string

BaseURL returns the configured API root.

func (*Client) String

func (c *Client) String() string

String returns a log-safe representation of the client.

type CloudflareConnect

type CloudflareConnect struct {
	AuthorizationURL string `json:"authorizationUrl"`
}

CloudflareConnect is {"authorizationUrl":"..."}.

type CloudflareStatus

type CloudflareStatus struct {
	Connected bool    `json:"connected"`
	ZoneID    *string `json:"zoneId"`
	Domain    *string `json:"domain"`
}

CloudflareStatus describes the Cloudflare DNS connection.

type CloudflareSyncRequest

type CloudflareSyncRequest struct {
	DomainID string `json:"domainId"`
}

CloudflareSyncRequest asks Cloudflare to publish DNS records.

type CloudflareSyncResult

type CloudflareSyncResult struct {
	Zone               string `json:"zone"`
	Added              int    `json:"added"`
	Updated            int    `json:"updated"`
	Records            int    `json:"records"`
	VerificationStatus string `json:"verificationStatus"`
}

CloudflareSyncResult is the sync response.

type CreateAPIKeyRequest

type CreateAPIKeyRequest struct {
	Name      string `json:"name"`
	Scope     string `json:"scope,omitempty"`
	DomainID  string `json:"domainId,omitempty"`
	ExpiresAt string `json:"expiresAt,omitempty"`
}

CreateAPIKeyRequest creates a sending key.

type CreateDomainRequest

type CreateDomainRequest struct {
	Domain                  string `json:"domain"`
	IsDefault               *bool  `json:"isDefault,omitempty"`
	UseRootDomain           *bool  `json:"useRootDomain,omitempty"`
	HostInboxesOnMainDomain *bool  `json:"hostInboxesOnMainDomain,omitempty"`
	SendingSubdomain        string `json:"sendingSubdomain,omitempty"`
	MailMode                string `json:"mailMode,omitempty"`
}

CreateDomainRequest describes a new sending domain.

type CreateMailboxRequest

type CreateMailboxRequest struct {
	DomainID    string `json:"domainId"`
	LocalPart   string `json:"localPart"`
	DisplayName string `json:"displayName,omitempty"`
	Password    string `json:"password,omitempty"`
	QuotaMB     int    `json:"quotaMb,omitempty"`
	Role        string `json:"role,omitempty"`
	Status      string `json:"status,omitempty"`
}

CreateMailboxRequest provisions a mailbox.

type CreateSMTPRelayRequest

type CreateSMTPRelayRequest struct {
	Name         string `json:"name"`
	SMTPHost     string `json:"smtp_host"`
	SMTPPort     int    `json:"smtp_port"`
	SMTPUsername string `json:"smtp_username"`
	SMTPPassword string `json:"smtp_password"`
	SMTPSecurity string `json:"smtp_security"`
	IsDefault    *bool  `json:"is_default,omitempty"`
	Status       string `json:"status,omitempty"`
}

CreateSMTPRelayRequest creates a relay. The request DTO uses snake_case.

type CreateSupportTicketRequest

type CreateSupportTicketRequest struct {
	Name        string          `json:"name"`
	Email       string          `json:"email"`
	Subject     string          `json:"subject"`
	Domain      string          `json:"domain,omitempty"`
	Category    string          `json:"category"`
	Priority    string          `json:"priority"`
	Message     string          `json:"message"`
	ContentType string          `json:"contentType,omitempty"`
	Attachments []SupportUpload `json:"attachments,omitempty"`
}

CreateSupportTicketRequest opens a ticket.

type CreateTemplateRequest

type CreateTemplateRequest struct {
	Name           string `json:"name"`
	Channel        string `json:"channel,omitempty"`
	Category       string `json:"category,omitempty"`
	Subject        string `json:"subject,omitempty"`
	Body           string `json:"body"`
	TextBody       string `json:"textBody,omitempty"`
	Language       string `json:"language,omitempty"`
	Components     any    `json:"components,omitempty"`
	Variables      any    `json:"variables,omitempty"`
	Design         any    `json:"design,omitempty"`
	AutoSubmitMeta bool   `json:"autoSubmitMeta,omitempty"`
	IsSystem       bool   `json:"isSystem,omitempty"`
}

CreateTemplateRequest creates a template.

type CreatedAPIKey

type CreatedAPIKey struct {
	ID        string  `json:"id"`
	Name      string  `json:"name"`
	Scope     string  `json:"scope"`
	DomainID  *string `json:"domainId"`
	KeyPrefix string  `json:"keyPrefix"`
	APIKey    string  `json:"apiKey"`
	ExpiresAt *string `json:"expiresAt"`
}

CreatedAPIKey includes the one-time secret.

type CreatedCredential

type CreatedCredential struct {
	Credential MailboxCredential `json:"credential"`
	Password   string            `json:"password"`
}

CreatedCredential is the inner credential + one-time password.

type CreatedSupportTicket

type CreatedSupportTicket struct {
	ID       string `json:"id"`
	TicketID string `json:"ticketId"`
}

CreatedSupportTicket is the ticket creation receipt.

type CredentialEnvelope

type CredentialEnvelope struct {
	Credential CreatedCredential `json:"credential"`
}

CredentialEnvelope is {"credential":{"credential":...,"password":"..."}}.

type DNSRecord

type DNSRecord struct {
	ID            string  `json:"id"`
	RecordType    string  `json:"recordType"`
	Host          string  `json:"host"`
	Value         string  `json:"value"`
	TTL           int     `json:"ttl"`
	Status        string  `json:"status"`
	LastCheckedAt *string `json:"lastCheckedAt"`
}

DNSRecord is one required DNS record.

type Domain

type Domain struct {
	ID                   string  `json:"id"`
	AccountID            int64   `json:"accountId"`
	Domain               string  `json:"domain"`
	RequestedDomain      *string `json:"requestedDomain"`
	VerificationStatus   string  `json:"verificationStatus"`
	IsDefault            bool    `json:"isDefault"`
	DomainRole           string  `json:"domainRole"`
	ParentDomainID       *string `json:"parentDomainId"`
	CreateDefaultInboxes bool    `json:"createDefaultInboxes"`
	MailMode             string  `json:"mailMode"`
	CreatedAt            string  `json:"createdAt"`
}

Domain is a sending domain.

type DomainDNS

type DomainDNS struct {
	Provisioning       bool        `json:"provisioning"`
	DomainID           string      `json:"domainId"`
	Domain             string      `json:"domain"`
	VerificationStatus string      `json:"verificationStatus"`
	Records            []DNSRecord `json:"records"`
	CopyBlock          string      `json:"copyBlock"`
}

DomainDNS is the DNS payload returned by /dns-records.

type DomainDNSEnvelope

type DomainDNSEnvelope struct {
	Domain DomainDNS `json:"domain"`
}

DomainDNSEnvelope is {"domain":{...}} for DNS records.

type DomainEnvelope

type DomainEnvelope struct {
	Domain Domain `json:"domain"`
}

DomainEnvelope is {"domain":{...}}.

type DomainVerification

type DomainVerification struct {
	DomainID           string              `json:"domainId"`
	Domain             string              `json:"domain"`
	VerificationStatus string              `json:"verificationStatus"`
	VerifiedCount      int                 `json:"verifiedCount"`
	PendingCount       int                 `json:"pendingCount"`
	Checks             []VerificationCheck `json:"checks"`
}

DomainVerification is the /verify result.

type DomainsService

type DomainsService struct {
	// contains filtered or unexported fields
}

DomainsService manages sending domains.

func (*DomainsService) CloudflareConnect

func (s *DomainsService) CloudflareConnect(ctx context.Context, domainID string) (*APIResponse[CloudflareConnect], error)

CloudflareConnect starts the Cloudflare OAuth connection.

func (*DomainsService) CloudflareDisconnect

func (s *DomainsService) CloudflareDisconnect(ctx context.Context, domainID string) (*APIResponse[map[string]any], error)

CloudflareDisconnect removes the Cloudflare DNS connection.

func (*DomainsService) CloudflareStatus

func (s *DomainsService) CloudflareStatus(ctx context.Context, domainID string) (*APIResponse[CloudflareStatus], error)

Cloudflare reads the Cloudflare DNS connection status.

func (*DomainsService) CloudflareSync

func (s *DomainsService) CloudflareSync(ctx context.Context, domainID string) (*APIResponse[CloudflareSyncResult], error)

CloudflareSync publishes DNS records to the connected Cloudflare zone.

func (*DomainsService) Create

func (*DomainsService) DNSRecords

func (s *DomainsService) DNSRecords(ctx context.Context, domainID string) (*APIResponse[DomainDNSEnvelope], error)

func (*DomainsService) Delete

func (s *DomainsService) Delete(ctx context.Context, domainID string) (*APIResponse[map[string]string], error)

func (*DomainsService) Get

func (*DomainsService) List

func (*DomainsService) RefreshDNS

func (s *DomainsService) RefreshDNS(ctx context.Context, domainID string) (*APIResponse[VerificationEnvelope], error)

func (*DomainsService) Update

func (*DomainsService) Verify

func (s *DomainsService) Verify(ctx context.Context, domainID string, force bool) (*APIResponse[VerificationEnvelope], error)

type EffectiveLimits

type EffectiveLimits struct {
	AccountID                  int64  `json:"accountId"`
	PlanID                     string `json:"planId"`
	SendRateLimitPerMinute     int    `json:"sendRateLimitPerMinute"`
	MailboxOpsPerMinute        int    `json:"mailboxOpsPerMinute"`
	MailboxLimit               int    `json:"mailboxLimit"`
	BaseMailboxLimit           int    `json:"baseMailboxLimit"`
	AdditionalMailboxLimit     int    `json:"additionalMailboxLimit"`
	CustomDomainSendingEnabled bool   `json:"customDomainSendingEnabled"`
	DomainLimit                int    `json:"domainLimit"`
	ReceivingEnabled           bool   `json:"receivingEnabled"`
	MailboxStorageGB           int    `json:"mailboxStorageGb"`
}

EffectiveLimits is the resolved account limits.

type EmailAddress

type EmailAddress struct {
	Name  *string `json:"name"`
	Email string  `json:"email"`
}

EmailAddress is a name/address pair.

type EmailLog

type EmailLog struct {
	ID         string  `json:"id"`
	TrackingID string  `json:"trackingId"`
	Recipient  *string `json:"recipient"`
	Subject    *string `json:"subject"`
	Status     string  `json:"status"`
	CreatedAt  string  `json:"createdAt"`
}

EmailLog is a customer-visible delivery log row.

type EmailLogParams

type EmailLogParams struct {
	Limit  int
	Offset int
	Status string
	From   string
	To     string
}

EmailLogParams filters account email logs.

type EmailLogs

type EmailLogs struct {
	Available             bool       `json:"available"`
	Messages              []EmailLog `json:"messages"`
	HasMore               bool       `json:"hasMore"`
	EventDetailsAvailable bool       `json:"eventDetailsAvailable"`
}

EmailLogs is the email logs response.

type FileUpload

type FileUpload struct {
	FileName    string
	ContentType string
	Content     []byte
}

FileUpload is a binary attachment for the multipart send endpoint.

type InboxAttachment

type InboxAttachment struct {
	BlobID    string `json:"blobId"`
	Name      string `json:"name"`
	Type      string `json:"type"`
	SizeBytes int64  `json:"sizeBytes"`
}

InboxAttachment is an attachment on an inbox message.

type InboxMessage

type InboxMessage struct {
	ID             string         `json:"id"`
	ThreadID       *string        `json:"threadId"`
	Subject        *string        `json:"subject"`
	Preview        *string        `json:"preview"`
	From           []EmailAddress `json:"from"`
	To             []EmailAddress `json:"to"`
	ReceivedAt     *string        `json:"receivedAt"`
	IsUnread       bool           `json:"isUnread"`
	HasAttachments bool           `json:"hasAttachments"`
	SizeBytes      int64          `json:"sizeBytes"`
}

InboxMessage is a headless inbox message summary.

type InboxMessageDetail

type InboxMessageDetail struct {
	InboxMessage
	CC          []EmailAddress    `json:"cc"`
	BCC         []EmailAddress    `json:"bcc"`
	ReplyTo     []EmailAddress    `json:"replyTo"`
	HTMLBody    *string           `json:"htmlBody"`
	TextBody    *string           `json:"textBody"`
	Attachments []InboxAttachment `json:"attachments"`
}

InboxMessageDetail includes bodies and attachments.

type Invoice

type Invoice struct {
	ID        string         `json:"id"`
	AccountID int64          `json:"accountId"`
	Amount    float64        `json:"amount"`
	Currency  string         `json:"currency"`
	Status    string         `json:"status"`
	Purpose   string         `json:"purpose"`
	Metadata  map[string]any `json:"metadata"`
	DueDate   *string        `json:"dueDate"`
	PaidAt    *string        `json:"paidAt"`
	CreatedAt string         `json:"createdAt"`
}

Invoice is a billing invoice.

type Items

type Items[T any] struct {
	Items []T `json:"items"`
}

Items is a collection envelope used by endpoints that return {"items":[...]}.

type LimitsEnvelope

type LimitsEnvelope struct {
	Limits EffectiveLimits `json:"limits"`
}

LimitsEnvelope is {"limits":{...}}.

type ListMessagesParams

type ListMessagesParams struct {
	Page       int
	Limit      int
	UnreadOnly bool
	Search     string
}

ListMessagesParams filters inbox messages.

type Mailbox

type Mailbox struct {
	ID                  string  `json:"id"`
	DomainID            string  `json:"domainId"`
	Address             string  `json:"address"`
	LocalPart           string  `json:"localPart"`
	DisplayName         *string `json:"displayName"`
	Status              string  `json:"status"`
	IsPlatformSubdomain bool    `json:"isPlatformSubdomain"`
	AutoProvisioned     bool    `json:"autoProvisioned"`
	Role                string  `json:"role"`
	CreatedAt           string  `json:"createdAt"`
	UpdatedAt           string  `json:"updatedAt"`
}

Mailbox is a hosted mailbox.

type MailboxConnection

type MailboxConnection struct {
	MailboxID      string         `json:"mailboxId"`
	DomainID       string         `json:"domainId"`
	Username       string         `json:"username"`
	Status         string         `json:"status"`
	SMTP           map[string]any `json:"smtp"`
	IMAP           map[string]any `json:"imap"`
	POP3           map[string]any `json:"pop3"`
	Authentication string         `json:"authentication"`
	PasswordHint   string         `json:"passwordHint"`
}

MailboxConnection contains client settings.

type MailboxCredential

type MailboxCredential struct {
	ID        string  `json:"id"`
	MailboxID string  `json:"mailboxId"`
	Username  string  `json:"username"`
	ExpiresAt *string `json:"expiresAt"`
	RevokedAt *string `json:"revokedAt"`
	CreatedAt string  `json:"createdAt"`
}

MailboxCredential is an SMTP/IMAP credential.

type MailboxEnvelope

type MailboxEnvelope struct {
	Mailbox Mailbox `json:"mailbox"`
}

MailboxEnvelope is {"mailbox":{...}}.

type MailboxMessages

type MailboxMessages struct {
	Items []InboxMessage `json:"items"`
	Total int            `json:"total"`
	Page  int            `json:"page"`
	Limit int            `json:"limit"`
}

MailboxMessages is the inbox list response.

type MailboxesService

type MailboxesService struct {
	// contains filtered or unexported fields
}

MailboxesService manages hosted mailboxes and enterprise inboxes.

func (*MailboxesService) Connection

func (s *MailboxesService) Connection(ctx context.Context, mailboxID string) (*APIResponse[MailboxConnection], error)

func (*MailboxesService) Create

func (*MailboxesService) CreateCredential

func (s *MailboxesService) CreateCredential(ctx context.Context, mailboxID string) (*APIResponse[CredentialEnvelope], error)

func (*MailboxesService) Delete

func (s *MailboxesService) Delete(ctx context.Context, mailboxID string) (*APIResponse[map[string]string], error)

func (*MailboxesService) DeleteMessage

func (s *MailboxesService) DeleteMessage(ctx context.Context, mailboxID, messageID string) (*APIResponse[map[string]any], error)

func (*MailboxesService) Get

func (*MailboxesService) GetMessage

func (s *MailboxesService) GetMessage(ctx context.Context, mailboxID, messageID string) (*APIResponse[InboxMessageDetail], error)

func (*MailboxesService) List

func (*MailboxesService) ListMessages

func (s *MailboxesService) ListMessages(ctx context.Context, mailboxID string, params ListMessagesParams) (*APIResponse[MailboxMessages], error)

func (*MailboxesService) RevokeCredential

func (s *MailboxesService) RevokeCredential(ctx context.Context, mailboxID, credentialID string) (*APIResponse[map[string]string], error)

func (*MailboxesService) RotateCredential

func (s *MailboxesService) RotateCredential(ctx context.Context, mailboxID string) (*APIResponse[CredentialEnvelope], error)

func (*MailboxesService) Storage

func (s *MailboxesService) Storage(ctx context.Context) (*APIResponse[map[string]any], error)

func (*MailboxesService) Update

type MessagesService

type MessagesService struct {
	// contains filtered or unexported fields
}

MessagesService sends transactional email and reads tracking/log data.

func (*MessagesService) GetTracked

func (s *MessagesService) GetTracked(ctx context.Context, trackingID string) (*APIResponse[TrackingDetail], error)

GetTracked reads a tracked message and its event timeline.

func (*MessagesService) ListEmailLogs

func (s *MessagesService) ListEmailLogs(ctx context.Context, params EmailLogParams) (*APIResponse[EmailLogs], error)

ListEmailLogs reads customer-visible delivery logs.

func (*MessagesService) ListTracked

ListTracked lists tracked outgoing messages.

func (*MessagesService) Send

Send sends an email and returns its tracking receipt.

func (*MessagesService) SendWithAttachments

func (s *MessagesService) SendWithAttachments(ctx context.Context, req SendMessageRequest, files []FileUpload) (*APIResponse[SendEnvelope], error)

SendWithAttachments sends a message with binary file parts.

func (*MessagesService) SpamCheck

SpamCheck runs a pre-flight spam and deliverability analysis.

func (*MessagesService) UploadAttachment

func (s *MessagesService) UploadAttachment(ctx context.Context, file FileUpload) (*APIResponse[UploadedFileEnvelope], error)

UploadAttachment uploads a file and returns its public URL.

type Option

type Option func(*Client) error

Option configures a Client.

func WithAccessToken

func WithAccessToken(token string) Option

WithAccessToken authenticates with an account Bearer token instead of an API key.

func WithAllowUnauthenticated

func WithAllowUnauthenticated(allow bool) Option

WithAllowUnauthenticated permits construction without a key for public endpoints such as plans and status.

func WithBaseURL

func WithBaseURL(baseURL string) Option

WithBaseURL overrides the API base URL.

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

WithHTTPClient uses a custom *http.Client (useful for proxies, tracing and tests).

func WithHeader

func WithHeader(name, value string) Option

WithHeader adds a header sent with every request.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the request timeout.

func WithUserAgent

func WithUserAgent(userAgent string) Option

WithUserAgent overrides the User-Agent header.

type Page

type Page[T any] struct {
	Items      []T        `json:"items"`
	Pagination Pagination `json:"pagination"`
}

Page is a paginated collection envelope.

type Pagination

type Pagination struct {
	Page       int  `json:"page"`
	PageSize   int  `json:"pageSize"`
	TotalItems int  `json:"totalItems"`
	TotalPages int  `json:"totalPages"`
	HasNext    bool `json:"hasNext"`
	HasPrev    bool `json:"hasPrev"`
}

Pagination is the API pagination metadata.

type Plan

type Plan struct {
	ID                     string   `json:"id"`
	Name                   string   `json:"name"`
	USDPrice               float64  `json:"usdPrice"`
	NairaPrice             float64  `json:"nairaPrice"`
	YearlyUSDPrice         *float64 `json:"yearlyUsdPrice"`
	YearlyNairaPrice       *float64 `json:"yearlyNairaPrice"`
	HourlyQuota            int      `json:"hourlyQuota"`
	DailyQuota             int      `json:"dailyQuota"`
	MonthlyQuota           int      `json:"monthlyQuota"`
	SendRateLimitPerMinute int      `json:"sendRateLimitPerMinute"`
	DataRetentionDays      int      `json:"dataRetentionDays"`
	Features               any      `json:"features"`
	Limits                 any      `json:"limits"`
	Status                 string   `json:"status"`
}

Plan is a subscription plan.

type PlansService

type PlansService struct {
	// contains filtered or unexported fields
}

PlansService reads plans and limits.

func (*PlansService) EffectiveLimits

func (s *PlansService) EffectiveLimits(ctx context.Context) (*APIResponse[LimitsEnvelope], error)

func (*PlansService) List

func (s *PlansService) List(ctx context.Context) (*APIResponse[Page[Plan]], error)

type PreviewTemplateRequest

type PreviewTemplateRequest struct {
	SampleVariables map[string]any `json:"sampleVariables,omitempty"`
}

PreviewTemplateRequest renders with sample variables.

type PurchaseUnitsRequest

type PurchaseUnitsRequest struct {
	PackID   string `json:"packId"`
	Currency string `json:"currency"`
}

PurchaseUnitsRequest buys a credit pack.

type ReplySupportTicketRequest

type ReplySupportTicketRequest struct {
	Message     string          `json:"message"`
	ContentType string          `json:"contentType,omitempty"`
	Attachments []SupportUpload `json:"attachments,omitempty"`
}

ReplySupportTicketRequest replies to a ticket.

type SMTPAccess

type SMTPAccess struct {
	Paid       bool            `json:"paid"`
	Eligible   bool            `json:"eligible"`
	Enabled    bool            `json:"enabled"`
	Persona    *string         `json:"persona"`
	Configured bool            `json:"configured"`
	Connection *SMTPConnection `json:"connection"`
}

SMTPAccess is the account SMTP access snapshot.

type SMTPConnection

type SMTPConnection struct {
	Host      string   `json:"host"`
	Port      int      `json:"port"`
	Security  string   `json:"security"`
	Usernames []string `json:"usernames"`
}

SMTPConnection is the SMTP access connection block.

type SMTPRelay

type SMTPRelay struct {
	ID           string `json:"id"`
	AccountID    int64  `json:"accountId"`
	Name         string `json:"name"`
	SMTPHost     string `json:"smtpHost"`
	SMTPPort     int    `json:"smtpPort"`
	SMTPUsername string `json:"smtpUsername"`
	SMTPSecurity string `json:"smtpSecurity"`
	Status       string `json:"status"`
	IsDefault    bool   `json:"isDefault"`
	HasPassword  bool   `json:"hasPassword"`
	CreatedAt    string `json:"createdAt"`
	UpdatedAt    string `json:"updatedAt"`
}

SMTPRelay is a customer SMTP relay configuration.

type SMTPRelayEnvelope

type SMTPRelayEnvelope struct {
	SMTPRelay SMTPRelay `json:"smtpRelay"`
}

SMTPRelayEnvelope is {"smtpRelay":{...}}.

type SMTPRelaysEnvelope

type SMTPRelaysEnvelope struct {
	SMTPRelays []SMTPRelay `json:"smtpRelays"`
}

SMTPRelaysEnvelope is {"smtpRelays":[...]}.

type SMTPService

type SMTPService struct {
	// contains filtered or unexported fields
}

SMTPService groups relay and access management.

func (*SMTPService) Access

func (s *SMTPService) Access(ctx context.Context) (*APIResponse[SMTPAccess], error)

func (*SMTPService) ActivateRelay

func (s *SMTPService) ActivateRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)

func (*SMTPService) CreateRelay

func (*SMTPService) DeactivateRelay

func (s *SMTPService) DeactivateRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)

func (*SMTPService) DeleteRelay

func (s *SMTPService) DeleteRelay(ctx context.Context, relayID string) (*APIResponse[map[string]string], error)

func (*SMTPService) GetRelay

func (s *SMTPService) GetRelay(ctx context.Context, relayID string) (*APIResponse[SMTPRelayEnvelope], error)

func (*SMTPService) ListRelays

func (*SMTPService) UpdateAccess

func (s *SMTPService) UpdateAccess(ctx context.Context, enabled bool) (*APIResponse[map[string]bool], error)

func (*SMTPService) UpdateRelay

type SendEnvelope

type SendEnvelope struct {
	Result SendResult `json:"result"`
}

SendEnvelope is the data envelope for a send response: {"result": {...}}.

type SendMessageRequest

type SendMessageRequest struct {
	To             []string        `json:"-"`
	Cc             []string        `json:"-"`
	Bcc            []string        `json:"-"`
	From           string          `json:"-"`
	Subject        string          `json:"-"`
	HTML           string          `json:"-"`
	Text           string          `json:"-"`
	ReplyTo        string          `json:"-"`
	EnvelopeSender string          `json:"-"`
	Attachments    []URLAttachment `json:"-"`
	IdempotencyKey string          `json:"-"`
}

SendMessageRequest is the ergonomic send payload. The SDK converts it to the canonical nested content contract.

type SendResult

type SendResult struct {
	Status     string `json:"status"`
	TrackingID string `json:"trackingId"`
	Recipients int    `json:"recipients"`
}

SendResult is the receipt returned by the send endpoint.

type SpamCheckRequest

type SpamCheckRequest struct {
	Subject string            `json:"subject"`
	HTML    string            `json:"html,omitempty"`
	Text    string            `json:"text,omitempty"`
	From    string            `json:"from,omitempty"`
	ReplyTo string            `json:"replyTo,omitempty"`
	Headers map[string]string `json:"headers,omitempty"`
}

SpamCheckRequest is a pre-flight spam/deliverability analysis request.

type SpamCheckResult

type SpamCheckResult struct {
	Score               float64    `json:"score"`
	Threshold           float64    `json:"threshold"`
	IsSpam              bool       `json:"isSpam"`
	Rating              string     `json:"rating"`
	BadgeColor          string     `json:"badgeColor"`
	DeliverabilityScore int        `json:"deliverabilityScore"`
	Summary             string     `json:"summary"`
	Rules               []SpamRule `json:"rules"`
}

SpamCheckResult is a spam/deliverability report.

type SpamRule

type SpamRule struct {
	Code           string  `json:"code"`
	Points         float64 `json:"points"`
	Title          string  `json:"title"`
	Description    string  `json:"description"`
	Recommendation string  `json:"recommendation"`
}

SpamRule is a single finding from the spam scanner.

type StatusService

type StatusService struct {
	// contains filtered or unexported fields
}

StatusService reads account health.

func (*StatusService) Get

type Subscription

type Subscription struct {
	ID              string         `json:"id"`
	AccountID       int64          `json:"accountId"`
	PlanID          string         `json:"planId"`
	Status          string         `json:"status"`
	StartDate       string         `json:"startDate"`
	EndDate         *string        `json:"endDate"`
	AutoRenew       bool           `json:"autoRenew"`
	BillingInterval string         `json:"billingInterval"`
	Plan            map[string]any `json:"plan"`
}

Subscription is the current subscription.

type SubscriptionEnvelope

type SubscriptionEnvelope struct {
	Subscription *Subscription `json:"subscription"`
}

SubscriptionEnvelope is {"subscription":{...}|null}.

type SuccessResponse

type SuccessResponse struct {
	Success bool   `json:"success"`
	Message string `json:"message"`
}

SuccessResponse is returned by endpoints that only acknowledge an action.

type SupportAttachment

type SupportAttachment struct {
	ID          string `json:"id"`
	Filename    string `json:"filename"`
	ContentType string `json:"contentType"`
	SizeBytes   int64  `json:"sizeBytes"`
	URL         string `json:"url"`
}

SupportAttachment is a ticket attachment reference.

type SupportListParams

type SupportListParams struct {
	Status     string
	Page       int
	Limit      int
	Sort       string
	Descending bool
}

SupportListParams filters tickets.

type SupportMessage

type SupportMessage struct {
	ID          string              `json:"id"`
	TicketID    string              `json:"ticketId"`
	SenderName  string              `json:"senderName"`
	SenderEmail string              `json:"senderEmail"`
	Message     string              `json:"message"`
	IsFromStaff bool                `json:"isFromStaff"`
	ContentType string              `json:"contentType"`
	Attachments []SupportAttachment `json:"attachments"`
	CreatedAt   string              `json:"createdAt"`
}

SupportMessage is one message in a ticket thread.

type SupportService

type SupportService struct {
	// contains filtered or unexported fields
}

SupportService manages support tickets.

func (*SupportService) DownloadAttachment

func (s *SupportService) DownloadAttachment(ctx context.Context, attachmentID string) ([]byte, http.Header, error)

func (*SupportService) Get

func (s *SupportService) Get(ctx context.Context, ticketID string) (*APIResponse[SupportTicket], error)

func (*SupportService) List

func (*SupportService) MarkRead

func (s *SupportService) MarkRead(ctx context.Context, ticketID string) (*APIResponse[map[string]any], error)

func (*SupportService) Reply

type SupportTicket

type SupportTicket struct {
	ID             string           `json:"id"`
	AccountID      *int64           `json:"accountId"`
	Name           string           `json:"name"`
	Email          string           `json:"email"`
	Subject        string           `json:"subject"`
	Domain         *string          `json:"domain"`
	Category       string           `json:"category"`
	Priority       string           `json:"priority"`
	Status         string           `json:"status"`
	Messages       []SupportMessage `json:"messages"`
	CustomerReadAt *string          `json:"customerReadAt"`
	StaffReadAt    *string          `json:"staffReadAt"`
	CreatedAt      string           `json:"createdAt"`
	UpdatedAt      string           `json:"updatedAt"`
}

SupportTicket is a support ticket with its thread.

type SupportTicketList

type SupportTicketList struct {
	Items []SupportTicket `json:"items"`
	Total int64           `json:"total"`
	Page  int             `json:"page"`
	Pages int             `json:"pages"`
}

SupportTicketList is the paginated ticket list.

type SupportUpload

type SupportUpload struct {
	Filename string `json:"filename"`
	Data     string `json:"data"`
}

SupportUpload is an inline base64 attachment (max 5 MiB per file).

type Template

type Template struct {
	ID               string  `json:"id"`
	AccountID        *int64  `json:"accountId"`
	Name             string  `json:"name"`
	Slug             string  `json:"slug"`
	Channel          string  `json:"channel"`
	Category         string  `json:"category"`
	Status           string  `json:"status"`
	RejectionReason  *string `json:"rejectionReason"`
	Subject          string  `json:"subject"`
	Body             string  `json:"body"`
	TextBody         string  `json:"textBody"`
	MetaTemplateID   *string `json:"metaTemplateId"`
	MetaTemplateName *string `json:"metaTemplateName"`
	Language         string  `json:"language"`
	Components       any     `json:"components"`
	Variables        any     `json:"variables"`
	Design           any     `json:"design"`
	PreviewImageURL  *string `json:"previewImageUrl"`
	IsSystem         bool    `json:"isSystem"`
	Revision         int     `json:"revision"`
	CreatedAt        string  `json:"createdAt"`
	UpdatedAt        string  `json:"updatedAt"`
}

Template is an email/WhatsApp template.

type TemplateList

type TemplateList struct {
	Items  []Template `json:"items"`
	Total  int64      `json:"total"`
	Limit  int        `json:"limit"`
	Offset int        `json:"offset"`
}

TemplateList is the template page.

type TemplateListParams

type TemplateListParams struct {
	Channel  string
	Category string
	Status   string
	Search   string
	Limit    int
	Offset   int
}

TemplateListParams filters templates.

type TemplatePreview

type TemplatePreview struct {
	Channel      string `json:"channel"`
	Subject      string `json:"subject"`
	RenderedBody string `json:"renderedBody"`
	RenderedText string `json:"renderedText"`
	Status       string `json:"status"`
	CanSend      bool   `json:"canSend"`
}

TemplatePreview is a rendered preview.

type TemplatesService

type TemplatesService struct {
	// contains filtered or unexported fields
}

TemplatesService manages templates (Enterprise/admin access).

func (*TemplatesService) Create

func (*TemplatesService) Delete

func (s *TemplatesService) Delete(ctx context.Context, templateID string) (*APIResponse[map[string]string], error)

func (*TemplatesService) Get

func (s *TemplatesService) Get(ctx context.Context, templateID string) (*APIResponse[Template], error)

func (*TemplatesService) List

func (*TemplatesService) Preview

func (*TemplatesService) SyncMeta

func (s *TemplatesService) SyncMeta(ctx context.Context, templateID string) (*APIResponse[Template], error)

func (*TemplatesService) Update

type TrackingDetail

type TrackingDetail struct {
	Message TrackingMessage `json:"message"`
	Events  []TrackingEvent `json:"events"`
}

TrackingDetail is a tracked message plus its event timeline.

type TrackingEvent

type TrackingEvent struct {
	ID             string         `json:"id"`
	EventType      string         `json:"eventType"`
	RecipientEmail *string        `json:"recipientEmail"`
	ClickURL       *string        `json:"clickUrl"`
	OccurredAt     string         `json:"occurredAt"`
	Engagement     map[string]any `json:"engagement"`
}

TrackingEvent is a delivery/open/click event.

type TrackingList

type TrackingList struct {
	Messages []TrackingMessage `json:"messages"`
	Summary  TrackingSummary   `json:"summary"`
}

TrackingList is the tracked messages response: {"messages":[],"summary":{}}.

type TrackingListParams

type TrackingListParams struct {
	Limit  int
	Offset int
	Status string
}

TrackingListParams filters tracked messages.

type TrackingMessage

type TrackingMessage struct {
	TrackingID          string  `json:"trackingId"`
	SenderDomain        string  `json:"senderDomain"`
	Subject             *string `json:"subject"`
	RecipientsCount     int     `json:"recipientsCount"`
	AcceptedCount       int     `json:"acceptedCount"`
	DeliveredCount      int     `json:"deliveredCount"`
	BouncedCount        int     `json:"bouncedCount"`
	OpenCount           int     `json:"openCount"`
	ClickCount          int     `json:"clickCount"`
	Status              string  `json:"status"`
	CreatedAt           string  `json:"createdAt"`
	LastOpenedAt        *string `json:"lastOpenedAt"`
	LastClickedAt       *string `json:"lastClickedAt"`
	LastDeliveryEventAt *string `json:"lastDeliveryEventAt"`
}

TrackingMessage is a tracked outbound message.

type TrackingSummary

type TrackingSummary struct {
	Messages   int64 `json:"messages"`
	Recipients int64 `json:"recipients"`
	Accepted   int64 `json:"accepted"`
	Delivered  int64 `json:"delivered"`
	Bounced    int64 `json:"bounced"`
	Opens      int64 `json:"opens"`
	Clicks     int64 `json:"clicks"`
}

TrackingSummary aggregates tracked message activity.

type URLAttachment

type URLAttachment struct {
	URL      string `json:"url"`
	FileName string `json:"fileName"`
}

URLAttachment is a publicly reachable attachment.

type UnitLedgerEntry

type UnitLedgerEntry struct {
	ID           string  `json:"id"`
	Delta        int64   `json:"delta"`
	BalanceAfter int64   `json:"balanceAfter"`
	Reason       string  `json:"reason"`
	Reference    *string `json:"reference"`
	CreatedAt    string  `json:"createdAt"`
}

UnitLedgerEntry is a credit ledger row.

type UnitPack

type UnitPack struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	Description   string `json:"description"`
	Units         int64  `json:"units"`
	PriceNGNMinor int64  `json:"priceNgnMinor"`
	PriceUSDMinor int64  `json:"priceUsdMinor"`
	IsActive      bool   `json:"isActive"`
	SortOrder     int    `json:"sortOrder"`
}

UnitPack is a purchasable credit pack.

type UnitsService

type UnitsService struct {
	// contains filtered or unexported fields
}

UnitsService reads and purchases email credits.

func (*UnitsService) Ledger

func (s *UnitsService) Ledger(ctx context.Context, page, perPage int) (*APIResponse[Page[UnitLedgerEntry]], error)

func (*UnitsService) Packs

func (*UnitsService) Purchase

func (*UnitsService) Summary

type UnitsSummary

type UnitsSummary struct {
	IncludedAllowance int64 `json:"includedAllowance"`
	IncludedUsed      int64 `json:"includedUsed"`
	IncludedRemaining int64 `json:"includedRemaining"`
	PurchasedBalance  int64 `json:"purchasedBalance"`
	Unlimited         bool  `json:"unlimited"`
	CanBuyCredits     bool  `json:"canBuyCredits"`
}

UnitsSummary is the email credit summary.

type UpdateDomainRequest

type UpdateDomainRequest struct {
	Domain        string `json:"domain,omitempty"`
	IsDefault     *bool  `json:"isDefault,omitempty"`
	UseRootDomain *bool  `json:"useRootDomain,omitempty"`
	MailMode      string `json:"mailMode,omitempty"`
}

UpdateDomainRequest updates a sending domain.

type UpdateMailboxRequest

type UpdateMailboxRequest struct {
	DisplayName string `json:"displayName,omitempty"`
	Password    string `json:"password,omitempty"`
}

UpdateMailboxRequest updates a mailbox.

type UpdateSMTPRelayRequest

type UpdateSMTPRelayRequest struct {
	Name         string `json:"name,omitempty"`
	SMTPHost     string `json:"smtp_host,omitempty"`
	SMTPPort     int    `json:"smtp_port,omitempty"`
	SMTPUsername string `json:"smtp_username,omitempty"`
	SMTPPassword string `json:"smtp_password,omitempty"`
	SMTPSecurity string `json:"smtp_security,omitempty"`
	IsDefault    *bool  `json:"is_default,omitempty"`
	Status       string `json:"status,omitempty"`
}

UpdateSMTPRelayRequest updates a relay.

type UpdateTemplateRequest

type UpdateTemplateRequest struct {
	Name       string `json:"name,omitempty"`
	Subject    string `json:"subject,omitempty"`
	Body       string `json:"body,omitempty"`
	TextBody   string `json:"textBody,omitempty"`
	Category   string `json:"category,omitempty"`
	Components any    `json:"components,omitempty"`
	Variables  any    `json:"variables,omitempty"`
	Design     any    `json:"design,omitempty"`
}

UpdateTemplateRequest updates a template.

type UploadedFile

type UploadedFile struct {
	FileName    string  `json:"fileName"`
	ContentType *string `json:"contentType"`
	SizeBytes   int64   `json:"sizeBytes"`
	PublicURL   *string `json:"publicUrl"`
}

UploadedFile is the attachment upload response.

type UploadedFileEnvelope

type UploadedFileEnvelope struct {
	File UploadedFile `json:"file"`
}

UploadedFileEnvelope is {"file":{...}}.

type VerificationCheck

type VerificationCheck struct {
	RecordType     string   `json:"recordType"`
	Host           string   `json:"host"`
	ExpectedValue  string   `json:"expectedValue"`
	Matched        bool     `json:"matched"`
	ObservedValues []string `json:"observedValues"`
}

VerificationCheck is one checked DNS record.

type VerificationEnvelope

type VerificationEnvelope struct {
	Verification DomainVerification `json:"verification"`
}

VerificationEnvelope is {"verification":{...}}.

type WebhooksService

type WebhooksService struct{}

WebhooksService verifies incoming webhook signatures without a network call.

func (*WebhooksService) ConstructEvent

func (s *WebhooksService) ConstructEvent(payload []byte, signature, secret string, out any) error

ConstructEvent verifies the signature and decodes the JSON payload into out.

func (*WebhooksService) Sign

func (s *WebhooksService) Sign(payload []byte, secret string) string

Sign returns the hex HMAC SHA-256 signature for a payload. Useful in tests.

func (*WebhooksService) VerifySignature

func (s *WebhooksService) VerifySignature(payload []byte, signature, secret string) bool

VerifySignature checks a hex HMAC SHA-256 signature. A "sha256=" prefix is accepted.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL