Getting Praises from your Yammer network


A few of you have been asking if it is possible to see a list of praises across your networks.  This is possible and there is an API that allows you to do this.

A Praise is wrapped in a standard Yammer message so it is easily accessible via the messages API

https://www.yammer.com/api/v1/messages.json

If you look at the hierarchy you will see that a message contains an attachment that has a type field which can be set to “praise”…

clip_image002

So now run off and write your code to get all the messages that have attachments with their type field set to “praise”.  This might get you a count for the number of praises across your network but you should probably also figure out who the praises are from and who they are for.

The description field of the attachment is going to contain a value that is used to display the praise in the Yammer UI like this…

clip_image004

but I would suggest using the https://www.yammer.com/api/v1/users.json API to get more information about the users involved by looking up their IDs.

The collection of praised_user_ids is a field of the attachment which lists all the users that were praised (more than one user can be mentioned in a single praise).

clip_image006

Detailed information can be retrieved for each of the users individually by calling https://www.yammer.com/api/v1/users/1507440839.json

or for all users by calling https://www.yammer.com/api/v1/users.json

To get detailed information on the user that sent the praise you can use the sender_id field from the message.

clip_image008

See the attachment for an HTML/JS example.

get_praises.zip