As suggested in the official document, we could use Get Notification Message telemetry REST API when we have issue/failure with pushing notifications in the Azure Notification Hub. We can use this API to review and monitor the pushed notifications. There is one prominent property named PnsErrorDetailsUri for our troubleshooting which indicates the details of error reported by PNS. However, the PnsErrorDetailsUri might not be found in the response payload sometimes when we use SDK which blocks our investigation. This article provides some troubleshooting threads to narrow down why we can’t invoke Telemetry API successfully or get PnsErrorDetailsUri property while invoking this API.
2.If no errors were reported by a PNS, the PnsErrorDetailsUri property will not be included in the response payload. Please kindly refer to multiple common errors and possible reasons of this API.
3.Generally, state of message progress could be following values:
If there is any issue while publishing notifications, PNS error details can be found from PnsErrorDetailsUri property after the associated send operation is complete. Please verify if the status tag is Completed in the response payload. The PnsErrorDetailsUri won’t show up when the message is in other statuses.
<NotificationBody><?xml version="1.0" encoding="utf-16"?><toast><visual><binding template="ToastText01"><text id="1">Hello from a .NET App!</text></binding></visual></toast></NotificationBody>
4.If the PnsErrorDetailsUri value could not be found in the response payload after ruling out above possibilities, please kindly refer to following considerations:
A. While calling REST API directly, please make sure you are setting API version as 2016-07 and above because the PnsErrorDetailsUri requires Api-Version 2016-07 at least.
B.While calling REST API via SDK, the underlying request may not follow API pattern. For example, we are using historical version 1.0.3 of Microsoft.Azure.NotificationHubs package, there isn’t particular parameter of API version can be passed easily probably.
You could capture the details of testing request by Fiddler tool or other web debugging proxy server tool so that you could decrypt the https request data and verify the specific API version which is used in SDK method by default. Please kindly enable the HTTPs capture feature by the following options(Tools --- Options)
Once the pushing message is triggered, we could check the used API version in the detailed raw data of specific request. As shown below, 2015-04 is used so that we could not get the PnsErrorDetailsUri property successfully.
After upgrading the latest SDK version to 4.1.0, the underlying invoked API version is upgraded as well.
Once we get the value of PnsErrorDetailsUri, we could use the Azure Storage API to read the blob.