Skip to main content

Go SDK

The Orbit Go SDK wraps the platform’s core API resources — messaging (SMS, WhatsApp, email), voice, contacts, campaigns, verify (OTP), and webhook signature verification — with typed methods. It requires Go 1.22+ and is safe for concurrent use across goroutines.
Pre-publish — source-only. This SDK is not yet mirrored to the public Go module repository — go get github.com/devotel/orbit-go returns 404 today. Until first publish, vendor the source from the monorepo (packages/sdk-go/) or call the REST API directly. See Go: core-scope, not full parity on the SDK index for exactly what is and isn’t wrapped, and the low-level client.Request(ctx, method, path, ...) escape hatch for uncovered routes (worked example below).

Installation

Client initialization

The client reads the key straight from your environment — there is no from_env helper in Go; use os.Getenv:
Tune the transport with functional options:

Quickstart: send your first SMS

A runnable end-to-end — the key comes from ORBIT_API_KEY, never from source. Copy it into main.go and run it with go run .:
Set ORBIT_API_KEY to a sandbox key prefixed dv_test_sk_ first — sandbox sends are simulated, free, and never reach a carrier. Swap in your live key (dv_live_sk_...) when you’re ready to send for real; the code does not change. The response shape above comes from the Messages API reference — its language tabs include this exact call.

Messaging

client.Messages() also exposes SendWhatsApp, SendEmail, and Get (fetch a message by id).

Voice

client.Voice() also exposes Get, List, and Hangup(callID) — place a call, poll its status, then hang up. All outbound calls route through the Orbit API; the SDK never selects a carrier.

Second example: verify OTP

The send-and-check round trip is the most common first integration on the platform. Two calls — the key is still just ORBIT_API_KEY passed to orbit.NewClient:
A wrongly-typed or expired code reports check.Data.Valid == false — it never errors for a bad guess (only for transport/auth failures), so branch on the flag. The Verify API reference covers the full contract, and Starter examples includes a complete OTP sign-in starter repo (orbit-otp-nextjs).

Verify (OTP)

client.Verify() also exposes Resend and GetDetail.

Contacts

client.Contacts() also exposes List, Get, Update, and Delete.

Campaigns

client.Campaigns() also exposes List, Get, Update, and Delete.

Paginate a list

List endpoints are cursor-paginated — read meta.pagination.cursor and meta.pagination.has_more off each response and pass the cursor back as a query parameter until has_more is false. Page through SMS messages with the escape hatch:
The full pagination model (cursor vs. offset endpoints, page-size caps, and why cursors are not bookmarkable) is in the Pagination guide.

Error handling

All Orbit-originated errors are *orbit.Error. Inspect them with the helper predicates:
Every non-GET request automatically carries an Idempotency-Key header (UUID v4); override it per call via orbit.SendSMSInput{ ..., IdempotencyKey: "job-7a3b9d-attempt-1" } when retrying from your own queue.

Covered route missing? Use the escape hatch

The typed resources wrap 8 core resources; the rest of the API — contact segments, event sinks, frequency caps, and everything else listed as out of scope on the SDK index — is reachable through client.Request(ctx, method, path, ...). It unmarshals the raw JSON body into whatever out you pass (a map[string]any when you have no typed struct). Fetch a segment by id:
The escape hatch carries the same auth, retry, and error model as the typed resources — treat it as a first-class client, not a fallback http.Client.

Webhook signature verification