Monday 3 November 2014

Writing signals into the Office Graph and Delve

Say you are developing a custom solution in SharePoint Online and you want to integrate data from the Office Graph in it. The method of reading data from the Office Graph is pretty straightforward and I have documented it in my previous post: http://www.vrdmn.com/2014/09/exploring-office-graph-and-graph-query.html

But what if you actually want to send behavior data to the Office Graph? You have a custom link to a User Profile or a document in your solution and when the user clicks the link, you want to send a "Clicked" signal to the Office Graph. If  a User Profile link of a user is clicked, you want to send a signal to increase the "closeness" of the current user to that user.

You want the user's interactions in your solution to affect the data that is stored in the Office Graph.

It is actually possible to push signals into the Office Graph from your custom application. There is actually an endpoint  _api/signalstore/signals to which you can send your custom signals.

Some things to note before we go ahead:

1) This API is not yet documented and might change in the future. It is not recommended for production solutions just as yet. 

2) This API is also throttled at a certain stage to avoid malicious use to provide false data to the Office Graph.

3) It takes about 24 hours for Delve to reflect your changes.

To see how this is done, you can open up Delve in your browser and press F12 to bring up the Developer Tools. When you navigate in various areas of Delve, you can see all the signals which are sent to the Office Graph as a result of your actions. For example, when you click a document, you can see the following request is sent:

(click to zoom)

Each signal is made of 3 properties. The Action, the Actor and the Item.

1) Actor: This is always the current user as you cannot send signals on behalf of other users.

2) Item: This is the object against which the signal is performed. This can be a document url in case of a document or it can be the login name of a user if the object is a user.

3) Action: This is the action e.g. Clicked, Shown or Elevate which is used to affect the relationship between the Actor and the Item.

I have put together couple of code samples which could be used as a base in sending custom signals to the Office Graph. These samples work right off the bat but they can be further customized by setting properties to modify the Office Graph behavior. You can find the full list of properties in your Developer Tools.

1) Send a document "Clicked" signal. This will tell the Office Graph that the current user has clicked a particular document. The Office Graph will take into account this action when calculating the closeness of the current user to this document.



2) Elevate a user with respect to the current user. This will increase the closeness and edge weight of the specified user with respect to the current user:



Hope this API will get documented soon. There is a lot of potential here for building custom solutions on top of the Office Graph and Delve.

2 comments:

Geetanjali Arora said...

Nice post Vardhaman !!!

Ankit said...

Hello Vardhaman,
I tried the signalstore api endpoint on SharePoint Online and it returns an 403. Seems to be blocked. Also there's no documentation that I could find on it.
For now there is an endpoint /_vti_bin/DelveApi.ashx/signals/batch?flights=%27PulseWebStoryCards,PulseWebVideoCards,PulseWebFallbackCards,PulseWebContentTypesWave1,PulseWebContentTypeFilter%27 to get access to delve boards.