Tag persons in Facebook page post - facebook

I've written a Facebook web application, which is able to post links to the app page feed (as the page) by requesting the page token and doing a post request to the /PAGE_ID Graph REST endpoint. So far, so good, but I'd like to tag the links with their authors as well. When I add the tags parameter to this request with a value of my user id (I am an admin of the page), this works fine. But when I enter another user id (even one that likes the app page), no tagging is done. Does anyone have any experience with this? Some blog post suggest this is not possible using the Graph API, even though this is possible when done manually.
Thanks!

If I understand correctly what you want to do, it is no longer possible with the new version of the Facebook's API (v.2.0).
Refer to this page for more informations.

Related

Facebook Graph API pull a Posts basic data like Instagram Basic API

We are developing a mobile app that if share a FB post link to it, like you can share on WhatsApp, we want to be able to read the title or summary or start of that FB post, and redirect our App to the corresponding area.
So it works on Instagram using: https://developers.facebook.com/docs/instagram-basic-display-api/
Where give the post ID and it pulls in the caption text etc.
So works for IG and some other socials for anonymous users.
But for FB links, it mostly shows us the login page, in most cases (sometimes it worked on localhost maybe if logged-in - but could not recreate on server environments).
So cannot pull in any info about the post have shared using a direct FB share URL or maybe via some method on FB Graph Api, we could not see an easy way.
Does anyone know a generic method that anyone sharing a post to an app, or even just being able to see the title or summary of a FB post using the default share link, so we can direct our App to the right page.
So essentially using a FB post share link, we want to be able to read some basic data of that Post, whether logged in or not,
and happy to do this via Graph API or FB App or any other ways.
Again in summary - need to Get some user defined parameters or text or ideally hashtags from the post just using the share link of any FB Post/Page.
Any ideas or help appreciated.

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).

Programmatically posting Facebook comments

My application has obtained publish_stream permissions for a Facebook user.
I'd like to allow the user to post comments for a target URL directly from my mobile application, rather than opening up an embedded browser that then shows the Comment Box plugin. That is, the user doesn't necessarily want to post the link to their feed -- rather they want to participate in any Facebook comment discussion that surrounds that URL.
Naturally, I can read the comments for any URL via the Graph API (eg: a techcrunch article) but I do not know how, or if I can add comments to an arbitrary URL programmatically.
Would love to hear any other suggestions or workarounds as well. My hope is to piggy back on Facebook comments to allow my users to have a conversation surrounding URLs of interest to them. If at all possible, I'd also prefer to use Facebook, though I can see using Disqus or similar services would be another possibility.
Use graph api, demo comments here
make POST to
http://graph.facebook.com/comments/?ids=http://techcrunch.com/2011/07/22/big-surprise-the-ipad-trumps-android-tablets-at-the-office/
with field message and value "yourmessage"
I genuine Facebook API bug.
Cannot comment via Graph API on Comments Plugin (Probably try Legacy API)
Graph API

Streaming Facebook Pages Wall (not just the pages posts)

I have looked on 100 forums looking for a simple answer for how to stream every post on a Facebook page's wall (not using the like box for just the pages posts, but everyone's posts). I am the admin of the page and I am already using the like box for my posts so I understand that, however the developer pages of Facebook are too confusing for such a simple task. I will be inserting the stream into an HTML page which will be hosted on www.1and1.com so it can handle most, if not all code.
I know it is a lot to ask but is there evem someplace online that will offer plain step-by-step instructions for my specific needs?
If the social plugins they make available aren't sufficient, you could just pull in the feed with the Facebook graph api using the javascript sdk (easiest) or there is probably an SDK for whatever programming language you know. For example, you can see a list of posts on the coca cola page using the Facebook graph explorer:
https://developers.facebook.com/tools/explorer/?method=GET&path=cocacola%2Ffeed
The /page/feed method needs an access token, but you can use the graph explorer to get an offline_access token that you can use to pull the data in. This may eliminate javascript sdk usage though unless you want to first prompt users to authenticate your application. But otherwise you would just parse the json feed that is returned in the url indicated in the graph explorer (and add your access_token to the end of the url).
Here is a good PHP tutorial on how to display a groups feed on a web page. It would be just as easy to display the posts from a page (since you are the admin)
Just replace the group ID with the page ID. Here is a link to the feed for the Facebook Platform feed graph api results. More info on FB Pages here.

Editing a User's Likes on Facebook

I've been looking at the Facebook API to find some way to edit a user's Likes (that is, add or remove items from https://graph.facebook.com/me/likes/). The API doesn't say anything about it specifically, but does say this:
You can publish to the Facebook graph by issuing HTTP POST requests to the appropriate connection URLs above.
Where above, one of the connection URLs is the aforementioned https://graph.facebook.com/me/likes link. However, there's no documentation for the PROFILE_ID/likes post, and whenever I try to post it returns the error "invalid post_id".
I assume this is because to like something, you post a request to POST_ID/likes. It's a bit inconsistent. What I'm trying to do is get the user's profile to add a Page to their likes (by posting using the page's id as an "id" parameter in the post body). However, it seems like there's just no way to edit user's likes.
At the end of the day, I just want to allow a user to click a button in my application (mobile device application, not a web app) and have them add our Facebook page into their list of pages, and I've found no way of doing that short of presenting our page to them and making them click on the "Like" button manually. Many other things are supported without showing the Facebook website, like posting to their wall or making albums, but I can't find anything to do this.
Any ideas?
Looks like I can't. Not in the way I want to anyway.