I don't receive Graph API notifications even though Subscription is created.
I've added a subscription to watch changes on user mailbox. Webhook endpoint was correctly validated by Graph API with the token and subscription correctly created.
var user = await _graphclient
.Users[userEmailAccount]
.Request()
.GetAsync();
var subscription = await _graphclient.Subscriptions
.Request()
.AddAsync(new Subscription()
{
NotificationUrl = $"https://1f81513d3.ngrok.io/api/mailbox/notification",
ChangeType = "created",
ExpirationDateTime = DateTime.UtcNow + new TimeSpan(0, 0, 15, 0),
Resource = $"users/{user.Id}/mailfolders('inbox')/messages",
});
I was also able to retrieve it by making calls to /Subscriptions
.
[
{
"resource": "users/csaqwasce-q4c-4a8d-9cb9-e8ca5edcfe3b/mailfolders('inbox')/messages",
"changeType": "created",
"notificationUrl": "https://1f81513d3.ngrok.io/api/mailbox/notification",
"expirationDateTime": "2019-06-01T10:20:27.215458+00:00",
"applicationId": "2d932e57-3403-48ae-81ad-dea32fb1fb4d",
"creatorId": "e4572948-bc6c-4bb6-bca3-51336466e567",
"id": "a822332e-d605-44b7-92d8-49e2b3dc113e",
"clientState": null
}
]
I've sent an email to that account, but even though it looks like endpoint is correctly set up, I never receive notifications. I tried to change Resource to users/messages
, different ChangeType
or ExpirationDateTime
, but without success.
I have no idea how can I resolve that problem.