Skip to content

Feature: Email Notifications #9

@NunoDasNeves

Description

@NunoDasNeves

Feature
A basic MVP email notification system would provide groundwork for a richer site experience and higher user engagement.
Email notifications draw existing users back to the site.
Infrastructure required for email notifications can be used for on-site popup notifications, notification feed, notification options including opt-in/opt-outs, subscribe (or 'watch') to a thread etc...

For MVP I propose default email notifications for the following events:

  • User answered your question
  • User commented on your review
  • User posted a comment/answer in a thread you commented/answered in

With a single option in the Profile view to turn off all email notifications (and probably a link in each email to unsubscribe which has the same functionality.)

Implementation
This design is primarily based off this quora answer.

We need several new tables:

  • A subscriptions table that associates user IDs with objects that can be subscribed to - for MVP this would be questions and reviews.
  • A queue table whose ORM implements a notification queue with 'push' and 'pop' operations (possibly a bit more granular than this...)
  • A settings table for storing notification preferences and other settings for each user. Pros and cons of different schemas for this are discussed here. I think the 'property bag' method is the way to go - aka a row for each setting for each user (max_num_rows = num_users * num_settings). We'll probably be changing the notification settings a lot, so using this method keeps the system flexible. In order to make best use of this we'll need well-defined defaults for each setting, so a missing association between a user and a given setting means 'use the default'.

On posting a new comment, the subscriptions table is queried for all users subscribing to the relevant question/review, then notifications for each user (including all information needed to send the notification) would be pushed to the queue table.

An email daemon (a separate nodejs process) periodically 'pop's notifications off the queue table and sends out emails. (The daemon would first check the settings table for the user)

I'm not sure what the best way to implement the in-email 'unsubscribe' button is - maybe there should be an 'unsubscribe' token in the database somewhere (user table?) which is part of the 'unsubscribe' link and clicking it sends the token, which gets checked by the backend for verification...?

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions