1.0.32 • Published 2 years ago

@prymejo/nestjs-sms-and-email-module v1.0.32

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Description

@prymejo/nestjs-sms-and-email-module is a simple package that provides functionalities for sending emails and sms.

The package works with Nodejs v18 >

Key features

  1. Send bulk sms
  2. Send single sms
  3. Send Email with text
  4. Send email with template ( templates can be generated on mandrill or mailchimp)

About

This is a simple implementation for sending email and sms notifications with nestjs . It uses Mailchimp( Mandrill https://mailchimp.com ) for sending emails and Termii (https://termii.com/) for sending sms.

Sample payload for sending sms

//you will need to set the senderId from the

input: {
from:"sender@mail.com" 
to:"+2348007910016"
sms:"test message"
channel:GENERIC
type:"plain"
}

Sample payload for sending email

//you will need to set the from_mail on the mandrill dashboard

input: {
message: {
to: [{ email: "johndoe@mailreciever.com" }]
text: "testing email"
from_email: "janedoe@mailsender.com"
subject:"testing emails"
}
}

Initializing the sms module

import {SmsModule} from '@prymejo/nestjs-sms-and-email-module';

@module({
imports:[SmsModule.register(TERMII_API_KEY)]
})

Using the sms service

import {SmsService} from '@prymejo/nestjs-sms-and-email-module';

export class UserService{
constructor(private readonly smsService:SmsService){
}

async sendOtp(payload:SendSmsInterface){
await this.smsService.sendSms(payload)
}

Initializing the Email module

import {EmailModule} from '@prymejo/nestjs-sms-and-email-module';

@module({
imports:[EmailModule.register(MANDRILL_API_KEY)]
})

Using the email service

import {EmailService} from '@prymejo/nestjs-sms-and-email-module';

export class UserService{
constructor(private readonly emailService:EmailService){}
async sendEmail(payload:MailChimpEmailInterface){
await this.emailService.sendMail(payload)
}

PS: Contributions are welcome.

Note : you will need to create accounts on both Mandrill ((https://mailchimp.com) docs can be found at https://mailchimp.com/developer/transactional/api/ ) and Termii((https://termii.com/) docs can be found at https://developer.termii.com/switch) to obtain their api keys.

Installation

npm  install  @prymejo/nestjs-sms-and-email-module

yarn  add  @prymejo/nestjs-sms-and-email-module

License

Nest is MIT licensed.

1.0.32

2 years ago

1.0.31

2 years ago

1.0.30

2 years ago

1.0.29

2 years ago

1.0.28

2 years ago

1.0.27

2 years ago

1.0.26

2 years ago

1.0.25

2 years ago

1.0.24

2 years ago

1.0.22

2 years ago

1.0.21

2 years ago

1.0.20

2 years ago

1.0.19

2 years ago

1.0.18

2 years ago

1.0.17

2 years ago

1.0.16

2 years ago

1.0.15

2 years ago

1.0.14

2 years ago

1.0.13

2 years ago

1.0.12

2 years ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago

0.0.1

2 years ago