0

I am unable to send multiple messages at once. I have gone through the FCM docs but did not find any endpoint.

https://firebase.google.com/docs/cloud-messaging/send-message#send-a-batch-of-messages

headers = [
  {"Authorization", "Bearer #{access_token}"},
  {"Content-Type", "application/json"}
]

response =
  HTTPoison.post!(
    "https://fcm.googleapis.com/v1/projects/digimep-f4db3/messages:send",
    Jason.encode!(payload),
    headers
  )

Let me if you guys have any idea about this.

1 Answers1

0

From the Firebase documentation on sending multiple messages over REST:

The batch send methods described in this section were deprecated on June 21, 2023, and will be removed in June 2024. For protocol, instead use the standard HTTP v1 API send method, implementing your own batch send by iterating through the list of recipients and sending to each recipient's token.

So there is no separate call for sending messages to multiple recipients in the v1 API of Firebase Cloud Messaging. You will have to make a separate call to the API for each message.

If you're calling the API over HTTP/2, you can use multiplexing to send multiple separate requests over a single connection and amortize the cost of establishing the connection.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807