Skip to content

About

NodeJS Plugin for Signalgrid

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Signalgrid Node.js SDK

npm version npm downloads

Official Node.js client for the @signalgrid/signalgrid-push package.

Install

npm install @signalgrid/signalgrid-push

Usage

import Signalgrid from '@signalgrid/signalgrid-push';

const sg = new Signalgrid('your_client_key');

const result = await sg.send({
  channel: 'your_channel_token',
  title: 'Server Alert',
  body: 'High CPU usage detected on web-01',
  type: 'warning',
  critical: false
});

console.log(result);

API

new Signalgrid(clientKey)

Creates a Signalgrid client instance.

Arguments

  • clientKey (string) - Your Signalgrid client key.

sg.send(payload)

Sends a notification.

Payload

  • channel (string) - Your channel token.
  • title (string) - Notification title.
  • body (string) - Notification body.
  • type (string, optional) - Notification type such as info, success, warning, or error.
  • critical (boolean, optional) - Critical flag. If set to true, notification will bypass DND / Focus modes.

Returns

Returns a promise that resolves with the Signalgrid API response.

Example with error handling

import Signalgrid from '@signalgrid/signalgrid-push';

async function main() {
  try {
    const sg = new Signalgrid('your_client_key');

    const result = await sg.send({
      channel: 'your_channel_token',
      title: 'Server Alert',
      body: 'High CPU usage detected on web-01',
      type: 'warning',
      critical: false
    });

    console.log(result);
  } catch (error) {
    console.error('Failed to send notification:', error);
  }
}

main();

About

NodeJS Plugin for Signalgrid

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages