
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
- Is anyone able to use createPush with mu...
Hello everyone! I use the createPush method in a function to send push messages to users (using FCM). The code below works fine. You can see I'm sending a push...
- Various Issues with Selfhosted Instance
When Creating sites, applications and messages i get different errors in Appwrite: When adding Site: Cannot access offset of type string on string When buildi...
- Unable to create push providers - FCM or...
Currently unable to create a push provider for FCM or APNS.... https://github.com/appwrite/console/issues/2045 When uploading a file... FCM = Valid file retu...
