Azure Notification Hub Toast Notification Invalid Payload

Brendan Hadley 0 Reputation points
2023-11-20T04:31:34.74+00:00

0

In the Azure portal within the Notification Hub I am trying to send test Toast notifications to two of my registered devices. Both of them fail. Sending Raw messages works fine, and I really can't figure out why this is happening.[enter image description here

](https://i.stack.imgur.com/8LVGV.png) I've tried multiple different XML layouts, following Microsoft's documentation, but it ALWAYS fails for Invalid Payload

I've tried multiple different XML layouts, following Microsoft's documentation, but it ALWAYS fails for Invalid Payload. It could be I am somehow typing in the wrong XML every time, but that doesn't feel likely. Any help would be greatly appreciated.

QA Assist help did not do anything.

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.
327 questions
.NET MAUI
.NET MAUI
A Microsoft open-source framework for building native device applications spanning mobile, tablet, and desktop.
3,696 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Q&A Assist
    2023-11-20T04:31:34.75+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    It seems that you are having trouble sending Toast notifications to your registered devices in Azure Notification Hub. The error message you are receiving is "Invalid Payload". This error usually occurs when the XML payload is not formatted correctly. I suggest double-checking your XML layout to ensure it follows Microsoft's documentation. It's also possible that the issue is with the registered devices themselves. Have you tried sending test notifications to these devices using the Test Send feature in the Azure portal? This can help you determine if the issue is with the payload or the devices.


    References:

    0 comments No comments

  2. SnehaAgrawal-MSFT 21,926 Reputation points
    2023-11-21T05:57:38.6266667+00:00

    @Brendan Hadley

    Thanks for reaching here! I understand Q&A Assist was not helpful to you. Please consider below response.

    It seems that you are facing an issue while sending a toast notification using Azure Notification Hubs. The error message

    "The Notification payload is invalid" indicates that the payload you are sending is not in the correct format.

    Make sure that you are using the correct XML format for the toast notification. You can refer to the following link for the correct format: https://docs.microsoft.com/windows/uwp/design/shell/tiles-and-notifications/toast-xml-schema.

    It seems like the XML payload you are using is correct and should work. However, there might be some issue with the way you are sending the notification. Could you please verify below  things

    1. Check if you have provided the correct values for the required fields in the XML payload, such as the text for the toast message.
    2. Verify that the package identity and publisher identity in the Package.appxmanifest file match the values in the Azure portal.
    3. Ensure that the notification payload is less than 5KB in size.

    If you have already verified above things and the issue still persists, you can try using a different template for the toast notification.

    You can refer to the following link for more information on the different other methods for Toast notifications: https://learn.microsoft.com/en-us/windows/apps/design/shell/tiles-and-notifications/adaptive-interactive-toasts?tabs=appsdk

    If the issue still persists, could you please reach out to us by sending an email with subject line “Attn:Sneha |thread title” to AzCommunity[at]microsoft[dot]com referencing this thread, would like to take deeper investigation on this.

    0 comments No comments

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.