You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
🚀 Enhancement: query messages by user and target #8974
Enable querying of Messages by userId or targetId.
🎤 Pitch
In my use-case, I would like to check if I have already scheduled a push notification for a specific user. Ideally, I would like to list all messages of status scheduled for the given user or target. Currently, I cannot do that as the allowed attributes for filtering are: scheduledAt, deliveredAt, deliveredTotal, status, description, providerType (according to your docs).
The current workaround is for me to keep track of the messageIds for each user, which is unnecessary duplication as AppWrite already does this for me - I just can't query it.
👀 Have you spent some time to check if this issue has been raised before?
An additional use case: I would like to cancel all push notifications if a user has opted out of them.
I think one way to opt out of push notifications, would be to have a boolean attribute in a "Users Collection" which is true if such a user has enabled push notifications. to cancel, you would have to update the document by the Id of the user from the collection , and set the boolean to false, also you have have to update the messaging as well, NOTE if it is connected to the user you could seamlessly update it. Hope this helps, let me know if ya have any questions .
@Jstreetman, thank you for the suggestion. If I understand correctly, I would still need to keep track of all the scheduled messageIds of the user, correct?
In the meantime, I am removing the push target when a user opts out. This causes the messages to fail delivery, but the attempt is still made.
Thanks
An additional problem: if I keep track of messageIds in the front end, then someone who uninstalls and reinstalls will still get the previous push notifications. (it defines as the same push target, apparently). I am aware that there are workarounds for this as well (keeping data, saving messageIds in appwrite, etc), but this is a needlessly complex solution compared to querying by userId.
Message result = await messaging.createPush(
messageId: ID.unique(),
title: "Time to smell!",
body: "Tap to tell us what you smell!",
users: [userId], //user to push to
data: {"time": time}, //time set for notification
tag: "Smellit_notification",
scheduledAt: time,
);
Is there any progress on this issue? It's making our code needlessly complex, and creating a worse user experience as we cannot check if a user already has scheduled notifications.
Activity
danielle-h commentedon Nov 17, 2024
An additional use case: I would like to cancel all push notifications if a user has opted out of them.
Jstreetman commentedon Nov 24, 2024
I think one way to opt out of push notifications, would be to have a boolean attribute in a "Users Collection" which is true if such a user has enabled push notifications. to cancel, you would have to update the document by the Id of the user from the collection , and set the boolean to false, also you have have to update the messaging as well, NOTE if it is connected to the user you could seamlessly update it. Hope this helps, let me know if ya have any questions .
danielle-h commentedon Nov 24, 2024
@Jstreetman, thank you for the suggestion. If I understand correctly, I would still need to keep track of all the scheduled messageIds of the user, correct?
In the meantime, I am removing the push target when a user opts out. This causes the messages to fail delivery, but the attempt is still made.
Thanks
danielle-h commentedon Nov 26, 2024
An additional problem: if I keep track of messageIds in the front end, then someone who uninstalls and reinstalls will still get the previous push notifications. (it defines as the same push target, apparently). I am aware that there are workarounds for this as well (keeping data, saving messageIds in appwrite, etc), but this is a needlessly complex solution compared to querying by userId.
stnguyen90 commentedon Dec 10, 2024
@danielle-h, when you're creating the message, are you putting the user's ID in the
usersparam?danielle-h commentedon Dec 11, 2024
@stnguyen90 Yes. This is the code:
dhonig-weizmann commentedon May 18, 2025
Is there any progress on this issue? It's making our code needlessly complex, and creating a worse user experience as we cannot check if a user already has scheduled notifications.
bhardwajparth51 commentedon Apr 7, 2026
Is this still open to work. I'd love to work on this