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

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:

OptionHow
Environment variableALERTOPS_API_KEY=<your key>
.env filenew AlertOps({ dotenv: ".env" }) reads ALERTOPS_API_KEY from the file
Client optionnew 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

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 servicesInbound 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 TypeScript alongside the other SDKs.
  • The full developer documentation, with every method, ships with the library: github.com/alertops/alertops-node.

Related Articles

Need help?

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