2

Using the legacy FCM HTTPS API is it possible to send messages to a device or a device group as stated in the documentation here, but their is not information regarding sending a bath of messages via an HTTP post request, we are aware that is it possible to send batch messages using the Admin SDK as shown here in FCM Admin SDK

// Create a list containing up to 500 messages.
var messages = new List<Message>()
{
    new Message()
    {
        Notification = new Notification()
        {
            Title = "Price drop",
            Body = "5% off all electronics",
        },
        Token = registrationToken,
    },
    new Message()
    {
        Notification = new Notification()
        {
            Title = "Price drop",
            Body = "2% off all books",
        },
        Topic = "readers-club",
    },
};

var response = await FirebaseMessaging.DefaultInstance.SendAllAsync(messages);

We are unable to confirm if it its possible to send batch messages via the HTTPS post request.

1 Answers1

0

The Admin SDK wraps the FCM REST API that is documented here. From there:

HTTP request

POST https://fcm.googleapis.com/v1/{parent=projects/*}/messages:send

The URL uses gRPC Transcoding syntax.

So it looks like the REST API expects a post request.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • Isn't this sending a message via HTTP V1 API ? my question is how to send batch messages using Legacy HTTP API. – Daniyal Ibrahim May 15 '22 at 17:33
  • 1
    Ah, I missed that. If I recall correctly you just pass an array of FCM tokens in the `to` property of the message there. --- Just double checked the [docs](https://firebase.google.com/docs/cloud-messaging/http-server-ref) and the parameter name is `registration_ids` if you want to send to multiple tokens (up to 1,000) in one go. – Frank van Puffelen May 16 '22 at 00:06