Hi! I am trying to send push notifications from Appwrite console on a self-hosted environment to native applications using FCM. While the service works fine, and the application will receive notifications both in foreground and background, notifications received while the app is in foreground contain no message or title. I've been troubleshooting this for a bit, and found that the payload sent to FCM services is missing a data field in the object. While taking a brief look through the UTOPIA PHP adapter used for messaging in Appwrite, specifically in the FCM class, I noticed this is indeed the case. The class is found here: https://github.com/utopia-php/messaging/blob/main/src/Utopia/Messaging/Adapter/Push/FCM.php
Take a look at the bare example of the expected payload below, to see which fields are mapped to which Application state.
{
"message": {
"token": "some-token",
"notification": {
"title": "Works in background",
"body": "This message is successfully received while app is in background."
},
"android": {
"priority": "high",
"data": {
"title": "This title is visible while the app is in foreground.",
"message": "This message will be seen in the push notification while the app is in foreground."
}
},
"data": {
"href": "chat"
}
}
}
Hello! Thanks a lot! Can you create an issue on GitHub so the team takes a look into it?
Recommended threads
- Does a user need to be registered in App...
If I want to send an email (for example, to xyz@gmail.com) from an Appwrite Cloud Function, does that email address need to be registered as a user in Appwrite?...
- Custom Topic sent from Function (with sc...
Can I send a message on a custom topic? So clients can subscribe to them?
- can't send emails
i explored the docs and it says Messaging.CreateEmail() but this function does not exist , i installed appwrite on next js env everything works fine except thi...