Search code examples
c#firebasefirebase-cloud-messagingfirebase-admin

How do i add Link to firebase cloud messaging with .net admin sdk


I am using the Firebase .net Admin SDK on my back end to send push notifications.

According to this link I should be able to add the following json into a message object that will open the set link when the notification is clicked on while the app is in background.

  "webpush": {
    "fcm_options": {
      "link": "https://dummypage.com"
    }

I have read through the .net Admin Sdk documentation but cannot figure out where to add this. Here is the code that I used to new up the message object

var fcm = FirebaseAdmin.Messaging.FirebaseMessaging.DefaultInstance;
var Message = new Message()
  {
    Notification = new Notification
      {
        Title = title,
        Body = message,
      },
    Token = user.PushTokenWeb,
  };
var result = await fcm.SendAsync(Message);

Does anyone know where I would set the callback link?


Solution

  • .NET SDK does not support this setting yet. It's only exposed in Node.js and Go at the moment. You can provide a pull request at https://github.com/firebase/firebase-admin-dotnet to implement this feature.