Skip to content
  • There are no suggestions because the search field is empty.

Getting Started with the AlertOps Go SDK

Add github.com/alertops/alertops-go to your module, set ALERTOPS_API_KEY and create a client with alertops.New; every AlertOps endpoint is then a method such as ao.Groups.List.

Overview

Relevant for Go developers automating AlertOps

The AlertOps Go SDK (github.com/alertops/alertops-go) brings the whole AlertOps API to Go in one client. Each endpoint is a method on a resource, such as ao.Groups.List or ao.EscalationPolicies.Create. Every call takes a context.Context first, so timeouts and cancellation work the way Go developers expect. Teams use it to onboard responders automatically, send alerts from their own services and publish status updates straight from their deployment pipelines.

Key benefits:

  • Complete — every AlertOps endpoint is available as a method.
  • Idiomatic Go — context-aware calls, errors you inspect with errors.As, and range-over-func iterators for paginated lists.
  • Standard library only — built on net/http; requires Go 1.23 or later.
  • Helpers included — find-or-create, alert ingestion and the semantic layer for planning on-call setups.

Install the SDK

Relevant for Developers setting up a project

go get github.com/alertops/alertops-go
import alertops "github.com/alertops/alertops-go"

Set your API key

Relevant for Developers connecting to an AlertOps account

Create an API key in AlertOps, then make it available to the SDK in one of three ways:

OptionHow
Environment variableALERTOPS_API_KEY=<your key>
.env filealertops.New(alertops.Options{Dotenv: ".env"}) reads ALERTOPS_API_KEY from the file
Client optionalertops.New(alertops.Options{APIKey: key})

Keep the key on servers, in scripts and in CI secrets.

Make your first calls

Relevant for Developers checking that the connection works

ctx := context.Background()
ao := alertops.New(alertops.Options{})

zone, _ := ao.Account.TimeZone(ctx) // your account's time zone
group, _, err := ao.Groups.Ensure(ctx, "Network Ops", nil) // find or create a group
if err != nil {
log.Fatal(err)
}
ao.Groups.Members.AddUsers(ctx, alertops.Get(group, "group_id"), []any{7, 8}, nil)
fmt.Println(zone)

Paginated endpoints also have …All to collect every page and …Iter for a for … range loop, for example ao.Groups.ListIter(ctx, nil).

Common tasks

Relevant for Developers looking for the right method

TaskMethod
Find or create a groupao.Groups.Ensure
Create an on-call shiftao.Schedules.CreateShift
Create an API integrationao.Inbound.CreateAPI
Send an alertao.Ingest.PostToIntegration
List recent alertsao.Alerts.ListRecent
Post a status page incidentao.StatusHub.Incidents.Create

Every other AlertOps feature follows the same pattern, one resource per area of the app.

What you can build

Relevant for Teams planning their first automation

GoalWhere to start
Keep on-call teams in sync with your HR or identity systemUsers, groups and schedules
Send alerts from your own services and agentsInbound integrations and alert ingestion
Roll out a complete on-call setup from a short descriptionThe semantic layer
Publish incidents to customersStatus Hub pages and incidents

Next steps

Relevant for Developers building their first automation

  • Follow the guides for each area: people and schedules, escalation, alert sources, alerts, workflows, status pages and administration. Each guide shows Go alongside the other SDKs.
  • The full developer documentation, with every method, ships with the library: github.com/alertops/alertops-go.

Related Articles

Need help?

Email support@alertops.com or contact your AlertOps representative.