Facebook Graph API tag friend(s) while post message - facebook

I want post some message and tag friends like facebook (web version) does. For example, "simple message #SomeUser". So the question is: how can i tag friends and what is the easiest way to do that?
As i understand there are two ways to do that:
1) https://developers.facebook.com/docs/graph-api/reference/v2.1/user/feed#pubfields but i don't understand why should i provide place id in order to tag friends and where to get (or generate ???) it. Moreover i don't understand where should i get user id. https://developers.facebook.com/docs/graph-api/reference/v2.1/user/taggable_friends? I don't know because request always fails.
2)https://developers.facebook.com/docs/opengraph/using-actions/v2.1#mentions ? I've tried #[userTaggingToken] and replaced userTaggingToken with user id from /user/taggable_friends. But it doesn't work too. Moreover, user id from /user/taggable_friends is much longer than one provided by example.
I abstract from any sdk so please don't refer to any programming language (and its SDK). Any links to documentation and examples with concrete requests (like .../v2.1/user/feed) and data should be passed (message="...") are welcome.

Related

How to programmatically build a reliable URL to Facebook entries (posts, comments, etc)

I notices that if you grab the post_id, parent_id, or comment_id that the Facebook APIs return (both the Graph API and the old one) and build the URL like this:
https://facebook.com/{$comment_id}
which will look something like this:
https://facebook.com/1120222941346063_1783629701671357
Facebook will automatically determine what entry that is, and link you directly to it, scrolling down to the exact entry and highlighting it in orange, just if you had given it the exact URL for that entry (something like: https://facebook.com/{$page_id}/posts/{$post_id}?comment_id={$comment_id}).
My question is: is using those ID codes to build URLs as in the first example a reliable way to do it? Will it work for all entries or are there unexpected effects I might encounter?
In all my tests it always worked, but I didn't find anything in the official documentation or in other SO questions.

Get share/like count for different url/bogposts/articles

I am looking for a method to get share/like count for each of the blogposts/articles which I create on my website. Interested in Facebook, LinkedIn and Twitter but Facebook is the most important right now.
Lets take this website as an example: https://googleblog.blogspot.com/
I have found a method to find this out for each url, but that will make it a lot harder for me as I would need to do it manually for each URL.
This is the query I used to get data for a specific URL:
https://graph.facebook.com/v2.7/?id=https://googleblog.blogspot.no/
Is there any method to get data for each and every url which contains: "company name" or something like this?
Will appriciate all the help I can get here.
No, there is no “wildcard” for Open Graph object URLs.
You can however request data for multiple URLs in one go, using the ?ids=foo,bar syntax – https://developers.facebook.com/docs/graph-api/using-graph-api/#multiidlookup
This theoretically works for up to 50 ids in one request (although with the ids being URLs in this case, you might only be able to request less, due to URL length limitations.)

Facebook - interests required List<unsigned int32> although Page ID are strings

I currently developed a solution for custom uploading videos for specific customers.
One of my customers need the ability to specify "interests" for a video he upload.
From the API documentation, interests are:
interests
list
One or more IDs of pages to target fans of pages.Use type of page to get possible IDs as find Targeting Options and use the returned id to specify.
There is some mis-documentation regarding this feature: "find Targeting Options" does not talks about type=page.
But, still, I can search for page, using the "search" endpoint: /2.5/search?q=gsw&type=page and get the ID of the page.
As to my understanding, I can specify a page, for example "Golden State Warriors" fan page, specify its id, and then every user which follows this page will be considered as interested in my post.
So, I think my flow should be:
1) Search for the requested page using the "search" api. Get the page's IDS.
2) When creating the video, specify the ID in the "interests" parameter list.
Now, I need to know how to specify the ID in the interests list - The documentation says it list, but the page ID as a number string...
So in conclusion, I would like some help in verifying that all that I have written is correct and make sense, and also to know how to get the int32 id of a page - is it just mistake in the documentaion?
Thanks!

Getting Facebook event information from URL

I've been reading some stuff about Facebook API's but as a non-programmer it's kinda hard to understand it all. It's probably a pretty simple question.
My question: is it possible to get all the information like coverphoto, time, description, location etc. from a (random) public Facebook event from just the URL of the event?
So I will have a field 'Insert event URL' on my page. Below that I will have some fields like 'Location' 'Start time' 'End time' which will be automatically filled in when the user inserts the URL of an event.
Please let me know! A link to the source with explanation etc. would also be really nice. (It's for a school project)
Yes you can. Ill try to explain you the simplest possible way to do that.
First of all go to : http://developers.facebook.com/apps and create an app.
Then, save the App access token which is: app_id|app_secret
Your url will be of format: https://www.facebook.com/events/{event-id}. Fetch the event id from this. Quite simple right?
Then you are going to use the facebook's powerful graph api. Just get the contents from : https://graph.facebook.com/{event-id}?access_token={app-access-token}
The list of all possible fields that you can get (only if set in the event of-course): https://developers.facebook.com/docs/graph-api/reference/user/events/#pubfields
That's it!

Facebook Graph API SEO Comments and Profanity Filter

I'm trying to integrate the Facebook comments left on our site in a way in which the content can be crawled by search engines and also for people (although I highly doubt there will be many) who don't have Javascript enabled on their browser.
Currently our Facebook comments are displayed via the use of the Facebook comment social plugin (using the <fb:comments href="MY_URL" num_posts="50" width="665"></fb:comments> tag). This ends up rendering an iFrame (which are mostly ignored by search engine crawlers) so the plan is to render this information and format it with basic HTML. To do this, the comments are pulled using the Graph API - this is then only be displayed to crawlers and people with Javascript disabled.
This all works nicely using the Graph API call (https://graph.facebook.com/comments/?ids=MY_URL), parsing the JSON result and displaying it on the page. The problem is that the <fb:comments> approach filters our results based on a blacklist we have set up on one of our Facebook Apps. The AppId with the relevant blacklist is stored on the page using metadata (<meta property="fb:app_id" content="APP_ID"/>) which the <fb:comments> control obviously must somehow use to filter the comments.
The problem is the Graph API method does not filter any results as I guess no blacklist (or App Id containing a blacklist) is specified. Does anyone know how to specify a Facebook App ID to the API call URL or of another way to not fetch commnents back that violate the terms of the blacklist?
On a side note, I know the debate about filtering content in comments rages on but it is a management decision to implement the blacklist, and one that I have no influence in changing - just incase anyone felt the need to explain the reasons why content filtering is or isn't a good idea!
Any thoughts on a solution?
Unfortunately there's no way to access a filtered list of comments using the API - it might be a reasonably request to have this in the API - you should file a wishlist item in Facebook's bug tracker
Otherwise, the only solution I can think of is to implement your own filter on your side when retrieving and displaying the comments from the API.
According to the Comments plugin documentation the filter on Facebook's side is implemented as a simple substring match, so it should be trivial to implement.
A fairly simple regular expression match should be able to check each comment against a relatively long list quickly.
(Unfortunately, the tradeoff here is that implementing a filter is easy, but you'd also need to write an interface so that whoever's updating the list of disallowed words can maintain the list for both the Facebook plugin, and your own filtering.)
Quote from docs:
The comment is checked via substring matching. This means if you blacklist the
word 'at', if the comment contains the sequence 'a' 't' anywhere it will be
marked with limited visibility; e.g. if the comment contained the words 'bat',
'hat', 'attend', etc it would be caught.
Pretty sure there is no current way of doing this from the graph API, the only thing I can suggest is taking the blacklist and build your own filter