I tried following code post in a specific group in yammer.
function post() {
yam.getLoginStatus(
function(response) {
if (response.authResponse) {
console.log("logged in");
console.dir(response); //print user information to the console
yam.platform.request({
url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body" : "Welcome to the Yammer API World.", "group_id":"xxxxxxx"}
, CORS: true
, dataType: "json"
, headers: { "Accept": "application/json; odata=verbose" }
, xhrFields: { withCredentials: true }
, success: function (msg) { alert("Post was Successful!: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
});
}
else {
yam.platform.login(function (response) {
if (response.authResponse) {
console.dir(response);
yam.platform.request({
url: "https://www.yammer.com/api/v1/messages.json"
, method: "POST"
, data: { "body" : "Welcome to the Yammer API World.", "group_id":"xxxxxxx"}
, CORS: true
, dataType: "json"
, headers: { "Accept": "application/json; odata=verbose" }
, xhrFields: { withCredentials: true }
, success: function (msg) { alert("Post was Successful!: " + msg); }
, error: function (msg) { alert("Post was Unsuccessful..." + msg); }
});
}
});
}
});
}
in HTML file I have added this code
<script type="text/javascript" data-app-id="xxxxxxxxxxxxxxxx" src="https://c64.assets-yammer.com/assets/platform_js_sdk.js"></script>
Code above throws error as
Is there any thing I am missing in it?