Advice, direction on push notifications

Hey guys!
I could use some pointers on this topic… the push notifications mostly work, there’s one weird step where I’m stuck and can’t seem to find any relevant information.
I’m still on capacitor 5, latest version of the capacitor/push-notifications (5.1.2), Ionic 6, Vue3.

I’m trying to get the body and t itle of the notification in the app and just show an alert with it. The Received listener works fine with foreground notifications, but the Performed listener for the background notifications doesn’t contain the body or title of the notification. This just feels like a bug in the package maybe? Has this always been the case, is it new? What’s going on??

The ActionPerformed interface says I should get an actionId, an optional inputValue, and a notification, which has the same interface as the one coming from the Received listener… body, title and all that.

What I’m seeing in devtools though, is this:

actionId: "tap"
notification:
  data:
    collapse_key: "example.app"
    from: "123456789"
    google.delivered_priority: "high"
    google.original_priority: "high"
    id: "0:684652313275675%d6f54g4jh65t4yikj65fg"

By comparison, Received listener looks like this:

body: "my test body"
id: "0:684652313275675%d6f54g4jh65t4yikj65fg"
title: "my test title"

Has the ActionPerformed ever actually contained the notification? Is this a bug in v5? Would it actually contain the notification in v6?




Thanks in advance for any feedback/tips :v:



edit: I upgraded to capacitor 6, still not getting body/title in ActionPerformed… :unamused:

Maybe add the title and body as custom data items so they are available for you? We send and receive custom data with no problems.

That would be an idea, yes. But I see the custom data values are limited to 200 characters, not sure if that would satisfy future needs. And was also not sure if this is a me problem, or how the package works.

Found some interesting issues in github, although I rather not deal with java :see_no_evil:

Where do you see that? I just did a test with a body of 476 chars plus other custom data pairs.

{
    "actionId": "tap",
    "notification": {
        "id": "0:1724073868151311%188b24c9188b24c9",
        "data": {
            "channel_id": "community_messages",
            "google.delivered_priority": "normal",
            "notification_type": "community_message",
            "google.original_priority": "normal",
            "action": "community_message",
            "other_info": "{\"community_id\":\"f7f8d939-f162-4709-ac8e-3b8fe6b2526b\"}",
            "body": "Geovany Leffler: This is a really long push notification. It keeps going and going and going. Does it ever stop? I am not sure.\n\nLet's try some line breaks. Wow, this message keeps going and going. Ok, is this long enough? Hmmm, not yet. we are just over 200 chars.\n\nGoing and going and going. It sure is a beautiful day. How is your day? Is this enough yet? I am not sure. Let's do a few more sentences. Ok, what about this? Are you sure? Nope, not sure. Let's keep going and going and going.",
            "from": "1028833445258",
            "title": "New Test message",
            "route_info": "{\"name\":\"community.view\",\"query_params\":{\"id\":\"f7f8d939-f162-4709-ac8e-3b8fe6b2526b\",\"segment\":\"messages\"}}",
            "created_at": "2024-08-19T13:24:27+00:00",
        }
    }
}

The only limit I am aware of is a total payload of 4096 bytes.

Maximum payload for both message types is 4096 bytes, except when sending messages from the Firebase console, which enforces a 1000 character limit. (source)

Hmm. Must be a firebase web console thing.
Either way, using data attributes is not good enough those who’ll actually send the notifications, so time to explore that other option, the one with extending the native code.
Thank you very much for your time either way! :v: