This project is a highly scalable micro-service to handle all the notifications (Email/SMS/WhatsApp) that you would require to schedule for contact from your small-business. It uses Amazon's SQS queuing service, SendGrid's email API and Twilio WhatsApp and SMS API to schedule notifications. Support would be added for other service-providers as the project evolves.
- Simple/Bulk WhatsApp notification through a single API call.
- Simple/Bulk SMS notification through a single API call.
- Simple/Bulk rich text Email through a single API call.
- Rate limiter for streamlining bulk notification requests.
- Setup SendGrid and generate an API key
- Setup Twilio, register a number, generate API key and setup SMS and WhatsApp.
- Setup SQS
- Install Docker
- Clone this project
git clone https://github.com/kaushalvivek/notification-microservice.git
cd notification-microservice
- Create environment file
vim .env
Provide all the values as specified in sample_env.sh
- Start the micro-service
sudo docker-compose up -d
POST request to : host:PORT/api/v1/notify/email
Request body:
{
"data":[
{
"content":{
"subject" : "Sample Email's Subject",
"html" : "<p> Sample email's body</p>"
},
"targets":[
"[email protected]",
"[email protected]"
]
}
{
"content":{
"subject" : "Sample Email 2's Subject",
"html" : "<p> Sample email 2's body</p>"
},
"targets":[
"[email protected]"
]
}
]
}
POST request to : host:PORT/api/v1/notify/whatsapp
Request body:
{
"data":[
{
"content":{
"body" : "This is a sample message!"
},
"targets":[
{
"countryCode":"+1",
"phone":"123456789"
},
{
"countryCode":"+91",
"phone":"9876543211"
}
]
}
{
"content":{
"body" : "This is another sample message!"
},
"targets":[
{
"countryCode":"+1",
"phone":"123456789"
}
]
}
]
}
POST request to : host:PORT/api/v1/notify/sms
Request body:
{
"data":[
{
"content":{
"body" : "This is a sample message!"
},
"targets":[
{
"countryCode":"+1",
"phone":"123456789"
},
{
"countryCode":"+91",
"phone":"9876543211"
}
]
}
{
"content":{
"body" : "This is another sample message!"
},
"targets":[
{
"countryCode":"+1",
"phone":"123456789"
}
]
}
]
}
Feel free to create issues in this repository for contribution. Contributions guidelines would evolve along with the project. Tests for integration would be added soon.
Copyright (c) 2021 Vivek Kaushal