Facebook Chatbot delete messages by id - facebook

does anybody know if it is possible to delete messages by id.
For example I have an update for my content so that the user must not see any outdated messages. Didn't find anything in the graph API...
Message docs
thx
franzus

Facebook does not allow you to delete messages using the Messenger API, or the Graph API
I am not aware or, nor have found documentation for, a method that does DELETE operations (or UPDATE for that matter) on a FB Message.
The Messenger Docs provide methods for sending messsages, subscribing a page to your application's webhook, retrieving user profile information, and setting various options for your bot.

Related

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/

Facebook Bot: Message Mentioner

I'm trying to build a bot that would message anyone who mentions (#PageName) it. I have set up the mention webhook for my bot so that whenever anyone mentions my page in a comment or post, I receive a notification. Unfortunately, Facebook doesn't make it easy to message the person who mentioned my page, since there are different page IDs and messenger IDs. I am able to fetch the user ID from the mention by fetching the from field from the graph API, but is it possible to convert this user ID to a messenger ID so that I may actually message the user?

How can I query the subscribed webhook events for a Facebook app?

I would like to be able to query the webhook configuration of a Facebook app.
That is, when you setup a webhook for your FB app, you specify what events you want to subscribe to:
https://developers.facebook.com/docs/messenger-platform/webhook-reference#setup
My question is pretty simple: is there a way to query which events have been subscribed to for a given FB app/page ID?
Thanks in advance.
Apparently you can do this by querying "subscriptions" of the Graph API.
E.g.
Go to Graph API explorer tool on developers.facebook.com
In the "Access Token:" field, enter the string: YOUR_APP_ID|YOUR_APP_SECRET
In the GET/v2.8/ field, enter: YOUR_APP_ID/subscriptions
The resulting JSON will contain what events you've registered for: data[0].fields
A smart friend told me how to do this. :)

Find out whether Facebook page is live streaming

Is possible to find out whether some facebook page is live streaming right now? I was looking at Facebook API and from there it seems to me that it is not possible since /{page_id}/live_videos seems to be working only if you are an admin of the page (or you have been granted the access) since you cannot read live videos of public without page access token.
Yes, you can. This is actually called a WebHook (simultaneous notification of a certain app/user about changes made on the page). To do this you will have to create a Facebook App that will be subscribed to the changes made on a certain page that you want to track.
You can simply do this from the dashboard of the app or through Graph API 2.7(since this version supports live_videos) calling {app-id}/subscriptions and choose any of Page Object Subscriptions, which are available through Facebook API(in your case live_videos).
For this kind of subscriptions your app needs to be whitelisted in order not to spam or re-transmit the information received from a certain page.
To get more information about WebHook implementation please read Facebook API documenation: https://developers.facebook.com/docs/graph-api/webhooks
I know this is quite late already but for those that may stumble on it like I did, Yes it's possible.
As clearly stated in the documentation
Page Live Videos - Facebook API Documentation
You will need to make a GET Request to the endpoint below with the appropriate parameters:
https://graph.facebook.com/v6.0/{page-id}/live_videos
Where page_id is the Facebook Page ID you with to check for active Live Stream
The endpoint also expect broadcast_status whose value for your use case would be LIVE
Note: You will need and app setup on Facebook for developers platform and your query would have to be via the app
Further details can be found in the documentation whose link I provided at the initial part of this answer.
You might be able to get a returned string if there is any, from:
GET /v2.7/{page-id}/live_videos HTTP/1.1
Host: graph.facebook.com
You can read more in: https://developers.facebook.com/docs/graph-api/reference/page/live_videos/

Check feed/post update from user's wall without calling (pulling) graph api periodically

I know how to use graph api - https://graph.facebook.com/{id}/feed|posts to get user's and page's feed.
I also know that facebook provides an subscription API. But I can not use it to check feeds of users i am interested but not our application users (ex: A super idol I am interested but who is not our application users. I want to check not only posts by him but also messages posted by his fans)
Is there a notification service to notify me (callback) the updating of user's feed, such that I don't need to pull graph api periodically to check the updating?.
Thanks.
"I want to check not only posts by him but also messages posted by his fans" and "but not our application users"
This sounds like a stalker app. http://developers.facebook.com/policy/ Facebook says you are not allowed to do that.