Don't Spam Your Users: Batch Notifications for Rails
blog.meldium.com
blog.meldium.com
Possibly the biggest complaint is that if you're collaborating on a project, you never quite know when someone knows what you want them to know...meaning you have to pick up the phone to notify them yourself.
We're removing the feature and defaulting to instant notifications. We'll also offer the users the ability to skip instant notifications in favour of weekly, daily or twice daily summaries depending on what is appropriate for their role in the project.
For now Meldium uses a heuristic to batch so if only one event occurs then you still get the subject line brevity that you mention.
However, for something else that is less important, and likely more noisy, aggregated notifications are ideal.
On our platform, our big feature is forms with routing and approvals. When a form is generated and sent to the organization's users, whoever is assigned to approve the forms would be inundated with submissions if they were not aggregated. They're not time sensitive, so acting upon each submission as they happen is never a concern.
For example, we use trello at my day job to track projects and tasks. They offer to send emails either "periodically (once an hour)" or "instantly". Nevertheless, they still fold multiple actions into a single email if they happen in rapid succession, and send an email that says something like "2 new notifications on the board Development". I would much rather see each notification as a separate email since sometimes they are relevant to me and sometimes they aren't.
I'm assuming when a new user gets added to the org, they probably received one notification saying they've been added to so and so. If that's the case couldn't you just stick all those allowed permissions within the same email?
Coding wise, it is a simple as setting a run_at on our Delayed::Job and a custom queue for this user notification. For every new notification we check if there is another delayed job to be procesed in that queue, if it is the case we just edit the run_at to add a few more minutes.
In our use case, the emails were just records of the transaction, so an hour or two delay to allow for batching of the emails was acceptable.