Skip to content

Instantly share code, notes, and snippets.

@sandeeptalabathula
Created March 15, 2012 03:33
Show Gist options
  • Save sandeeptalabathula/2041716 to your computer and use it in GitHub Desktop.
Save sandeeptalabathula/2041716 to your computer and use it in GitHub Desktop.
Used Yammer javascript api in this html file.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="https://assets.yammer.com/platform/yam.js"></script>
<script type="text/javascript">
yam.config({appId: "VZmQdjQDS5j60WqapRlyBA"});
yam.getLoginStatus( function(response) {
if (response.authResponse) {
// logged in and connected user, someone you know
console.log('status:logged in');
yam.request({
url: '/api/v1/users/current',
type: 'GET',
success: function (messages) {
document.write('<p>' + messages.body + '</p>');
document.write('<p>' + messages.id + '</p>');
document.write('<IMG SRC="' + messages.mugshot_url + '">' + '<h3>Welcome Back ' + messages.full_name + '!</h3>');
},
error: function (messages) { alert('Data Not Saved: ' + messages); }
});
}
else{
// no user session available, someone you don’t know
console.log('status:NOT logged in');
yam.login();
}
});
</script>
</head>
<body>
<input type="button" onclick="yam.login" value="login me"/>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment