Easy way of posting on Facebook page (not a profile but a fanpage)

后端 未结 2 1464
被撕碎了的回忆
被撕碎了的回忆 2020-12-28 11:12

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

I\'m looking for a direct way to put something there from my Rails appli

相关标签:
2条回答
  • 2020-12-28 11:24

    Since I had to mix up a few different articles to get it all set up I would add that for one developper being admin on a client's Facebook page you will have to :

    1. Go to the Graph API Explorer
    2. Choose the app you created from the dropdown menu (if you didn't, create one)
    3. Click "Get Access Token"
    4. Click "Extended Permissions" tab
    5. Choose both the manage_pages and the publish_stream permissions
    6. Click "Get Access Token"
    7. A window may open to ask you to confirm, say yes
    8. Use the newly generated Access Token
    0 讨论(0)
  • 2020-12-28 11:43

    You can follow this link What's the easiest way, to post on my Facebook Wall through my Ruby on Rails App?

    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.

    0 讨论(0)
提交回复
热议问题