1.1.0 • Published 4 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);
email
the email address of the user receiving the notificationcode
the reset code the assigned to the user of the resetclientId
the 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);
email
the email address of the user receiving the notificationfirstName
first name of the recipientlastName
last name of the recipientserviceName
name of the service they are invited toserviceNameWelcomeMessage
paragraph of email introducing to service they are invited toserviceNameWelcomeMessageDescription
paragraph of email giving a description of the service
Running locally
Install dependencies
npm i
Run relevant test script, for example:
node tools/sendPasswordReset.js
node tools/sendInvitation.js
By 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
4 years ago