Skip to content

Node.js module to integrate your project with Notify.Events service.

License

Notifications You must be signed in to change notification settings

notify-events/nodejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Node.js client for Notify.Events

A simple node.js extension that simplifies the process of integrating your project with the Notify.Events service to send messages to your channels.

Instruction in other languages

Installation

The preferred way to install this extension is through npm.

Either run

npm install @notify.events/nodejs

or add

"@notify.events/nodejs": "~1.0"

to the dependencies section of your package.json.

Usage

To use this extension, you need to import the Message class into your Node.js script.

If you have used npm for installation, it will be enough to include lib like this:

const Message = require('@notify.events/nodejs').Message;

Otherwise, if you added the lib manually, you need to import the Message by full path:

const Message = require('./path/to/your/Message');

After that, you can create a message object, set the necessary parameters and send the message to the channel.

Usage example

const Message = require('@notify.events/nodejs').Message;

// Defining channel token.
// You get this token when creating a channel on the Notify.Events service.
const token = 'XXXXXXXX';

// Create a message object.
const message = new Message('Some <b>important</b> message', 'Title', Message.PRIORITY_HIGH, Message.LEVEL_ERROR);

// Attach the file to the message.
message.addFile('path\to\local\file');

// Send a message to your channel in Notify.Events.
message.send(token);