如何使用fb_graph gem从我的页面墙上的应用程序发布? [英] How to use fb_graph gem to post from app on my page wall?
问题描述
好吧,所以fb_graph看起来很简单,但我有点困惑,因为它如何使用它。
我想要做的,当我发布博客条目从我的Rails应用程序,让应用程序自动发布到我的Facebook页面。
我已经有我的facebook app_id和app_secret了,但是我对这个代码做了些什么感到困惑:
me = FbGraph :: User.me(ACCESS_TOKEN)
me.feed!(
:message =>'通过FbGraph更新',
:图片=>'https://graph.facebook.com/matake/picture',
:link =>'https:// github。 com / nov / fb_graph',
:name =>'FbGraph',
:description =>'Facebook Graph API的Ruby封装'
)
如何获得ACCESS_TOKEN?我该如何确保我的帖子进入我的粉丝页面,而不是我个人的脸书墙?
最后,上面的代码去因为我想发布博客条目时应该发布的代码应该在控制器下的新,或者它应该是模型中调用的方法每当博客文章?你应该看看这里: / p> 看来您可以在这里生成令牌: 此链接也可能有所帮助:使用Facebook访问令牌的错误 Ok, so fb_graph looks pretty simple to use but Im kinda confused as how to use it. All I want to do, and when I post a blog entry from my rails app, have the app automatically post to my facebook page. I have my facebook app_id and app_secret already but Im confused as to what to do with this code: How do I get that ACCESS_TOKEN? And how do I make sure my posts are going to my fan page and not my personal facebook wall? Lastly, where does the above code go since I want to post when a blog entry is posted should that code go in the controller under "new" or should it be a method called in the model whenever a blog post is made? You should take a look here : Where do I get an access token from to post to my facebook page using FBGraph gem in Rails 3? It seems that you can generate tokens here : This links may help too : Error with facebook access token 这篇关于如何使用fb_graph gem从我的页面墙上的应用程序发布?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
me = FbGraph::User.me(ACCESS_TOKEN)
me.feed!(
:message => 'Updating via FbGraph',
:picture => 'https://graph.facebook.com/matake/picture',
:link => 'https://github.com/nov/fb_graph',
:name => 'FbGraph',
:description => 'A Ruby wrapper for Facebook Graph API'
)