pagerduty-client
v1.0.0
Published
PagerDuty client API wrapper for Node.js
Downloads
7,871
Readme
Pagerduty-Client
PagerDuty client API wrapper for Node.js 6.x (ES6)
Installation
npm install pagerduty-client --save
Usage
Setup
const PagerDuty = require('pagerduty-client');
// Setup using integration/service key
const pager = new PagerDuty('12345678912345678912345678912345');
Trigger
pager.trigger('Incident-1', 'Some description', data).then(id => {
// Incident-1 triggered successfully
});
Acknowledge
pager.acknowledge('Incident-1', 'Some description', data).then(() => {
// Incident-1 is successfully acknowledged
});
Resolve
pager.resolve('Incident-1', 'Some description', data).then(() => {
// Incident-1 was resolved successfully
});
Catching errors
The API uses Promises, so any errors that occurs can be collected with catch. Example:
pager.resolve('Incident-1', 'Some description', data).then(() => {
// Incident-1 was resolved successfully
}).catch(err => {
// Some error occured
});
Tests
Tests can be run with: npm test
Licence
The MIT License (MIT)