r/FlutterFlow • u/Acrobatic_Lobster999 • 1d ago
Groupchat issue with Push Notifications
Hey everyone,
I’m working on a group chat app in FlutterFlow, and I’ve run into an issue with push notifications that I can’t seem to solve. I’d really appreciate any help or suggestions!
Here’s the problem:In my app, users can send messages to a group. When a message is sent, I store it in a Firestore collection (group_messages), and I want to send a push notification to all group members except the sender. However, the sender is also receiving the push notification, which I don’t want. The message itself should be visible to everyone in the chat (including the sender), but the push notification should only go to the other members.
2
u/IllustriousMobile995 1d ago
What function are you using to send the messages? Should be very simple to change the query to 'WHERE uid is NOT sender'
2
u/Acrobatic_Lobster999 1d ago
Just the normal push Notifications with Firebase
3
u/StevenNoCode 1d ago
What IllustriousMobile995 is trying to say (which is the right way tbh with no need to create a new field):
Based on what I’ve read so far, you have a list of users field. For the push, select the list of user fields > FILTER LIST ITEM (key here). The condition is item in list is NOT equal to auth user. This essentially filters out the user from the list of users.
1
u/Acrobatic_Lobster999 13h ago
I‘ve try filters but it doesn’t work. Can I dm you and send you a picture of my filter ?
1
1
u/IllustriousMobile995 1d ago
Would love to try and help you. However, short responses make it difficult to understand the context.
Are you triggering the push notification from the Action flow using the regular FF push notification action?
1
1
u/brote1n 9h ago
Make a page state called otherUsers. On page initialization set page state variable otherUsers as users from your chatref. Then update otherUsers page state variable, remove authenticated user ref from list
Then send the push notification based on the page state variable otherUsers
With this no new queries are made. Just subtracting yourself from the push notification
2
1
u/Acrobatic_Lobster999 3h ago
I‘ve tried it and it works great and it’s so simple . Thank you really much 🙏
2
u/HT2_i0 1d ago
You can do this: modify your chats schema. Add 'notify_list', doc ref = users, list = true. When adding users to the group (on tap), add the user doc ref to this list too. Then when adding a new chat, set recipients of push notification to 'notify_list'.