Official Node.js client for the @signalgrid/signalgrid-push package.
npm install @signalgrid/signalgrid-pushimport 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);Creates a Signalgrid client instance.
clientKey(string) - Your Signalgrid client key.
Sends a notification.
channel(string) - Your channel token.title(string) - Notification title.body(string) - Notification body.type(string, optional) - Notification type such asinfo,success,warning, orerror.critical(boolean, optional) - Critical flag. If set to true, notification will bypass DND / Focus modes.
Returns a promise that resolves with the Signalgrid API response.
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();