Created
July 7, 2012 04:49
-
-
Save aaronroe/3064754 to your computer and use it in GitHub Desktop.
Doing a post on Yammer via Javascript API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>A Yammer App</title> | |
<script src="https://assets.yammer.com/platform/yam.js"></script> | |
<script> | |
yam.config({appId: "APP-ID"}); | |
</script> | |
</head> | |
<body> | |
<button onclick='post()'>Post on Yammer!</button> | |
<script> | |
function post() { | |
yam.getLoginStatus( function(response) { | |
if (response.authResponse) { | |
yam.request( | |
{ url: "https://www.yammer.com/api/v1/messages.json" | |
, method: "POST" | |
, data: { "body" : "This Post was Made Using the Yammer API. Welcome to the Yammer API World."} | |
, success: function (msg) { alert("{Post was Successful!}: " + msg); } | |
, error: function (msg) { alert("Post was Unsuccessful..." + msg); } | |
} | |
) | |
} else { | |
yam.login( function (response) { | |
if (!response.authResponse) { | |
yam.request( | |
{ url: "https://www.yammer.com/api/v1/messages.json" | |
, method: "POST" | |
, data: { "body" : "This Post was Made Using the Yammer API. Welcome to the Yammer API World."} | |
, success: function (msg) { alert("{Post was Successful!}: " + msg); } | |
, error: function (msg) { alert("Post was Unsuccessful..." + msg); } | |
} | |
); | |
} | |
}); | |
} | |
}); | |
} | |
</script> | |
</body> | |
</html> |
Dear how to use the above code in office 365 to post the list item title to our yammer post.
I tried above but not getting posted.
when some one post through API,still its showing as posted by my Name.Also one static message is coming as"Posted through yammer Developer SDK".how to avoid this.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you!
Great example. I am wording if you have Post a message with an attachments. There are not working sample or success post on internet. Most of the online folks complain against 500 error. If you have found a way via embed or PowerShell Please advise me.