I am getting internal server error when trying to send notification using anh.

Shikhar Saxena 0 Reputation points
2025-06-12T13:08:45.77+00:00

Notification payload: {

"notification": {

"title": "Notification Without URL",

"body": "This notification does not include a URL"

},

"data": {

"url": ""

}

}

Error sending notification: Could not read notification body from the request

Getting this error

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.
{count} votes

1 answer

Sort by: Most helpful
  1. Bhargavi Naragani 7,445 Reputation points Microsoft External Staff Moderator
    2025-06-12T15:22:56.0033333+00:00

    Hi @Shikhar Saxena,

    Error Interpretation “Could not read notification body from the request” this is a known internal server error from ANH when the payload is invalid or not properly formatted for the platform you're targeting (like FCM for Android, APNs for iOS, etc.), especially if you're passing it directly to ANH. Also, an empty string in the url field could be triggering a problem if the client app expects a valid URL.

    Azure requires that the FCM payload strictly follow the format defined by Firebase. ANH does not automatically validate or fix the payload, so an incorrect structure immediately fails. Here’s how a valid FCM native payload for Notification Hubs looks:

    {
      "data": {
        "message": "This notification does not include a URL"
      },
      "notification": {
        "title": "Notification Without URL",
        "body": "This notification does not include a URL"
      }
    }
    

    If you're sending this payload using the Azure Notification Hubs SDK or REST API, you should make sure that you specify the format as application/json and you wrap the above JSON string into a string payload (not object if using SDKs).

    Also, if you’re targeting a specific platform (like FCM), the request must be structured accordingly. For example, using .SendFcmNativeNotificationAsync() in .NET SDK or specifying Content-Type: application/json in HTTP.

    https://learn.microsoft.com/en-us/rest/api/notificationhubs/
    https://learn.microsoft.com/en-us/azure/notification-hubs/notification-hubs-push-notification-overview#platform-specific-payloads

    Hope this information is helpful, if you have any further updates on this issue, please feel free to post back.


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.