Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCM deep linking to URLs #619

Open
wolak88 opened this issue Jul 7, 2021 · 2 comments
Open

FCM deep linking to URLs #619

wolak88 opened this issue Jul 7, 2021 · 2 comments

Comments

@wolak88
Copy link

wolak88 commented Jul 7, 2021

Describe the bug
I can't find a way to send appropriate body to fcm push notifications to get linking to particular URL working. I'm missing:

"webpush": {
      "fcm_options": {
        "link": "https://dummypage.com"
      }
    }

Here is the documentation:
https://firebase.google.com/docs/cloud-messaging/js/receive#setting_notification_options_in_the_send_request

To Reproduce
Create any notification and try to use notification to move to some part of your application.

Expected behavior
After clicking the notification I want to be redirected to particular page.

Logs and other output
ActiveModel::UnknownAttributeError: unknown attribute 'webpush' for Rpush::Client::ActiveRecord::Gcm::Notification.

@aried3r
Copy link
Member

aried3r commented Jul 7, 2021

Hey @wolak88! Rpush sadly doesn't yet support the current FCM protocol, see also #588.

It does support the old, legacy HTTP protocol. You can find the documentation here.

In Table 2c on that page you can find the available payloads for web. They are, as of writing:

Parameter Usage Description
title Optional, string The notification's title.
body Optional, string The notification's body text.
icon Optional, string The URL to use for the notification's icon.
click_action Optional, string The action associated with a user click on the notification.

@duleorlovic
Copy link

It works with click_action. Note that if it s a URL, it has to be on the same domain. If there is a inactive tab opened for that domain, it will switch to it (keeping the current page). If there is no tab opened for that domain, it will open a URL in a new tab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants