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:
| Option | How |
| Environment variable | ALERTOPS_API_KEY=<your key> |
| .env file | alertops.New(alertops.Options{Dotenv: ".env"}) reads ALERTOPS_API_KEY from the file |
| Client option | alertops.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
| Task | Method |
| Find or create a group | ao.Groups.Ensure |
| Create an on-call shift | ao.Schedules.CreateShift |
| Create an API integration | ao.Inbound.CreateAPI |
| Send an alert | ao.Ingest.PostToIntegration |
| List recent alerts | ao.Alerts.ListRecent |
| Post a status page incident | ao.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
| Goal | Where to start |
| Keep on-call teams in sync with your HR or identity system | Users, groups and schedules |
| Send alerts from your own services and agents | Inbound integrations and alert ingestion |
| Roll out a complete on-call setup from a short description | The semantic layer |
| Publish incidents to customers | Status 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
- AlertOps SDKs for Python, TypeScript, Go, Java and .NET
- Users, Groups and On-Call Schedules with the AlertOps SDKs
- Inbound Integrations, Alert Ingestion and Heartbeats with the AlertOps SDKs
- Planning On-Call Setups with the AlertOps Semantic Layer
Need help?
Email support@alertops.com or contact your AlertOps representative.