Skip to main content

Send the Notification

Prerequisite

NotificationAPI account and a configured notification in the dashboard. If you don't have an account, you can sign up for free.

1. Install back-end SDK

Notifications are triggered from your back-end. So install one of our back-end SDKs:

npm install notificationapi-node-server-sdk
// or using yarn:
yarn add notificationapi-node-server-sdk

2. Send

The example below sends the "New Comment Notification" to the test user:

// import/require:
import notificationapi from 'notificationapi-node-server-sdk';
// const notificationapi = require('notificationapi-node-server-sdk').default

// init
notificationapi.init('CLIENT_ID', 'CLIENT_SECRET');

// send
notificationapi.send({
notificationId: 'new_comment_notification',
user: {
id: 'TEST_USER_ID',
email: 'TEST@TEST.COM', // required for email notifications
number: '+15005550006' // required for SMS
}
});
info

You must replace the CLIENT_ID and CLIENT_SECRET with real values. You can get yours from here.

That's it?

You are now sending notifications through email, SMS, automated voice calls, etc.

Please take the time to review: