'How can I get the events for a Facebook page?

Using the latest version (2.12) of the Facebook API I'm trying to get (public) events for a page, using the Graph API Explorer.

However, I can't seem to get it working:

enter image description here

When I hover over the greyed out "id" or "name" on the left, it says "Field is empty or disallowed by the access token".

Now the page I'm using as an exmple here is Techcrunch, and they have plenty of events coming up. So "empty" doesn't seem to be the issue.

On the "disallowed" side I've checked the API reference on https://developers.facebook.com/docs/graph-api/reference/page/events/.

However, I can't seem to find any issue here either. It says "Reading Page events requires a valid Page access token or User access token with basic permissions.".

What am I missing here? Any hints are greatly appreciated!



Solution 1:[1]

Visit https://developers.facebook.com/docs/graph-api/changelog/breaking-changes#pages-4-4

Currently Facebook is not returning events for pages using Pages API unless you use an user accesss token and that user has been invited to any of the events of the page or is attending/interested in any of the events of the page.

Solution 2:[2]

As unknow_b said :

currently to access events you can also use a user endpoint such as ‘/me/events’ or ‘/me/events/not-replied’ using an access token valid for that user. you can get the events that the user was invited to or is going/interested

But the access token user, is only working for 1 hour ! Does someone have another better idea?

Solution 3:[3]

I'm trying to do the same thing: getting public events from a page. Related to the above suggestions:

  • I tried the short-lived user access token two weeks ago, which worked for a short time. Now it does not anymore. Does it for any of you?
  • Both the long-lived user token, a page token generated with either a short- or long-lived user token do also not return any events.

At https://developers.facebook.com/docs/apps/review/#platforms, Facebook states:

Beginning April 4, 2018, all apps, including those formerly approved, must undergo App Review in order to gain access to the Events API, Groups API, and Pages API. Apps accessing the Events API and Groups API will lose access and require review once App Review resumes.

So being reviewed might help. I will report further.

Update 1: an answer on this related bug reports states it more clearly:

App review required to use the following edges: GET /page/events and GET /me/events

Meanwhile they cancelled all pending review requests for the Graph API 3.0 changes, so I have to resubmit.

Update 2: My project got rejected & I'm not bothering to continue it now.

Solution 4:[4]

Yep. Facebook has taken down the Graph API for page access tokens. I had this code in production for 2 years and it worked great. The only way to retrieve data (or was a week or so ago), was a temporary user token that lasts about 2 hours. It's totally broken my band's schedule page. I've been through every avenue and even spoke with a facebook ad team employee on the phone that was aware of it. She seemed to empathize but had no solution for me. I would count on it being down for a while.

Solution 5:[5]

I just created a python script, you can see here. It queries the given facebook page and it's events, and puts the data into a mysql table.

Solution 6:[6]

I have finally figured out a work around for this. On your fb application, you have to disable the secret key requirement. This can be found under the advance settings of your fb application console. It's called " Require App Secret".

Once you generate a fb PAGE access token, you get a fb page token, and then extend it. here is the token debugger: https://developers.facebook.com/tools/explorer/

You can extend the access token programmatically as explained here: https://developers.facebook.com/docs/facebook-login/access-tokens/expiration-and-extension

AND

https://developers.facebook.com/docs/facebook-login/access-tokens/#pagetokens

OR

There is also an extend tool in the access token debugger (just click on the debug and the extend button is bottom left): https://developers.facebook.com/tools/accesstoken/

Solution 7:[7]

It looks like it won't be working anymore due to the scandal with Facebook Analytics (see Why does Facebook Graph API say my account is non-active?).

In the popular plugin facebook-events-by-location-core, you can take a look into the issue#29 discussion. It's well explained there, and I don't think so there's a way we'll get the data in a public API available anymore.

There were also some rumours it was a competition for their (dead?) Facebook Local app, but not sure about this.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 unknown_b
Solution 2 Alexis Giuseppe
Solution 3
Solution 4
Solution 5 DaWe
Solution 6 Phillip Brandon Holmes
Solution 7