facebook graph api - how to post an event to a groups event page?
I want to post an event to a facebook "group" using the graph API from a php application running elsewhere. Basically when someone creates an event on my system I'd like to also publish it as an event in facebook in my group.
I created an application on facebook and then get an authorization token using the following URL :-
https://graph.facebook.com/oauth/access_token?client_id=XXXX&client_secret=XXXX&type=client_cred
This gets me back a token I can use.
I then try to create my event like this -
https://graph.facebook.com/{GROUP_ID}/events?name=Test%20event&start_time=$st&end_time=$et&access_token=$oauth&privacy=OPEN&page_id={GROUP_ID}
$st and $et are php variables containing the event start and end times and $oauth contains my access token
But I get back a permissions error.
Cl开发者_StackOverflow中文版early my access token for my application doesn't have permissions to post an event to my group. So.. Is there any way to give it those permissions? Or is there a different approach I need to use?
You need to request the permissions when you login. For example (standard PHP SDK for Facebook):
$loginUrl = $facebook->getLoginUrl( array('req_perms' => 'publish_stream,create_event,offline_access,manage_pages') );
Where 'create_event' would of course give you permissions to create new events.
精彩评论