'Microsoft Graph subscriptions return no notifications
I am trying to subscribe to the Microsoft Graph resource for notifications. I send a subscription request:
{
"changeType": "updated",
"notificationUrl": "<!-- WEBHOOK URL --!>",
"resource": "/communications/presences/<!-- user id --!>/",
"expirationDateTime": "2022-04-25T13:30:00.0000000+00:00",
"clientState": "SecretClientState"
}
I receive confirmation:
{
"@odata.context": "https://graph.microsoft.com/v1.0/$metadata#subscriptions/$entity",
"id": "9596a9f7-5e67-47bf-9368-33c447183725",
"resource": "/communications/presences/<!-- user id --!>/",
"applicationId": "de8bc8b5-d9f9-48b1-a8ad-b748da725064",
"changeType": "updated",
"clientState": "SecretClientState",
"notificationUrl": "<!-- WEBHOOK URL --!>",
"notificationQueryOptions": null,
"lifecycleNotificationUrl": null,
"expirationDateTime": "2022-04-25T13:30:00Z",
"creatorId": "55ee4d42-dbe2-49fb-8fff-63fcdfec136f",
"includeResourceData": null,
"latestSupportedTlsVersion": "v1_2",
"encryptionCertificate": null,
"encryptionCertificateId": null,
"notificationUrlAppId": null
}
Afterwards the webhook forwards me a mail with the validation token message from Graph (for debugging): "'Validation: Testing client application reachability for subscription Request-Id: 9596a9f7-5e67-47bf-9368-33c447183725'"
In the Graph explorer it confirms that a subscription has been created when i list subscriptions.
But when i change presence it does nothing. I receive no hit on the webhook. I even confirmed via the Graph explorer that my presence has changed in the Graph system.
I have also tested with postman with the "official Microsoft Graph" collection where there is a "Subscription validation" feature. It passes all three tests.
I also tried to subscribe for a mail created event. No notification here either.
This has been going on for days so i am fairly sure it is not because the API is temporarily down.
Any ideas what to do?
Solution 1:[1]
As i checked above response code everything looks good, but make sure you have correct webhooks URL (must be https:), could you please try by extending "expirationDateTime", hope this docs will help you - https://docs.microsoft.com/en-us/graph/api/subscription-update?view=graph-rest-1.0&tabs=http .
Subscriptions have a limited lifetime. Apps need to renew their subscriptions before the expiration time. Otherwise, they need to create a new subscription, For a list of maximum expiration times, - https://docs.microsoft.com/en-us/graph/api/resources/subscription?view=graph-rest-1.0#maximum-length-of-subscription-per-resource-type
reference docs - https://docs.microsoft.com/en-us/graph/webhooks#notification-endpoint-validation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |

