Getting Started with the AlertOps TypeScript SDK
Install @alertops/sdk from npm, set ALERTOPS_API_KEY and create a new AlertOps() client; every AlertOps endpoint is then an async method such as ao.groups.list().
Overview
Relevant for TypeScript and JavaScript developers automating AlertOps
The AlertOps TypeScript SDK (@alertops/sdk) brings the whole AlertOps API to Node.js in one client object. Each endpoint is an async method on a resource, such as ao.groups.list or ao.escalationPolicies.create, and every call returns a promise of the parsed JSON response. 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, with TypeScript type definitions included.
- ESM and CommonJS — works with import and require.
- Zero dependencies — runs on Node 18 or later with the built-in fetch.
- 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
npm install @alertops/sdk
import { AlertOps } from "@alertops/sdk"; // ESM
const { AlertOps } = require("@alertops/sdk"); // CommonJS
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 | new AlertOps({ dotenv: ".env" }) reads ALERTOPS_API_KEY from the file |
| Client option | new AlertOps({ apiKey: process.env.MY_KEY }) |
Use the SDK from servers, scripts and CI pipelines, where the key stays private.
Make your first calls
Relevant for Developers checking that the connection works
import { AlertOps } from "@alertops/sdk";
const ao = new AlertOps();
const zone = await ao.account.timeZone(); // your account's time zone
const [group] = await ao.groups.ensure("Network Ops"); // find or create a group
await ao.groups.members.addUsers(group.group_id, [7, 8]); // add members (Primary role)
Paginated endpoints also have …All() to collect every page and …Iter() for an async iterator, for example ao.groups.listAll().
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 | 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 TypeScript alongside the other SDKs.
- The full developer documentation, with every method, ships with the library: github.com/alertops/alertops-node.
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.