0

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.

Marc LaFleur
  • 31,987
  • 4
  • 37
  • 63
  • Could you try setting `changeType` to `"created,updated"`? Also, are you getting the initial validation message? – Marc LaFleur Jun 03 '19 at 17:12
  • 1
    Yes, I did that but didn't help. The only message I received to endpoint was the one with validationToken, which I think I've correctly returned (subscription was created so it should be ok). After than none was received. I've created support ticket on Azure Portal, with data I've sent and received. Hopefully they will be able to see in detail what is happening. – elsendar Jun 04 '19 at 08:40

0 Answers0