Skip to main content
Version: 1.3.x

Node

This is the official node.js library for communicating with Engagespot REST API. Send multi-channel notifications from your node app.

Installation

npm install @engagespot/node

Prerequisites

You need Engagespot API KEY and API SECRET from your dashboard to get started. If you don't have one, just get one for free.

Getting Started

import { EngagespotClient } from '@engagespot/node';

const client = EngagespotClient({
apiKey: 'ENGAGESPOT_API_KEY',
apiSecret: 'ENGAGESPOT_API_SECRET',
});

client.send({
notification: {
title: 'Agent X commented on your support ticket #T-793465',
message: "Dear Customer, We're working on your ticket.",
url: 'https://support.mydomain.com/tickets/793465',
icon: 'https://cdn.support.mydomain.com/images/agent_x_profile.png',
},
recipients: ['customer@gmail.com'],
});

Refer Engagespot REST API Docs to get the list of all supported parameters.

Advanced Configurations

Methods and supported parameters.

import { EngagespotClient } from '@engagespot/node';

const client = EngagespotClient({
apiKey: 'ENGAGESPOT_API_KEY',
apiSecret: 'ENGAGESPOT_API_SECRET',
});

const params = {
notification: {
title: 'Agent X commented on your support ticket #T-793465',
message: "Dear Customer, We're working on your ticket.",
url: 'https://support.mydomain.com/tickets/793465',
icon: 'https://cdn.support.mydomain.com/images/agent_x_profile.png',
},
recipients: ['customer@gmail.com'],
};

client.send(params);

//Creating or Updating a user
client.createOrUpdateUser('identifier', {
optional: 'profile key value pair',
});

Create or Update User

import { EngagespotClient } from '@engagespot/node';

const client = EngagespotClient({
apiKey: 'ENGAGESPOT_API_KEY',
apiSecret: 'ENGAGESPOT_API_SECRET',
});

client.createOrUpdateUser('identifier', {
optional: 'profile key value pair',
});

Create User Tokens

import { EngagespotClient } from '@engagespot/node';

const client = EngagespotClient({
apiKey: 'ENGAGESPOT_API_KEY',
apiSecret: 'ENGAGESPOT_API_SECRET',
signingKey: 'YOUR_ENGAGESPOT_SIGNING_KEY',
});

client.generateUserToken('identifier');

NOTE : You must provide signingKey while initializing engagespot client to use generateUserToken function.

Creating Signing Key

You can generate your public-private signing key pair from Engagespot console, and this private key should be the secret signing key for generating user tokens

caution

When you generate the signing key, Engagespot will store only the public key in our database. You should download the private key and use it for signing your user tokens. You won't be able to retrieve the private key after this step.