Facebook graph api - how to send an event to a group events page?

I want to send an event to the facebook group using the graphical API from a php application running elsewhere. Basically, when someone creates an event on my system, I would also like to post it as an event on facebook in my group.

I created an application on facebook and then received an authorization token using the following URL: -

https://graph.facebook.com/oauth/access_token?client_id=XXXX&client_secret=XXXX&type=client_cred

This returns me a token that I can use.

Then I try to create my event as follows:

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 start and end time of the event, and $ oauth contains my access token

But I am returning a permissions error.

Obviously, my access token for my application does not have the right to send events to my group. So ... Is there a way to give him these permissions? Or do I need a different approach?

+3
source share
1 answer

You need to request permission when logging in. For example (standard PHP SDK for Facebook):

$loginUrl = $facebook- > getLoginUrl ( array ('req_perms' = > 'publish_stream, create_event, offline_access, manage_pages') );

"create_event", , .

+2

Source: https://habr.com/ru/post/1758870/


All Articles