1.0.32 • Published 11 months ago

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

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months 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

11 months ago

1.0.31

11 months ago

1.0.30

11 months ago

1.0.29

11 months ago

1.0.28

11 months ago

1.0.27

11 months ago

1.0.26

11 months ago

1.0.25

11 months ago

1.0.24

11 months ago

1.0.22

11 months ago

1.0.21

11 months ago

1.0.20

11 months ago

1.0.19

11 months ago

1.0.18

11 months ago

1.0.17

11 months ago

1.0.16

11 months ago

1.0.15

11 months ago

1.0.14

11 months ago

1.0.13

11 months ago

1.0.12

11 months ago

1.0.11

11 months ago

1.0.10

11 months ago

1.0.9

11 months ago

1.0.8

11 months ago

1.0.5

11 months ago

1.0.4

11 months ago

1.0.3

11 months ago

1.0.2

11 months ago

1.0.1

11 months ago

1.0.0

11 months ago

0.0.1

11 months ago