Push notification on reaction added/removed

Hi there,

I’ve setup the reactions on my account and can successfully add and remove reactions to messages in my group channels (react native). However, I do not get sent push notifications when a reaction is added to my messages:

  • Is there a plan to add reactions as part of the push notification triggers?
  • Can I trigger them manually?

Hi @SafiyyaBabio

Unfortunately, we do not trigger for reaction at this moment and I doubt we have any plans to support it near future. And you cannot trigger push notification unless you send a message.

2 Likes

Hi @SafiyyaBabio,

Since your FCM tokens are managed by you, you could technically send your own notifications with a pretty simple setup and a bit of configuration. This is just a workaround, but it could help you accomplish what you need.

The idea: Triggering your own push notification method to the onReactionUpdated() listener.

Example in React-Native (but the same principle would apply to iOS and Android):

  1. Setup react-native-firebase (https://rnfirebase.io/messaging/)

  2. Configure your notification payload by grabbing the content you need from the reaction object, which contains the content for your notification payload:

{
    "user_id": "Jessie",
    "operation": "ADD",
    "success": true,
    "reaction": "celebrate",
    "updated_at": 1577327594231
}
  1. Set that up as part of your _body payload and call firebase.Notification()
const notification = new firebase.notifications.Notification()
  .setNotificationId(_id)
  .setTitle(_title)
  .setBody(_body);

Let me know if this helps. Will be cool to see you implement it!

Cheers,

David

2 Likes

Good idea! However that would only works if the app is on foreground tho. Because if the app is on background, websocket is disconnected and I doubt that onReactionUpdated callback would be get called.