Forum Discussion

Marco Scheel's avatar
Marco Scheel
Iron Contributor
Sep 14, 2017

Webhook (aka Subscription) for groups ressource changeType = created not working

HI,

 

I'm looking for an fast and efficiant way to get notified for new AAD groups (unified groups to be exact). I could us the groups endpoint and then do a delta query every 5 minutes. But this is not "instant". MS Graph offers their implementation of webhooks (subscriptions) to solve this problem. I've checked the github repo:

https://github.com/microsoftgraph/aspnet-webhooks-rest-sample

 

And it works as designed for user email messages. I've modifed the code to get a subscription for groups. Currents these are only available in the /beta version. So I changed all URL and the message example is working on the beta version. Then I changed the subscription from messages to groups. But the sample refused to work. I tried the same request using the MS Graph Explorer but also failed due to this message:

 

{
    "error": {
        "code": "InvalidRequest",
        "message": "Invalid 'changeType' attribute: 'created'.",
        "innerError": {
            "request-id": "9b786de2-1780-4ccf-9d1a-1243d0435ce1",
            "date": "2017-09-14T13:37:33"
        }
    }
}

The message is indicating that "created" is not supported :( The same request with "updated" is working as expected :( Permissions for the app are updated with Group.Read.All as the docs states.

 

This is the request:

{
  "changeType": "created",
  "clientState": "ca07f995-5f94-4a7a-903a-a6f9deb517e4",
  "notificationUrl": "https://gkm-msgraph-webhook.azurewebsites.net/notification/listen",
  "resource": "groups",
  "expirationDateTime": "2017-09-14T13:09:26.8315691+00:00"
}

 The docs are suggesting it should work (I know it is the beta hive). Any idea?

 

These are the docs:

https://developer.microsoft.com/en-us/graph/docs/api-reference/beta/api/subscription_post_subscriptions

4 Replies

  • I wanted to add that I can still reproduce this problem.

     

    {
      "error": {
        "code""InvalidRequest",
        "message""Invalid 'changeType' attribute: 'created'.",
        "innerError": {
          "request-id""a311f723-b5e8-4434-9e34-1f19fa492439",
          "date""2017-12-26T12:10:02"
        }
      }
    }

     

    Change Type values for "updated" or "deleted" works.  My listener gets called with validation token and I return that (if I don't subscription errors).  But then I get an internalServerError after that so still stuck.

    • John Liu's avatar
      John Liu
      MVP
      quick note - updated and deleted works.

      I've got feedback that MSGraph currently shows 'created' event as part of 'updated' event. So listening to 'updated' event will trigger on new groups.
      • Deleted's avatar
        Deleted

        Were you able to configure a subscription to only Unified Groups?

Resources