Firebase Cloud Messaging send click_action [duplicate]

Someone know one way to send the click_action from the firebase console ?

I just want to send the click_action button to use the notification even if the app is closed or in background.


There is currently no way to set the click_action parameter when using the Firebase Notifications console to send the message.

You'll have to build the payload on your own App Server, or use Postman (instructions here) or cURL (instructions below) when testing.



Sending Downstream Messages via cURL

You can test sending messages using the FCM REST API by sending a request through cURL.

curl --header "Authorization: key=<API_KEY>" \
       --header Content-Type:"application/json" \
       https://fcm.googleapis.com/fcm/send \
       -d "{\"registration_ids\":[\"ABC\"]}"

Syntax retrieved from here.

The API_KEY indicated above is referring to the Server Key that can be seen in your Firebase Console's Cloud Messaging Tab.

The part where:

"{\"registration_ids\":[\"ABC\"]}"

is, can be replaced with your own payload. See the FCM HTTP Protocol Documentation for more details.