in reply to Re: Post on FB (cron)
in thread Post on FB (cron)

The first listed method on the Facebook::Graph::Publish::Post should give this functionality.
to ( id ) Specify a profile id to post to. Defaults to 'me', which is the currently logged in user.
Then your code would be:
my $groupid = 12345; $fb->add_post ->id($groupid) ->set_message('I like beer.') ->publish;

Replies are listed 'Best First'.
Re^3: Post on FB (cron)
by ultranerds (Hermit) on Mar 13, 2014 at 17:03 UTC
    BTW, this kinda works:
    $fb->access_token( $access_token ); $fb->add_post() ->to(490559244324622) ->set_message('I like beer.') ->publish;
    However, it seems to post on my wall, as my personal account (not the admin of the wall).
      Ah ha - got it! Turned out it was an expired access token, so getting a new one - this worked:
      $fb->access_token( $access_token ); $fb->add_post() ->to(490559244324622) ->set_message('I like beer2.') ->publish;
        I had originally posted:
        $groupid = 12345; $fb->add_post ->id($groupid) ->set_message('I like beer.') ->publish;
        However, the method is named "to," and not "id". I apologize for the error. As you showed (and included for future searchers), the code should be:
        $groupid = 12345; $fb->add_post ->to($groupid) ->set_message('I like beer.') ->publish;
        I would like to propose you look at Recipe 3 since it queries "me/accounts" to post as other accounts within your control.
Re^3: Post on FB (cron)
by ultranerds (Hermit) on Mar 13, 2014 at 16:46 UTC
    Thanks for the reply. Thats what I assumed before, but to no avail - it just gives an error:

    Can't locate object method "id" via package "Facebook::Graph::Publish::Post" at test.cgi line 53.

      It looked to me like the docs say it should be ... ->add_post( 123456 )-> ...

        Ya, tried that too - thats how I read it first time around. However, that doesn't do anything. The worst part about this module is that there doesn't seem to be any kinda error reporting, debugging, or anything like that :/