SHRIHARI-PRAKASAM's avatar
SHRIHARI-PRAKASAM
Brass Contributor
Feb 07, 2022
Status:
New

Graph API: Add information about the client that triggered a change notification

The change notifications in Microsoft currently looks like this:

 

 

{
  "value": [
    {
      "subscriptionId": "GUID",
      "clientState": "SUB_1",
      "changeType": "updated",
      "resource": "communications/presences('GUID')",
      "subscriptionExpirationDateTime": "2022-02-06T23:37:09.2420488-08:00",
      "resourceData": {
        "@odata.type": "#Microsoft.Graph.presence",
        "@odata.id": "communications/presences('GUID')",
        "id": "GUID",
        "activity": "Available",
        "availability": "Available"
      },
      "tenantId": "GUID"
    }
  ]
}

 

 

The change notification however, does not have the information about which application triggered it. If this data is missing, applications that have a two way integration with Microsoft have a looping problem.

 

For instance, let us say an app sets teams presence using setUserPreferred presence API whenever it's own state changes. When the web-hook from Teams comes in for the changes made, the app again changes it's own presence and sends setPresence to Teams which again triggers web-hook. This is a never ending loop rendering the change notifications unusable.

 

In this case, adding a `triggerredBy` field containing the clientId of the application that triggered it would let my application know if it should reject a web-hook since the web-hook was triggered by it's own action or it should be processed since the presence was changed on Teams application.

No CommentsBe the first to comment