At Konga, notification is at the heart of every client facing product and most internal products that we build. This affords an easy way to keep in touch with our customers, keep them in the know of what is happening to their orders and for the merchants, let them know what is happening in their store. We seldom send out push notifications for our mobile apps — Android and iOS — but, SMS and emails form the core of our notifications.
As our engineering team grew and different teams had the need to add notifications for their different products, we had the problem that most engineering team faces; everyone implementing things differently.
This route presents a problem, inconsistent coding style and no client library, most of all, keeping track of what was happening and ownership of the third party services we ride on became an issue.
Enter Hermes
Hermes is our in house notification service – Notification as a service(NaaS). It provides a simple RESTFul API for sending notifications; emails and SMS.
The major benefit of Hermes is that it abstracts the underlying API of SMS and transactional email providers into one simple and consistent RESTFul endpoint — /v1/endpoint
— that does one thing and one thing well; send notifications.
Hermes accepts sample payload in this format
The above payload is simple and almost self-explanatory. Below is a brief explanation of what each key means:
medium
- The notification medium: sms
or email
name
- The name of a template. Since we send different notification depending on an action, grouping these actions into templates makes a lot of sense. Template names are typically synonymous with actions: shipped_order, order_received, etc.
recipient
the recipient of the notification.
subject
- Subject of the email. Not required for SMS.
A template is an HTML document with Jinja2 template syntax
The above payload plus the template will translate to an email like this:
Hermes Technology Stack
Hermes is built with the Python Flask framework and it Jinja2 for templating. It uses RabbitMQ for messaging queue, MySQL as its primary data store, Redis for caching and Celery for distributed task queue.
We have been running Hermes for about 2-years now and it handles millions of notifications monthly.
I'll love to hear from you
Do you want to say hello? Email me - celestineomin@gmail.com
I tweet at @cyberomin
If you enjoyed this post, please consider sharing it. comments powered by Disqus