Post to Facebook via API but Limit Access to FB App Users - facebook

I've got a Facebook app that allows app "requests" to be sent to other Facebook friends. What I would like to be able to do is then allow users to create status updates/posts that will only be visible to the FB App users who they have sent requests to previously.
I'm trying to do all of this via the FB Javascript API. Is this possible?

Sure you can but you'll have to manage the privacy limitation 'manually' by storing all invites in your own database. The apprequests JS SDK call has a callback that contains a request_id and, more relevant to you - the facebook ids of the user who sent the invite and the user that was invited. You'll have to save that information and then use it when posting.
Here is a link to the facebook documentation on apprequests... All the information you need about the callback and using the apprequests feature is located there...

Related

webhook realtime event on post shared to many facebook pages

my application can share posts (like photos) to some user's page. (can be for multiple users).
when sharing a post, the user gives my app a permission for sharing. when doing this, my app receives token and post-id, and I can make API requests to get some post data like views etc...
I read Webhooks api, but couldn't find any reference if my requested behaviour is supported: I could understand that the supported behaviour is the one if a user is manual configuring his page to support hooks.
to make better understanding, this is the flow:
some user is logged in to my app
user wants to share a photo from my app to his facebook page
user 'click' on share, accept the permissions, the photo is shared on his page, my app receive token and post id
I want to receive hooks to my app endpoint on any change to this post (like, view..)
is it possible??
thanks.

Link facebook messenger with facebook login on app

I have a facebook messenger bot that sends a webhook to my web app. People can login to my app via facebook login.
The first user contact is normally with my facebook bot on which they can create a profile. When they make contact I take their facebook id, name, profile pic, etc.
Users can then login with facebook to my web app to enhance their profile.
My problem is facebook uses different scoped ids for messenger and their login.
How can I recognise if a user has already been on my facebook bot if they use my web app, and vice verca.
I think it has something to do with the business mapping api: https://developers.facebook.com/docs/apps/for-business but I'm struggling to understand how it works.
I am sending a get request using:
GET /me?fields=token_for_business
But the docs do not specify the full url to use. I'm also unsure if you can use this in developer mode.
facebook provides an id-matching api
for the app and pages owned by the same business manager. More informations:
https://developers.facebook.com/docs/messenger-platform/identity/id-matching

Sending notifications with Facebook graph API not authorized with regular users

I have created a Facebook App and published it today with Canvas Web platform.
The users can authorize the application and I can send notifications to them using the Facebook API that appear on their Facebook account on the Web.
However, it works with the developer user but not with regular users. For regular users the API call to send notifications returns this error response:
{"error":{"message":"(#200) Your app is not approved for content update notification at this time", "type":"OAuthException","code":200,"fbtrace_id":"GPVF+lOxzgp"}}
The application is published and is live. It is for publishing landing pages with videos, when when the user signs up using Facebook, he will get a notification when a new page with a video is published, so he can watch the video inside the Facebook canvas iframe.
What do I need to do to have new content notification approved? I just asked for email and profile permissions and the documentation says it does not need additional permissions to send notifications. So I have not items to submit for review.
I am using this API call described here:
https://developers.facebook.com/docs/games/services/appnotifications
It seems I was doing a mistake which as to pass a type parameter set to the content_update value. Removing that parameter solved the problem.

Do review required if we want to get Facebook Page like count (Without Facebook login) by Facebook app token?

I am doing a static web page in my website, in which I am showing the like count of particular Facebook page. There is no kind of login required to see this web page. Also, I don't want to user to login with their Facebook account to see the Facebook page like count.
I have implemented this requirement by using Facebook app token.
API: "https://graph.facebook.com/PAGE_ID?access_token=APP_TOKEN"
But the problem here is, If I use the app token of already approved app by Facebook with some permissions (manage_pages) exists, it works. It is not working for the app token of newly created Facebook app.
I have sent the app for review to Facebook by requesting manage_pages permission, but they rejected the app and said that my website doesn't have the Facebook login functionality implemented.
Since it is not documented clearly, I have a doubt that do the app need to send for review if I want to get the Facebook page like count without Facebook login (By using Facebook app token)? If yes, what permission do I want to request?
Any help would be much appreciated.
First of all, you need to learn what Tokens there are:
https://developers.facebook.com/docs/facebook-login/access-tokens
http://www.devils-heaven.com/facebook-access-tokens/
For your problem, you can just use an App Access Token. There is no need for any permission or Login Review, the links above tell you exactly how to create one. Make sure you never use the Token on the client, especially because it includes the App Secret. Do the API call on the server only (file_get_contents or curl, if you use PHP).
If by "it does not work" you mean that you only get the id and the name, then it´s not about "not working", you need to read the changelog and search for "Declarative Fields": https://developers.facebook.com/docs/apps/changelog#v2_4
So if you want to get more than just id and name, the API call would be like this: https://graph.facebook.com/936299239766048?access_token=YOURAPPTOKEN&fields=id,name,likes,...

How do you post a link to user's inbox in Facebook?

I am a iPhone application developer. I don't know how to send an "link" to a selected user's inbox in Facebook from my Facebook account.
You can't send messages using a Facebook API from the backend, but you can do through JS SDK or redirecting user to facebook url as per this link
FYI: Send Message
I don't exactly know if I understood your question, but: If you want to provide a link that a user follows in order to go to her/his Facebook inbox, you can use the URL scheme fb://mailbox (provided that she/he has the Facebook app installed)
As #Venu wrote, the api does not allow apps to send messages on the behalf of the user, only with the Send Dialog which you should be able to open using the iOS sdk Dialog.
Another approach you can use is the Chat API with which you can send messages on the behalf of the user, it requires the xmpp_login permission and you to implement an xmpp client.