Introduction
A multipurpose notification library to send mail, text, slack, push, telegram etc. developed in Go
Design Goals
- Should be Simple and Easy to build hence
Go
programming language is selected
- Deployment shouod be
xcopy
and cross platform, Go
meets this out of the box
- Should be serverless lambdas function but should impose any AWS or Azure style coding. Apex Gateway solves this.
- CI/CD should be out of the box without writing any code like Github actions, Lambda deployment etc. Netlify takes care of this
- Log analysis and debug capabilities - suppoered using custom
Go
logger which Netlify exposes thru GUI.
- Maintenance cost should be
$0
. Yes, everything should be Free
Pre-requisites
- Should have Go installed in your local development environment
- Optional netlify account to deploy the golang api's as serverless functions
- Optional netlify CLI
- Optional if you want to send HTML formatted email using mailgun template. I used Maizzle to build HTML emails with
Tailwind CSS
https://maizzle.com/
- mailgun account as the
notify
(sendmail) api is built using mailgun
- VSCode Editor or Gitpod online VSCode editor 50 hours per month free plan
Local Development
Clone repository.
git clone https://github.com/senthilsweb/notifier.git
Local build (Mac OS)
go build
Local Run
./notifier -p "3000"
Available REST API Endpoints
The following APIs implemented and readily available to use in your projects
https://zybes.netlify.app/api
Payload for https://zybes.netlify.app/api/notify/mailgun
{
"message": {
"subject": "This is subject",
"body": "This is body",
"template": "welcome_email",
"recipient": "name <your email@gmail.com>",
"payload": {"name":"John Smith"}
},
"MAILGUN_DOMAIN": "your domain",
"MAILGUN_KEY": "your key",
"EMAIL_SENDER": "Mailgun Sandbox <your sender>"
}
Netlify Deployment
Refer the following documentaion and blog post to host the server (and optional Single Page Application) at Netlify
Key Frameworks and Libraries used
- github.com/apex/gateway
- github.com/gin-gonic/gin
- github.com/mailgun/mailgun-go/v4
- github.com/sirupsen/logrus
- github.com/spf13/viper
- github.com/tidwall/gjson