facebook - How to programmatically add an event to a page using Graph API? -
is possible programmatically add event page using facebook graph api? if yes, http request shall made?
for example, startup weekend has events on facebook page. these events can added using graph api event object?
update
creating event api no longer possible in v2.0+. check: https://developers.facebook.com/docs/apps/changelog#v2_0
yes it's possible.
permissions:
create_event
manage_pages
so first page id , access token, through:
$facebook->api("/me/accounts");
the result like:
array ( [data] => array ( [0] => array ( [name] => page name [category] => website [id] => xxxxxx [access_token] => xxxxx ) [1] => array ( [name] => page name 2 [category] => company [id] => xxxxxxx [access_token] => xxxxxxxx ) ) )
update: retrieve page's access_token
call page
object directly like:
$page_info = $facebook->api("/page_id?fields=access_token");
the access token, if successful call, should accessible: $page_info['access_token']
now page id , access token , use events
connection:
$nextweek = time() + (7 * 24 * 60 * 60); $event_param = array( "access_token" => "xxxxxxxx", "name" => "my page event", "start_time" => $nextweek, "location" => "beirut" ); $event_id = $facebook->api("/page_id/events", "post", $event_param);
and done! :-)
Comments
Post a Comment