我试图弄清楚应如何构造有效负载以将 Open Graph 对象提交给 yammer。我可以发布一条标准消息,但我想发布一条 opengraph 消息。
{
"activity":{
"actor":{"name":"Sidd Singh",
"email":"sidd@xyz.com"},
"action":"create",
"object": {
"url":"https://www.sched.do",
"title":"Lunch Meeting"
},
"message":"Hey, let’s get sushi!",
"users":[
{"name":"Adarsh Pandit",
"email":"adarsh@xyz.com"}
]
}
}
这是从他们的 API 文档中截取的一些代码,但没有告诉我应该如何在 javascript 中使用它。有人可以帮助我吗?以下是我发布标准消息的现有代码...
yam.request({
url: "https://www.yammer.com/api/v1/messages.json?network_id=networkname", //this is one of many REST endpoints that are available
method: "POST",
beforeSend: function (req) { //send the access_token in the HTTP header
req.headers.Authorization = "Bearer " + access_token;
},
data: {
"network": "networkname",
"body": "Test Post",
"group_id": "3719771"
},
success: function (data) { //print message response information to the console
toastr.success('An Item was successfully posted to Yammer', "Yammer Network");
},
error: function (user) {
toastr.error('There was an error eith the request', "Yammer Network");
}
});