Azure Notification Hub + FCM v1 returns 201 Created, but notifications not received in Flutter Web app

Rondla Harish Reddy 0 Reputation points
2025-04-14T13:28:55.68+00:00

I'm using Azure Notification Hub integrated with Firebase FCM v1 to send notifications to a Flutter Web app. I have successfully uploaded the Firebase service account details under the Notification Hub’s Firebase (FCM v1) configuration.

Steps followed:

Registered the FCM token from my Flutter Web app.

Sending notifications from a Python script using REST API.

Received 201 Created response — no error returned.

Problem: Despite the 201 Created response, the notification is not received in the Flutter Web app.

Here’s the code I’m using:.

def send_notification(fcm_token, title, body):
    headers = {
    "Authorization": sas_token,
    "Content-Type": "application/json;charset=utf-8",
    "ServiceBusNotification-Format": "gcm",
    #"ServiceBusNotification-DeviceHandle": fcm_token,  # or ServiceBusNotification-Tags: tag
    #"x-ms-version": "2015-01"
   }


    # FCM v1 JSON Payload (fix format)
    payload = {
      "message": {
        "token": fcm_token,
        "notification": {
          "title": "Test Notification",
          "body": "This is a test message"
        }
      }
    }    
    

    response = requests.post(url, json=payload, headers=headers)
    print(response.status_code, response.text)

If I use "ServiceBusNotification-Format": "gcm", I get a 201 response but no notification is delivered. If I change it to "fcm", I get the following error: 400 Could not read notification body from the request

Questions:

What is the correct payload format for FCM v1 when using Azure Notification Hub?

Where can I find the latest documentation for sending notifications using Python with Azure Notification Hub and FCM v1?

Where can I view registered devices and notification delivery logs in the Azure portal?

Thank you!

Azure Notification Hubs
Azure Notification Hubs
An Azure service that is used to send push notifications to all major platforms from the cloud or on-premises environments.
366 questions
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.