DEV Community

Cover image for I built an automation to notify users when something of their interest is published
hrishikesh1990
hrishikesh1990

Posted on • Originally published at remote.tools

I built an automation to notify users when something of their interest is published

I am the co-founder of Flexiple and Remote Tools. In this post, I describe why & how I built an automation on our community website to notify users on email when something of their interest is posted.

Here's why & how I built this.

Effort: Dev - 1 day, QA - 1 day.

Cost: None.

Business Problem

We want to get users more engaged. So I tag people manually which triggers an email notification & prompts them to reply.

Inefficient because it relies on my memory & limit on the # of people I can tag.

Can I automate this?

The key to successful teamwork in your remote team - team teamwork

Solution

- Map interests against users basis profile information (one-time effort).

- For every story posted, mark relevant interests.

- If any interest for a story matches that of a user, notify the user on email.

- Keep the email as personalised as possible.

The key to successful teamwork in your remote team - team teamwork

Constraints

Limit # of times any user is tagged in a week

Randomly pick users after matching interests (for the post)

Limit # of people tagged on any post

No user to get multiple notifications for the same post

Remove post author & users who've already engaged

Database Mapping

- has_many_through association

- User has many interests. An interest can be mapped to multiple users.

- Story has many interests. An interest can be mapped to multiple stories.

Map interests for users & populate DB

- One-time effort to manually map interests for existing users basis their profile data. Used Google sheets for this.

- Wrote a simple script to transfer the data to DB.

Map interest(s) for stories (admin access only)

For every relevant story, admins can map interests and that's it! Interested users are notified on email.

Interest mapping fields are shown only to admins & not regular users.

The key to successful teamwork in your remote team - team teamwork

I write regularly on Twitter about tech, products & startups. You can connect with me there.

Top comments (0)