DEV Community

Yarden Even
Yarden Even

Posted on

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.

Oldest comments (4)

Collapse
 
koas profile image
Koas

Hi! I use Telegram since that allows the user to reply and interact with my web app.

Collapse
 
yarduza profile image
Yarden Even • Edited

Your app is a mobile app? If so, do you collect your users' numbers upon registration?

I was referring to in app notifications and not push notifications. So it could be notifications about your post that received a feedback or someone inviting you to a video session.

I'm not sure there's a use case for them replying back to the "system" for this type of notifications.

I should probably rephrase my title as "How would implement an internal notification system?"

Collapse
 
koas profile image
Koas

Oh... Ok, I think I misunderstood the subject! :)

Mine is a web app, mobile users access it via their regular web browser, I use Telegram to send them push notifications and they can reply to it via Telegram.

Thread Thread
 
yarduza profile image
Yarden Even

Nice setup! Can't help me here, but definitely gives me food for thought for implementing push notifications.