1.1.0 • Published 4 years ago

authbox.notifications.client v1.1.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

AuthBox.notifications.client

tested with jest

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 notification
  • code the reset code the assigned to the user of the reset
  • clientId 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 notification
  • firstName first name of the recipient
  • lastName last name of the recipient
  • serviceName name of the service they are invited to
  • serviceNameWelcomeMessage paragraph of email introducing to service they are invited to
  • serviceNameWelcomeMessageDescription 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