Friday, December 26, 2014

In the journey of Learning Yammer we have touched various corners of Yammer technology. Yammer is a social network where you can do all  your social activities. You can integrate Yammer with your SharePoint 2013 sites to create community. You can do various things with various options available in Yammer. In this article we will see how to get list of users who are following me on Yammer network. Following and Followers are very important groups in social network. These two groups makes your network on social site. So without these two components your community site is incomplete.

In this article we will see how to get followers of a user. We will achieve this using Yammer REST APIs. Below REST URL returns the followers of a user.

URL: "users/followed_by /[userid].json"

This URL is not mentioned in the Yammer documentation but this gives the expected results. It returns all the users details which are following the mentioned user.
Following script fetches all followers and shows on the screen.

Complete Script:

<script type="text/javascript" data-app-id="[data-app-id]" src=""></script> 
<script type="text/javascript">
var userId = "userid";
var htmlstr = "<div><a href='[URL]'>[NAME]</a></div>";
function (response) {
if (response.authResponse) {
else {
yam.platform.login(function (response) {
if (!response.authResponse) {
function GetFollowing(){
 url: "users/followed_by/" + userId +".json"
 , method: "GET"
 , success: function (responseData) {
 , error: function (msg) { 
 alert("Error..." + msg); 
function ShowHtml(responseData,isNext)
var htmlTobind = "";
var last;
for (var j = 0; j < responseData.users.length; j++) {
var html = htmlstr.replace("[NAME]",responseData.users[j].full_name);
html = html.replace("[URL]",responseData.users[j].web_url);

htmlTobind = htmlTobind + html;
<div class="container-fluid" style="margin-top:15px;height:600px;overflow-y:scroll;">
<div id="msgsection" style="width:100%;">

You need to provide data app id and user id in above script to run it.

Happy Yamming and SharePoint coding.


Post a Comment