firebase-admin-go icon indicating copy to clipboard operation
firebase-admin-go copied to clipboard

AndroidConfig.Notification.ChannelId field mapping mismatch between API Explorer and Go SDK

Open batumento opened this issue 7 months ago • 1 comments
trafficstars

Problem:

  • In the API Explorer for FCM REST API (projects.messages/send), the example request body shows the JSON field for AndroidConfig.Notification.ChannelId as "channelId"
  • However, in the Go SDK, this field is mapped as "channel_id" in the struct tags
  • Due to this inconsistency, when using the Go SDK, the notification channel ID is not properly transmitted to FCM, making it impossible to change notification sounds through this field

Proposed Solution:

  • Update the json tag in AndroidConfig.Notification structure from "channel_id" to "channelId" to match the API specification
  • Add tests to verify the fix works while maintaining backward compatibility

The mismatch can be verified at: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send (See the "Try this API" section where the API Explorer shows the correct field name)

batumento avatar Apr 16 '25 04:04 batumento