tm-notification
v1.0.7
Published
This is the package exposing methods for the notification service
Downloads
10
Maintainers
Readme
tm-notification
tm-notification - This is the package exposing methods for the notification service
Installation
"dependencies": {
"tm-notification": "~1.0.7" // see the "releases" section
}
npm install tm-notification
Requirements
- ENV
APP_NAME=tm-notification-package
API_GATEWAY_URL=
NOTIFICATION_SERVICE_URL= //internal microservice
CLIENT_ID=
###Send SMS
const {SMSBuilder} = require('tm-notification');
const smsBuilder = new SMSBuilder();
const builder = smsBuilder.startBuild()
.setRecipients("0703XXXXXXX")
.setProvider("smpp")
.setMessage("Test message")
.setSender("TM30");
const response = await builder.send();
console.log("Response", response);
//Response { data: 'Email Sent' }
Send Email
- To send Email
const {EmailBuilder} = require('tm-notification');
const emailBuilder = new EmailBuilder();
const builder = emailBuilder.startBuild()
.setProvider("sendgrid")
.setFrom("[email protected]")
.setSubject("From Test Package")
.setProvider("sendgrid")
.setRecipients("[email protected]");
builder.setHeader()
.setTitle("Header Title")
// .setBGColor("green")
.setAppLogo("https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_92x30dp.png")
.setAppUrl("https://tm30.net")
.setAppName("TM30");
builder.setBody()
.setContent("This is a content")
.setGreeting("Greetings,")
.setIntroLine([
"intro line 1",
"intro line 2"
])
.setOutroLine([
"outroline 1",
"outroline 2"
]);
builder.setAttachments([
"https://res.cloudinary.com/tm30global/image/upload/v1582900669/4bb79409937716d8db9855e49cc7a9b6.pdf"
]);
const response = await builder.send();
console.log("Response", response); // Response { data: 'Email Sent' }
Tests
Cli
npm install
npm test