在 Facebook 页面上发布的简单方法(不是个人资料,而是粉丝专页) [英] Easy way of posting on Facebook page (not a profile but a fanpage)

查看:26
本文介绍了在 Facebook 页面上发布的简单方法(不是个人资料,而是粉丝专页)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

哪个选项是在 Facebook 页面上发布文本或其他内容的最佳且简单的方法?

Which option is the best and easy way to post text or some other content on a Facebook page?

我正在寻找一种直接的方法来从我的 Rails 应用程序中放一些东西.

I'm looking for a direct way to put something there from my Rails application.

例如,单击一个按钮并自动在我的应用程序上发布并将数据发送到 facebook 页面?

For instance, clicking on a button and automatically posting on my application and sending data to the facebook page?

我已经为 Twitter 构建了一个,我的方法如下所示:

I've built one for Twitter and the method I have looks like this:

def tweet(url)
  Twitter.configure do |config|
    config.consumer_key = APP_CONFIG['twitter_consumer_key']
    config.consumer_secret = APP_CONFIG['twitter_consumer_secret']
    config.oauth_token = APP_CONFIG['twitter_access_token']
    config.oauth_token_secret = APP_CONFIG['twitter_secret_token']
  end    
  shorted_url = shorten_url(url)
  Twitter.update("#{title} - #{shorted_url}")
end

谢谢.

推荐答案

你可以点击这个链接通过我的 Ruby on Rails 应用程序在我的 Facebook Wall 上发帖最简单的方法是什么?

这就是我的方法的样子:

this is how my method look like:

def facebook_it(url)
  pages = FbGraph::User.me(APP_CONFIG['facebook_access_token']).accounts.first
  shorten_url = shorten_url(url) # create a bit.ly link
  pages.feed!(
    :message => "#{title}",
    :link => shorten_url,
    :description => "#{content[0..280]}"
  )
end

我还创建了另一种方法:

also I've created another method:

def share(url)
  tweet(url)
  facebook_it(url)
end

所以我从控制器这样称呼它:

so I call it this way from the controller:

def publish
  url = job_url(@job)
  @job = Job.find(params[:id])
  @job.publish
  @job.share(url)
  ..
end

我不知道这是否是更好的方法,但对我来说效果很好.

I don't know if this is the better approach, but it's working nice for me.

希望这对其他人有所帮助.

Hope this helps someone else.

这篇关于在 Facebook 页面上发布的简单方法(不是个人资料,而是粉丝专页)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆