Facebook API: find out whether private message links into business manager or not - facebook

When fetching page conversations, I receive a link field. This link field is an absolute path, without the server, e.g. /PAGE-12312/manager/messages/?mercurythreadid=....
Depending on whether a page is managed via the "Facebook Business Manager" or not, that link should be either opened via facebook.com or business.facebook.com.
How can I find out whether the FB page is managed via the business manager, i.e. how can I know how to properly construct the link back to facebook?
Linking to a private messages on a page managed via the business manager does not word, i.e. opening facebook.com/PAGE-12312/manager/messages/?mercurythreadid=.... leads to an error.

The business field on the /{page-id} node in graph api is the ID of the business that owns the page in Business Manager, if any. It's only available with a page admin token.
You have to ask explicitly for the field in the api-request:
/{page-id}/?fields=business

The way we solved worked this around is by realizing that you can always link into the Business Manager, even when the page doesn't have it activated.

Related

How to access my business’ Facebook Page Feed from my web server using Graph API?

I have a pre-existing Facebook Business Page set up on Facebook and I just registered my website (App) on the Facebook Developers Console using the same Business name as the Facebook Page name. I am an admin on both the App account and the Business Page. My app is also on the list of “subscribed apps” for the Page. Even still, Facebook doesn’t see the app and page as the same business, and I still don’t see my page in the “App Pages” section of my App Settings like it says I should.
Ultimately, my goal is to be able to establish a communication between my web server and my Facebook Page in order to READ posts on my page using the Graph API. However, when I try accessing the page node or any of its edges using my App Token (via Graph Explorer OR my web server), it’s telling me I need an App review before I can read the public data on my own Facebook page.
My guess is that this is happening because there is still no established connection between the app and the page... and if that’s the case, what more can I do to make the connection? Anyone have any experience with this?
FYI: I’ve read many other posts on this issue and most of them are outdated or don’t give any clear answers to the question. I feel this question is valid due to the privacy changes introduced by Facebook last March.
You need to have your App reviewed, older apps work till August 2018. But as now every review takes a month and there is high change that you are not approved for "Page Public Content Access". Reason for approve denial is "it doesn't appear to enhance the user experience". And after that, there is not much you can do. You can make another app and submit it to the review, with info that might pass the review process.
As for now, i do not know the correct phrases to use in review-form, but if some-one gets "Page Public Content Access"-approval, please let us know how.

How to set up Facebook webhook to monitor a particular page

I've been searching the net on how to setup the Facebook webhooks to check a particular Facebook page (I'm a content editor of) for certain updates.
I read the docs many times about setting up the callback URL whenever a particular "event" happens on that Facebook page, but I never read a straight answer on how to tell which page I want to monitor in.
I was pointed to the {app-id}/subscriptions endpoint, but it doesn't seem to be the one I need.
Could someone provide an idea on how this works?
You need to make a request to /{page_id}/subscribed_apps to create a subscription for updates from a page.
This call needs a page access token, so you need to request manage_pages permission first from an admin of the page. (Not sure if “content editor” role is sufficient for that.)

Maintaining continuity of a Facebook post from website to Facebook

I am building a social application, users post data to the website, which is saved in our database.
This creates a record on the site, which is searchable and creates the basic content and function of the site (the purpose is not relevant at this point)
When a record is saved to our database, I want to "spread the word" and send this data out to social networks. Currently, I'm looking at Facebook in isolation.
So, I know how to create a post through the Graph API and post this content to the users Timeline, or indeed to a business page associated with the APP/Website.. but I am not sure how, or if indeed one should, maintain continuity.
What I mean... if a user creates a record on my website, and then the website/App creates a post on my business page, and also asks the user to post it in their Timeline, how do I stop this being two separate posts, and instead one post which has been shared?
I want to achieve:
User posts on website
>
Website posts to Page
>
Post on Page is "Shared" to users Timeline
As opposed to:
User posts on website
>
Website posts to Page
>
Website posts an additional post to users Timeline
The reason I want to do this, is that on the website, I want to be able to show shares, likes and comments from Facebook by tracking the ID of the initial post created when first entered onto my website.
Or am I trying to reinvent the wheel and should just use Facebook's comment plugin?
When you create the post on facebook on the Page, store the returned post ID in your data model.
From what I can tell, there is no way to access the normal user share directly through the API. If you insist on doing it programmatically without popping up any dialog for your user, you can make a post to the user's page which has (the start of) the Page post and a linkback to the Page post as an attachment. This is probably to prevent abuse.
However, if you don't mind relying on an undocumented and deprecated endpoint, you can use the old sharer.php endpoint, so long as you have a fully qualified link to the post you want to share (you can retrieve the url through the api). This will also require your user to enter anything appropriate in their share and then click "share."
The endpoint is
http://www.facebook.com/sharer.php
Call it with the u parameter filled in with the url, so
http://www.facebook.com/sharer.php?u=[URL encoded URL of the post you wanted to call]
You can try this with any facebook post (go to a post, copy the url, past in as the parameter), it's still working (I just tried it) but there are no guarantees. See the top answer to Facebook API: "Share" a post already posted on a page's wall?.
You can still access likes, comments, etc for that post id through the Graph API (and you can provide your users a direct link to the post). Cache/update them as recommended and display them on your own page. You are basically mirroring back onto your own site what is happening on facebook in regards to the post you made.
I would go this route especially if you are at all planning on branching into other services. That way you can do an aggregated display of statistics/likes/etc from the multiple services you are having your platform repost to. This is also good for (at least an impression of) data integrity for your users: they know that your service represents everything they have done in case anything happens to their facebook/etc accounts.
This could especially be noteworthy if they are worried about facebook/etc deleting any of their posts, or for recovering from any issues where a post/comment/etc is not properly stored by facebook/etc (for example, comments have a maximum length which, at least via the main FB UI, silently drops anything above the maximum length in a non recoverable way for the user).

Location restricted Facebook apps - Possible to restrict view from page admins?

We have created a Facebook application that is restricted to US only, using the Graph API location restriction method (https://developers.facebook.com/blog/post/574/).
This application has then been added to a Facebook page. However, it appears that admins of the page are still able to see the application, regardless of their location.
So our question is: would it be possible to disallow access to admins of the page if they are outside of the US?
Just to make sure, is it admins, or just because you are the owner of the app.
I have no experience with the restriction functionality but if the above still proves that page admins can view it, then it looks like page admin's can still view it. But there are some other steps you can apply considering people can easily fake location on Facebook anyway.
IP Location
Download GeoIP (free IP address database) and you can lock people out of your app that way as well.
Graph API
Connect to the graph API with their user Id, manually get their location and block based on that.
Or you can use a combination of all of the above.
This is completely intentional - page admins will always see the tabs on their page - there's no way to hide content on a page from the admins of that page.
Broadly, there should be no way to hide content from users who are responsible for that content

Integrating facebook 'compose new message' popup into my website

I am designing a website that will be heavily integrated with facebook. Members connect to the site via their facebook accounts and facebook authentication/permission is used to access their friends list and other information.
There are instances in which I would like the site to be able to send facebook inbox messages to selected people from the user's friends list (in a user initiated manner).
I have discovered that this is not possible through facebook permissions.
One idea that I have is to have Facebook's "Compose New Message" popup to appear overlayed on top of my site (as would appear when clicking the "Send new message" button on a user's profile page). The user would then type a message and press send (hopefully circumventing the permissions issue).
I have browsed the facebook developer docs and forums, but my technical knowledge is limited. I just want to know if this is possible or not, and to be pointed in the direction of material on how this could be achieved (so that I can pass this on to hired developers once I reach that stage)
Any help or suggestions on alternatives would be gratefully received!
Pete
The closest you can be to your goal is using the Send Button. However, this button is used to share links, which are usually open graph pages. What you can to is specify a dummy href/link so that it shows a blank page. Or, better if you actually needed a link attached, then you have no problem.
There is no way of doing it using Graph API Message Object. There are no publishing rights to this object whatever permission you ask from the user. It is read-only. Just look at the extended permission it is only read_mailbox - "READ_mailbox".
Even FQL can't help us with this.
Also, facebook is in the process of migrating to a new messaging system. So playing around with is now is not advisable.
What you can do now is utilize the Send button I mentioned above.