swytch-x-notification-client v1.1.0-RC.0
Swytch Notification Client
A client for pushing formatted messages into our notification queue for the notification service to deliver to intended destination(s).
AWS Setup
https://console.aws.amazon.com/iam/home?region=us-east-1
Configuration
The client is configurable through the initialize
function.
const {NotificationClient} = require('@swytchio/swytch-x-notification-client')
let notify = NotificationClient.initialize({
queueName: 'xxx',
secretAccessKey: 'xxx',
accessKeyId: 'xxx',
region: 'us-east-1',
logLevel: 'info',
serviceName: 'Example Service',
errorRecipient: 'error@email.com'
``})
Logs
The logLevel
property of the config
object determines log level for the client. "error" - production level, 'debug'/'info' - development level. If this is not provided it will default to 'error'
If the logLevel
property is not included, it will use the environment variable LOG_LEVEL or default to 'error'.
Testing .env
The package uses dotenv
to load a .env
file's contents into process.env
. You will need the following .env
file to run the tests in notification.client.test.js
:
SQS_ACCESS_KEY_ID=
SQS_SECRET_ACCESS_KEY=
SQS_REGION=
SQS_NAME=
LOG_LEVEL=info
JEST_TWILIO_TO=<phone>
JEST_MAIL_TO=<email>
Documentation
For implementation documentation, npm run doc
, then open ./doc/index.html
in the browser.
4 years ago