Browse Docs

SDK Overview

Every API Alerts SDK follows the same design, so if you know how one works, you know how they all work. This page explains the shared patterns.

Configure once, send anywhere

All SDKs expose a global singleton. Configure it once at startup (in your main, AppDelegate, _ready, etc.), then call send from anywhere in your codebase without passing clients around.

ApiAlerts.configure("your-api-key")

// anywhere, any file
ApiAlerts.send(Event(message = "Deploy complete"))

configure is idempotent. Subsequent calls are no-ops and the first call wins.

Rust is the only exception. It is instance-based (ApiAlertsClient::new(...)) rather than a singleton, which is more idiomatic for Rust.

Two send methods

Every SDK exposes the same two methods:

MethodBehaviour
send(event)Fire-and-forget. Never throws, never panics. Returns immediately.
sendAsync(event)Waits for the response. Returns the result or an error.

Use send when you don’t care about confirmation. Use sendAsync when you want to verify delivery or read workspace/channel from the response.

The Event object

All 6 fields are consistent across every SDK. Only message is required.

FieldRequiredDescription
messageYesThe notification body
channelNoTarget channel (defaults to workspace default)
eventNoEvent key for routing rules (e.g. ci.deploy)
tagsNoCategorisation tags
linkNoURL to open from the notification
dataNoArbitrary JSON object for template variables or metadata

Optional fields are omitted from the request body when not set. They are never sent as null.

The result

sendAsync returns a result object with:

FieldDescription
workspaceName of the workspace the event was delivered to
channelChannel it was delivered to
warningsNon-fatal notices from the API (e.g. deprecated fields)

Most SDKs also include success (bool) and error (string) directly on the result, so errors are returned rather than thrown. Go, Swift, Kotlin, and Rust use their language’s native error mechanism instead ((T, error), Result<T, E>, etc.).

Sending to multiple workspaces

Pass an API key directly to override the configured key for a single call:

// Languages with optional params (JS, Python, Kotlin, Swift, etc.)
sendAsync(event, apiKey: "other-workspace-key")

// Languages without optional params (Go, Rust, Godot)
sendWithKeyAsync("other-workspace-key", event)

Debug logging

Debug mode logs successful sends, warnings, and errors to stderr/output. It is off by default.

// Languages with optional params
configure("your-api-key", debug: true)

// Go, Rust, Godot
configure("your-api-key")
setDebug(true)

Request timeout

All SDKs apply a 15-second timeout to every HTTP request. Requests that exceed this limit fail with a network error and return a failure result, so they never hang indefinitely.

Available SDKs

LanguagePackageNotes
C#ApiAlertsASP.NET, Blazor, Azure Functions
Gogithub.com/apialerts/apialerts-goServers, CLI, microservices
JavaScript@apialerts/apialerts-jsBrowser, Node.js, Bun
Kotlincom.apialerts:clientKMP: Android, JVM, iOS, macOS, JS, wasm
PythonapialertsDjango, Flask, FastAPI
RustapialertsInstance-based, no singleton
Swiftapialerts-swiftiOS, macOS, watchOS, Vapor

Java, Dart, PHP, Ruby, and Godot SDKs launch with 2.0.