firebasefirebase-cloud-messagingnotification-channel

How to set notification channel when sending messages via rest api?


I've been implementing Notification Channels in my android app to support recent android versions.

You can set the notification channel id when sending messages from the firebase web console, but I was not able to find out how to set the channel id when sending messages via fcm rest api.

Notification channels are not mentioned in the reference (https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages), but I am pretty sure there must be a way to set the channel id.


Solution

  • The key name I was missing is android_channel_id

    I found the key name in the Legacy HTTP Server Protocol docs (https://firebase.google.com/docs/cloud-messaging/http-server-ref)