Today, we are open sourcing Noticent, a notification framework for Rails.
What is a notification framework?
Many Rails applications use email as a way to notify their users about different events. For example, your Forum application might want to send emails when a new user joins the forum or a new comment is added. This is quite common and easy to do with Rails Mailers. However, if you need to have notification channels other than email (Slack, Webhooks,...) you need to build a lot yourself. Also, there is all the code around managing subscription: who gets what notification on which "channel" and allowing your users to subscribe and subscribe to those in the app.
What does Noticent do?
With Noticent, you can:
- Define different "channels", like email, Slack, Webhooks, mobile push,...
- Specify the alerts for different parts of your application and how they should be delivered to the users.
- Use simple methods to subscribe and unsubscribe users to each one of the alerts on different channels.
As well as that, Noticent combines the normal ERB based view rendering of Rails with YAML based metadata that can be used for sending notifications. For example, Rails Mailer lets you write the content of an email in an ERB file, but the subject of the email is usually set in the Ruby code. Noticent "views" combine YAML and ERB (using Jekyll's Frontmatter format) to provide a clean break between view and the business logic in your notifications.
On top of the above features, Noticent provides a powerful DSL to define your channels, alerts, payloads, and recipients in code and validates them to ensure you don't get runtime errors because of misconfiguration.
We built Noticent to help us with the notification requirements of our products and think it can be a useful tool for all Rails developers out there.
Feel free to use, share and modify Noticent and don't forget to submit your ideas, feedback, and PRs to its Github repository!
For full installation instructions and some examples check out github page: https://github.com/cloud66-oss/noticent.