How to get the events for a Facebook user - facebook

I am using the latest version (11.0) of the Facebook API. I'm trying to get user's events using the Graph API Explorer. I can get the user's pages and events for each page, but can't get user's events.
The response of the request with events endpoint is an empty array. After adding debug=all to the request, I get the following error The field 'events' is only accessible on the user object after the user grants the the permission for user events'. , but there is no permission for user events in Graph API Explorer.
What should I do to get the user's events.

According to the docs, there is no events edge for users anymore: https://developers.facebook.com/docs/graph-api/reference/user/#edges
The error message may be misleading.

Related

Can I transform a user-id to PSID? - Facebook API Graph

Context: I'm building a webhook with NodeJS to get events from Facebook Page with my Facebook App. These events are: feed, mention (when a user tags the page on his wall) and message. I can get all events without problem. In all events I need to identify the user who write. When the users write a post or message in the page I get an ID (PSID) but when the user write a post on his wall tagging the page I can't get PSID, this is obvious because he isn't in the page scope. The only I get from this event is user-id from post-id.
I have tried the following:
I used this endpoint GET: /<user-id>/ids_for_pages as indicated in the documentation. This doesn't work for me because I would need that the pages are in my business administrator and this isn't possible because I need this webhook to manage many pages to many companies.
I used this endpoint GET: /<psid>?fields=name,id for events of type feed and messages (from Messenger) into the page but this gives me only PSID again.
Note: In my DB I save long-lived token of my page, ASID of the site owner and Page ID when my user does the login in the UI.
My questions:
Is possible transform user-id to PSID?
Can I get user-id through the PSID?
If you have a better idea to unify IDs when is the same user, I would like to know it. If this isn't possible I would also like know it.
My Goal: Each user event goes to the same case for the same user in my API, for this reason if the user is the same when tags the page and/or write a message in the page the idea is to identify him like same user and not like new case.

Fetching ALL facebook events from a page

I'm trying to fetch all events from a single page to display them on our website. The problem, however, is that the API gives me only events that are created by the page itself and no events that have been added to the page. So when browsing the events at facebook, the user sees events that are not listed on our website.
Right now, I'm requesting the events with my personal user token that has manage_pages for the specific page. When using a page access token obtained by the Graph API Explorer I get even less events.
I'm using this endpoint: https://graph.facebook.com/v3.1/<Page>/events

Facebook Graph Api Get Event By Id

I am trying to receive an event from the Facebook Graph Api By Id with following request:
https://graph.facebook.com/{eventid}?access_token={app_accesstoken}
I am using an app-accesstoken. The Event is a public event and according to the Graph Api docs I should be able to receive public events with any access token: https://developers.facebook.com/docs/graph-api/reference/event/
Nevertheless I receive following error-response:
Unsupported get request. Object with ID '{eventid}' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api
I have tried with multiple events with the same results
In April 2018, following the Cambridge Analytics scandal, Facebook decided to greatly reduce the information available through Facebook API.
In particular regarding Events API, here the official statement.
Events API: Until today, people could grant an app permission to get information about events they host or attend, including private
events. This made it easy to add Facebook Events to calendar,
ticketing or other apps. But Facebook Events have information about
other people’s attendance as well as posts on the event wall, so it’s
important that we ensure apps use their access appropriately. Starting
today, apps using the API will no longer be able to access the guest
list or posts on the event wall. And in the future, only apps we
approve that agree to strict requirements will be allowed to use the
Events API.
After that change you will not be able to get events of Facebook Pages, using the Facebook API like in the old days.
You could be able to get the data of a page you own if you have user_event permission (https://developers.facebook.com/docs/graph-api/reference/user/events/) but your app need to pass the App Review process.
Source: https://newsroom.fb.com/news/2018/04/restricting-data-access/

How to get facebook events via event id?

How to get Facebook events via event id?
i wanted to enter a event id to get all of the data, is there any API for this?
or please tell me how to get the events via graph api.
You need the permission: user_events
API : /EVENT_ID
You can test the same here: Graph API Explorer

Can't post actions to a Facebook event

I have my server side code create an event on Facebook, using a Facebook application user I created.
Then, I want mobile users of my app, that logs in to my app using FB connect, to be able to publish actions on that even's wall.
I tried doing it using code,curl or graph explorer, but nothing seems to work.
I suspect the only option is to publish actions using the user that created the event.
When I Post to a link like this:
https://graph.facebook.com/EVENT_ID/APP_NAMESPACE:ACTION
With the object as a parameter as well, I get the following error:
Requires a valid user is specified (either via the session or via the API parameter for specify
When I post to link like this :
https://graph.facebook.com/EVENT_ID/feed/APP_NAMESPACE:ACTION
I get an error:
Unknown path components: /APP_NAMESPACE:ACTION
Any way to achieve that ?
The error message is telling you that an event's /feed connection has no connection of /APP_NAMESPACE:ACTION type. This error message is correct.
Posting actions to or as a Page, Event, Group is not possible, nor is it possible to post actions to a friend's Timeline - only users can post actions, and only to their own timelines.
See the Open Graph Mechanics part of the docs, it shows that users perform an action on an object. What you're trying to do is having a user take an action, and then post that to an event wall - that's not supported