title: How do you replace previous notifications sent using Cloud Functions? And how do you prevent getting certain notifications?
body: <p>I'm using Firebase to store what I need for the notifications, and Google Cloud Functions to send the notifications. When a user decides to go to an app, they are subscribed to that event so that they can receive the chat notifications. </p>
  
  <p>My first problem is that they are getting separate notifications for each message, and I imagine that would get pretty annoying in a group chat. I tried using collapseKey, but I think I'm either using it wrong or misunderstanding its purpose. Is it not working because the notification has already been sent? Either way, how do I fix this?</p>
  
  <p>My second problem is that users are subscribed to an event, but because there's a bit of a delay in receiving the notification sometimes, they can get their own message notification if they exit the app before the notification is sent. How do I prevent this?</p>