How do you implement notifications?

yarduza

Yarden Even

Posted on June 13, 2021

How do you implement notifications?

Checking the collective wisdom for ways of improvement.

  • What's your solution?
  • How do you treat read notifications?
  • Do you use email and mobile notifications?

I use raw Firestore. I created a notifications collection with user documents that restricts access only to the user using the Firestore policies.

In view I created a "notification center" where all notifications are gathered.

On the backend I built several notification types. I send the relevant type to Firestore using the admin SDK, saved under the relevant receiving user. There's also a sender field. The whole thing is being managed by an internal notification service.

type CoLearnRequestNotification struct {
    ID                  string              `json:"ID"`
    ActionID            string              `firestore:"actionID" json:"actionID"`
    Type                string              `firestore:"type" json:"type"`
    CreatedAt           string              `firestore:"createdAt" json:"createdAt"`
    Requester           User                `firestore:"requester" json:"requester"`
    Read                bool                `firestore:"read" json:"read"`
}
Enter fullscreen mode Exit fullscreen mode

On the front-end I use a Firestore listener. I use VueFire and VuexFire since I'm on VueJS. I store them in the Vuex store.

In order for a notification to be considered as "read", the user has to click an "x" button and remove it from the notification gadget.

Email: Currently building an internal email service. Mobile: we don't have a mobile app... yet.

💖 💪 🙅 🚩
yarduza
Yarden Even

Posted on June 13, 2021

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related

How do you implement notifications?