1.0.7 • Published 4 years ago

tm-notification v1.0.7

Weekly downloads
28
License
ISC
Repository
-
Last release
4 years ago

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("package@tm30.net")
    .setSubject("From Test Package")
    .setProvider("sendgrid")
    .setRecipients("michealakinwonmi@gmail.com");

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

Contributors

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.4

4 years ago

0.1.5

4 years ago

0.1.3

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago