gbhjeq
Last Updated: January 14, 2019
·
3.401K
· blazeeboy

Posting to facebook groups all at once using ruby

i create a script everyday and i post this script to twitter, facebook profile and groups so i'm trying to automate this process with some scripts, and this is my first script to post to certain facebook groups

#!/usr/bin/env ruby
require 'koala' # gem install koala --no-ri --no-rdoc

# create a facebook app and get access token from here
# https://developers.facebook.com/tools/explorer
# select "groups", "photos" when authenticating
oauth_access_token = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
group_filtering_words = ['ruby']
image_path = 'image.png' #change to your image path
message = 'My Cool image.' # your message

graph = Koala::Facebook::API.new(oauth_access_token)

# getting groups of interest
groups = graph.get_connections("me", "groups").select do |group|
    group_filtering_words.any? do |word|
        group["name"].downcase.include? word
    end
end

index = 0
groups.each do |group|
    index += 1
    puts "[#{index}/#{groups.size}] Posting to group #{group["name"]}."
    graph.put_picture(
        image_path, 
        {:message => message}, 
        group['id']
    )
end

6 Responses
Add your response

15033

hi, is there anyway to post the message with hyperlink inside to the Facebook group with Koala and facebook's graph API?

over 1 year ago ·
15034

yes of course there is a way, and koala has some good examples in it's wiki and README file

over 1 year ago ·
15035

thanks for reply. But I really can't find much of posting message to facebook through Koala. Could you give me a hint where could I find it? I already exhausted 3 days on searching related topics but it is very limited documents I could find.

over 1 year ago ·
15040

I finally figured out how to post the message to FACEBOOK. It needs to get usergroups & publishaction permission for the accesstoken first. I missed them in the beginning when I tried to use putwallpost method. But if I use putpicture, it could work without such permissions.
So the conclusion is if anyone wants to post to facebook Group through Koala with Facebook Graph API, he needs request the accesstoken with usergroups and publish_action first.

over 1 year ago ·
20800

Facebook Auto Group Poster-Post to Multiple Groups

Automate your business with Facebook Groups Autoposter!
Full control to publish Post on Multiple Facebook groups with one action.

Just select the groups you want to post on, Setup your post type your message add a link, add also a picture or video link,
And hit the post button and you are Done!

  • NO LIMIT
  • NO TRIAL
  • NO REGISTER
  • NO INSTALL
  • NO SPAM

100% FREE & FULL

LINK TO ACCESS THE APP FOR FREE:
http://fb-group-poster.com/

over 1 year ago ·
31631

To create the Facebook group with ruby you need to have the publication permission and have to verify the email account. if you have any issue regarding the email verification, then contact on https://gmailtechnicalsupportnumbers.com/gmail-password-recovery/

7 months ago ·