1.1.0 • Published 5 years ago
authbox.notifications.client v1.1.0
AuthBox.notifications.client
Client for sending user notifications within AuthBox
Usage
Create an instance of the NotificationClient, passing the connection string for the service
const NotificatonClient = require('authbox.notifications.client');
const client = new NotificatonClient({
connectionString: '[CONNECTION-STRING-PROVIDED]'
});The client then has methods for sending notifications. All methods return promises.
Notifications
Password reset
Send a notification when a password reset is requests
await client.sendPasswordReset(email, code, clientId);emailthe email address of the user receiving the notificationcodethe reset code the assigned to the user of the resetclientIdthe clientId of the application where the user came from
Invitation
Send an invitation to a user about a service
await client.sendInvitation(email, firstName, lastName, serviceName, serviceNameWelcomeMessage,
serviceNameWelcomeMessageDescription);emailthe email address of the user receiving the notificationfirstNamefirst name of the recipientlastNamelast name of the recipientserviceNamename of the service they are invited toserviceNameWelcomeMessageparagraph of email introducing to service they are invited toserviceNameWelcomeMessageDescriptionparagraph of email giving a description of the service
Running locally
Install dependencies
npm iRun relevant test script, for example:
node tools/sendPasswordReset.js
node tools/sendInvitation.jsBy default, the test scripts are configured to use your local machine. If you want to use them against another connection, edit ./tools/config.json
1.1.0
5 years ago