【发布时间】:2015-12-29 12:10:11
【问题描述】:
是否可以通过 API 将用户评论发布到 FB 页面?
我想在手机上安装一个应用程序,让用户在走进我的商店时查看我的业务。
编辑:- 这是我迄今为止尝试过的。
我使用 Nodejs 中的护照模块进行身份验证,并能够从 FB 检索访问令牌,包括 manage_pages、publish_pages 和 read_insights。
app.get('/auth/facebook', passport.authenticate('facebook', { scope : ['email', 'manage_pages','publish_pages','read_insights' ]}));
我的护照策略有这个
clientID : configAuth.facebookAuth.clientID, //my app's client id
clientSecret : configAuth.facebookAuth.clientSecret, //my app's client secret
callbackURL : configAuth.facebookAuth.callbackURL, //the callback URL after authentication
profileFields: ["emails", "displayName"]
我可以使用 NPM FBGraph 模块作为页面发布。
var graph = require('fbgraph');
graph.setAccessToken(req.user.facebook.token);
graph.post("{My page's ID}/feed", "Message test", function(err, res) {
console.log(res); // { id: xxxxx}
});
这让我可以将“消息测试”发布到我的页面提要。
我无法通过 Graph API 找到对页面发表评论的参考,我想知道这是否可能。
【问题讨论】:
-
到目前为止您尝试过什么?你的研究和代码在哪里?你查看过官方文档了吗?
-
很抱歉最初没有提供任何细节。我现在编辑了问题以包含更多详细信息。
标签: facebook facebook-graph-api facebook-javascript-sdk