FCM V1 notifications are not delivered from Azure Notification Hub
V

4

7

I am following this Microsoft Guide to migrate from GCM/FCM notifications to FCM v1.

From the guide, I -

1.Configured the Firebase Service Account Credentials in Azure Notification Hub

2.Updaeted backend and app (Xamarin) to use FCM v1 platform during installation & registration of push notification -

/* Installation */
var installation = new Installation() 
{ 
    InstallationId = "installation-guid", 
    PushChannel = "firebase-token", 
    Platform = NotificationPlatform.FcmV1 
}; 
installation.Tags = ... Assign tags; 
installation.Templates[key] = "fcm v1 template"; 
hubClient.CreateOrUpdateInstallationAsync(installation);

/* Update Tag Based On User Id */
await hubClient.PatchInstallationAsync(installationId, new[]
{
    new PartialUpdateOperation
    {
        Operation = UpdateOperationType.Replace,
        Path = "/tags",
        Value = userId.ToNotificationTag()
    }
});

3.Verified that the device is actually registered in notification hub (by getting registrations from notification hub) Registration Description Json from Notification Hub

4.Verified that notification is delivered to app when sent from firebase console. (Using firebase token (value of PushChannel in installation object)

The problem is:

  1. When sending notification from "Test Send" in Azure Portal, it does not get delivered and I can see error under 'FCM v1 Errors' metrics. Notification failed from Azure Portal

  2. When sending template notification from code (C# - Microsoft.Azure.NotificationHubs nuget), it shows same error. Code to send template notification

Here are some tracking id (I don't know how I can use those to get more information):

  • eba8824d-6625-46ca-aa4c-b89cf4fbf9a3
  • d1638928-dc27-49ee-a4ee-2ccc1451acb6
  • 58e2b6b4-1075-465a-9f17-1d6810e6d9b4
  • 0d62ae4c-495c-4da5-8bbe-ed1b43d00413

More information - After upgrading notification hub to standard tier, I got this telemerty details -

<?xml version="1.0" encoding="utf-16"?>
<PnsFeedback xmlns:i="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://schemas.microsoft.com/netservices/2010/10/servicebus/connect">
    <FeedbackTime>2024-04-18T16:20:35.1678121Z</FeedbackTime>
    <NotificationSystemError>UnknownError</NotificationSystemError>
    <Platform>fcmV1</Platform>
    <PnsHandle>eJpiCAulSye7BfsmmqZ6Dl:xxxxxx</PnsHandle>
    <RegistrationId>7159908837859365990-7306945109327663386-8</RegistrationId>
    <NotificationId>NH-20240418162035079-5f4b5669ff814d269738156327a12cc3-08</NotificationId>
</PnsFeedback>

and equvivalent registration -

{
        "eTag": "4",
        "expirationTime": "2024-04-18T16:16:32.7765811Z",
        "registrationId": "7159908837859365990-7306945109327663386-8",
        "tags": "$InstallationId:{6966898c-0231-4a23-ac96-77456ad5cc13},userId:12041U",
        "fcmV1RegistrationId": "eJpiCAulSye7BfsmmqZ6Dl:xxxxxx",
        "bodyTemplate": {
            "value": "{\"message\":{\"android\":{\"data\":{\"message\":\"$(messageParam)\",\"attachmentLink\":\"$(attachmentLinkParam)\",\"thumbnailLink\":\"$(thumbnailLinkParam)\",\"type\":\"$(typeParam)\",\"additionalData\":\"$(additionalDataParam)\",\"toId\":\"$(toIdParam)\",\"isPublic\":\"$(isPublicParam)\"}}}}"
        },
        "templateName": "genericMessage"
    }
Victoriavictorian answered 16/4 at 11:55 Comment(7)
You can use SDK method: hub.GetNotificationOutcomeDetailsAsync(outcome.NotificationId); to retrieve notification status informationDusty
Hi Hiren, Can you sharw with me how you did step 2 ? Updated backend and app (Xamarin) to use FCM v1 platform during installation & registration of push notificationDusty
@AdriánRomero - Hi, the problem is NotificationId from outcome is always null even when sending notification in test mode. The outcome is always 0 failed, 0 success with Enqueued state.Victoriavictorian
@AdriánRomero - Added relevant code and screenshots in the questionVictoriavictorian
TO have telemetry, your notification hub has to be on standard tierDusty
@AdriánRomero - I updraded to Standard tier and it shows same error as Azure Portal :( . Added details in the question!Victoriavictorian
Let us continue this discussion in chat.Victoriavictorian
V
3

Ok, It seems everything was fine.. Except, we forgot to enable Firebase Messageing API on Google Cloud Console

Victoriavictorian answered 19/4 at 13:56 Comment(2)
Can you tell us where you enbaled this? Maybe add a screenshot to your answer?Stansberry
Go to console.cloud.google.com and then search "Firebase Cloud Messaging" service and enable it.Victoriavictorian
S
1

We have the same problem, I think. We use templates. We've changed the call to installations to specify FCMv1 as the platform, and we've changed the template. When retrieving the installation, I see it is indeed registered on the NotificationHub.

When sending a template message via the messages REST API we use the test querystring to get a NotificationOutcome. In that result, we always get a value of 0 for both Success and Failure.

It's just like the NotificationHub doesn't "see" the FCMv1 installations when it searches for installations to send the template message to.

Google Firebase has been configured correctly. When we send a direct FCMv1 message from the NotificationHub, to the same tag, the NotificationHub does show Success: 1 and the notification is actually received on the device. When we send a template message from the NotificationHub interface, to the same tag, it too show 0 for both success and failure.

Stansberry answered 8/5 at 14:19 Comment(2)
Why dont try direclty with SDK ? with LINQPAD for example, that helped me to debugDusty
It turns out that using test send with templates just doesn't work with FCMv1 installations. See here.Stansberry
G
0

This is not the case with me. SendTemplateNotification does not work for me.

Greenway answered 23/4 at 12:41 Comment(1)
Share more details, so that we can helpVictoriavictorian
D
0

We are in the same situation as Mr.comecme. We have asked Microsoft to investigate the cause, but a solution has not yet been reached. If you have resolved the issue, I would appreciate it if you could let me know how to do it.

Drandell answered 29/5 at 1:40 Comment(3)
Question, Did you updated your xamarin code to register as FCMv1 ?Dusty
Thank you for your comment. I don't use xamarin. First, we registered a test user who uses the fcmv1 template in Azure. Next, I tried sending a test message from potal to firebase cloud for that user, but I was in trouble because 0 was returned for both success and failure.Drandell
1. Move to standard tier and verify if you see detaili outcome 2. If above does not help, after registration, get all registration from notification hub and verify you see correct registration. 3. When sending notification, verify it's pick up the correct registration (this can be seen in outcome or even on azure)Victoriavictorian

© 2022 - 2024 — McMap. All rights reserved.