Facebook Graph API how to post a comment to another user's public post? - facebook-graph-api

It works posting on pages stories with:
postId + "/comments"
where postId is for example
postId = "360637130688291_377801902305147"
but when posting into a user's public story that allows comments like this one the graph api is not able to find it.
"1430496489_4047336948376/comments" gets a reply as :
{"error":{"message":"(#100) Error finding the requested story","type":"OAuthException","code":100}}
Is this a common issue or am I doing something wrong?

I have tested it in the http://developers.facebook.com/tools/explorer with all permissions on, and it seems this is impossible.
Probably to avoid spam, otherwise anyone could start creating applications that would run through posts on other users walls, and leave a comment there with a link to the nearest porn site.
Strangely this works for posts on third party owned pages.

Related

Starting using Instagram oEmbed feature

What is the correct way to start using Instagram oEmbed feature? Documentation (https://developers.facebook.com/docs/instagram/oembed/) claims that I have to pass App Review to start using the feature. And application form says Please provide a URL where we can test Oembed Read. Which I don't have because I have no access to the feature.
What I have tried with no success:
I requested instagram_oembed resource with:
app token of application in live mode
app token of application in
development mode
passed URL to a post by official Instagram account
(e.g. https://www.instagram.com/p/CQG4gZxMzzO/)
passed URL to a post
of a user who is Admin of the app
In all cases I receive (#10) To use 'Oembed Read', your use of this endpoint must be reviewed and approved by Facebook. To submit this 'Oembed Read' feature for review please read our documentation on reviewable features: https://developers.facebook.com/docs/apps/review.
Example of the request I do https://graph.facebook.com/v11.0/instagram_oembed?url=https%3A%2F%2Fwww.instagram.com%2Fp%2FCQG4gZxMzzO%2F&access_token=appAccessToken
We're also suffering from this issue, but so far, we thought we already figured out how to do that.
Big picture
Facebook had not sorted this thing out correctly. Or at least, we don't know why they put such a restriction to this API.
The official document is not correct. (or at least not accurate for now, for some part)
Which part was not correct?
The access token part is not right. Or at least, it's the most confusion part.
How can we resolve this?
Use the Graph API Explorer
Adjust your token(App token, Client access token, user token) with the official URLs(see below) to see if you can get the result
most of us should be able to get the result with user access token, which means you have to access this API after login!
Integrate into your app for review
The review page is also confusing:
Please provide a URL where we can test Oembed Read. Include the URL of a page, post or video from our official Facebook or Instagram pages, or the pages themselves., it means you can only use links like https://www.facebook.com/instagram or https://www.facebook.com/facebook
With that in mind, so far, the only way to get approved is integrate your oembed usage into your normal UI with facebook user access token ready
Question to the big picture
So, we have to ask user to login with our facebook app, then we can provide this oembed read API returned embed HTML? I'm afraid that's what we have now.
big companies might be able to apply for App Token, I guess in that scenario, facebook login is not necessary
for small companies, indie developers, hmmm, I don't know any better solutions so far.
I have run into this too. I do not have an answer at this time, I just want to report on the frustrations of their 'app review' process. Which makes it feel like you are unlikely to get it to work any time soon.
We have a custom embed code for our weblog authors to use (a shortcode kind of thing) which does the oEmbed call. We just take the HTML from the resulting JSON, and insert it into the weblog article page, and that is it. It stopped working, presenting this same error - in live mode, and in development mode.
The kicker is, I then tried submitting it for app review. Filled out everything I could to the best of my knowledge. Provided them a test account and post on our weblog to show the shortcode editing and expected placement. We got rejected. Why? Your embedding resulted in an error, we can't see it in action to approve you.
Yes. The error I am getting is that I need my 'app' to be reviewed and approved.
This is an infuriating process. This is the only Facebook / Instagram API feature we use at this point. No user data. No attempt to make an Instagram clone app or anything like that. Just an embed.
And they are making this simple use case as impossible to use as they can. And the documentation also feels like an infinite loop. They say users of the old Instagram embed call have until September 7 2021 to get approved. But the call does not work at all because we are not approved. So we cannot get approved.
Same loop here. I've managed to report it to Facebook team and get answer "Just submit your Instagram post URL"! I can't believe it, its can't be so simple. I've confirmed it few times with Facebook team person and.... get rejected!
Also, second form in App Review process will LOWERCASE all of your links and I've spent few days just to explain it to reviewers and support person. Still rejected after submitting proper url. This is insane.
My another attempt was about to build a test page where I can auth via Facebook account, parse connected Instagram accounts and GET embed endpoint with user access key in hope that reviewer HAS access to oembed feature - REJECTED. I can't even find what permission I need to add to auth URL to obtain oembed thing.
Will update my answer with new information later.
UPDATE: After reporting about the issue with lowercase URL in submission form they just APPROVED my app without APP REVIEW. Well... Facebook style...
I had exactly the same problem recently. Updated the packages with compose, changed the API version from 10 to 11... without any change.
The error was also occurring in development mode, it didn't make sense that Facebook was asking to approve in dev mode.
For me, the problem came from the management of scopes in my application, depending on the version of the Facebook API used.
My advice: check the scopes defined with API version in your code first.
I had the same issue and the solution is very simple. The only thing you need to do is copy paste an instagram url in the input field saying: Please provide a URL where we can test Oembed Read.
I did the this link: https://www.instagram.com/p/G/
Which is actually the first instagram post :) Got approved. Hope this helps everybody!

Find out who has written a message in a Facebook Conversation

I'm dealing with bots in my app and a costumer ask me to auto detect the bot`s messages in a conversation.
When an app create a post I can see who wrote the post with: me/posts?fields=admin_creator
But when someone wrote a message in a conversation how can I see who wrote this message in the conversation API me/conversations?fields=messages
Edit:
I need to know who answer the message through my page. It was me, a bot, an app or other person who have the permission to answer by my page.
Solution #1
By reading the docs, I found this information that could help you:
It's not possible to request a message by its individual message ID. Instead you should get the message as part of the thread it's a part of.
Note that the message object has from and to objects, so
Taken from the Graph API Message docs.
Solution #2
If that doesn't help You, I'm sure these two posts from the chatbotsmagazine will:
In the post about a Swell app, the poster asks the question:
How could you identify the user? We have existing users in our
database who signed up with Facebook. There are two different user-ids
though, according to Facebook’s Docs:
(..) Ids are page-scoped. These ids differ from those returned from Facebook Login apps which are app-scoped. You must use ids retrieved from a Messenger integration for this page in order to function properly.
Then, they provided the answer to that question in this post:
FB Messenger Bot 🤖 — How to Identify a User via Page- & App-Scoped User-ID’s
I hope this helps.

disabling facebook comments with actions field on wall posts

My app allows users to interact with each other for a unique purpose. As part of this experience I post on user's wall so his/her friends can know about the post from user and they can come to app for interaction. But in this case, users may just end up commenting on the facebook page itself and my app will not have any knowledge of this interaction. To avoid this, I am wondering if I can disable comments on this post. Graph API documentations states that I can use the "actions" field on wall post for such purpose. I tried that with various combinations of Comment and empty link or link that takes the user to my app etc. But I notice that no matter what I set, facebook always shows link to the wall post instead of what I tried to put.
Any thoughts on how to achieve this purpose?
Thanks.

Facebook graph API to get get posts from Pages

I'm struggling in getting the posts from the public page in Facebook. For example
https://graph.facebook.com/cocacola
(Its a public page, those who liked it on facebook will get update.)
This returns me the page details only. How I can get the wall posts done by the user "cocacola".
Its quite simple. just do as
https://developers.facebook.com/docs/graph-api/reference/v2.2/page/f‌​eed
It will work.
I'm a bit late at the party but for completeness I would like to add:
Using the latest version 2.2 you can access the feed via the page id, eg:
https://graph.facebook.com/v2.2/PAGE_ID/feed?access_tkoen=YOUR_ACCESS_TOKEN
Individual posts can be retrieved too by their own id or via the feed.
https://graph.facebook.com/v2.2/POST_ID?access_token=YOUR_ACCESS_TOKEN
Maybe this was also possible with the older versions? Don't know, I'm just getting started.

Actions do not appear on timeline

I'm developing an app which publishes actions to the timeline.
On the app settings, I've created the action "post" and use the built in object type "article".
Although my graph actions have not been approved by facebook, that should not be a problem, because I am logged in as the developer of the app.
My article URLs pass facebook's linter with warnings, but no errors.
When my app notifies facebook of the the post action, it appears to succeed. Facebook returns an ID representing the action.
When I use facebook's graph explorer to view that ID, the data appears to be correct, showing the correct action type and object data. (If there's a URL to browse the action on facebook, instead of the graph explorer, I do not know what it is).
Still, with all the above apparently working without errors, I never see the action on my timeline. Whether I browse my own timeline, or when logged in as a friend and another developer of the app, I never see any indication on facebook.com that the action was performed.
What am I missing to make my custom action appear on my timeline page?
I had a similar problem. I was using OG and I could post everything successfully, but the posts didn't appear in timeline, but only in the activity log in Facebook.
I just went to the settings of the action and set "Explicitly Shared: This action can specify the user explicitly shared an action." to ON.
Then in my piece of code I put "true" to the key "fb:explicitly_shared" while creating the OG object.
If no error is being returned it sounds as if there is an issue in your public page that is preventing Facebook from knowing what to post.
Have you double checked your OG: meta tags through Facebook's validation tool [ https://developers.facebook.com/tools/debug ]. While you need all of the values to be filled in, the type bit is the most overlooked and must be setup properly to link to your particular application and corresponding action.
If your OG: data is correct and validating you should also check the detail settings for your action and aggregations. If the phrase / tense bits are not filled in Facebook may be uncertain how to make your post appear back to on the timeline.
Discoverd the problem....
My article page include an article:author tag. The URL in that tag was not visible to anonymous users. So, I'm guessing, facebook visited that author URL and received a HTTP 403.
When I removed the article:author tag, the items started appearing on my timeline.
So be careful with all tags and put all urls through facebook's debug tool.
Hmmm Interesting
Was having the same issue...
Using the XFBML, fb:like with all required og meta tags validating on the linter.
Last month when I liked a 'product' on my website, the post was published on my fb timeline wall no worries. Nice, perfect!
Today after clicking Like, I noticed it wasn't publishing to my timeline wall at all... but was logged in the Activity Feed.
It did however post to my wall if I commented on the Like Button flyout comment section.
Then I found this
"Pages of type article do not have publishing rights, and will not show up on user's profiles because they are not real world objects."
https://developers.facebook.com/docs/opengraphprotocol/#types
I've been getting the same issue with a feed dialog post. The posts can be navigated to directly, but doesn't show on timeline. More details here:
Actions not appearing on timeline
I had a similar problem, but everything was actually working correctly. If you get a returned ID and your article appears in your RECENT ACTIVITY, then all should be good.
The perceived issue, your post not appearing in your timeline, is actually the correct behavior. Your post doesn't appear in your timeline because it should appear in your friends' timeline as an activity that you completed. Once they comment or like it, then it should reappear on your timeline.
For me the issue was the posts doesn't show on timeline for all users except me also it was public !, i fixed it by make turn on application as online to be available to all users