Facebook - How to create an URL to fanpage from fanpage name? - facebook

I have a fanpage name, for example: "Funny Vines". Real URL of this fanpage is: https://www.facebook.com/funnyvinesofficalpage/
How I can get/create this URL when I have only name of this fanpage ("Funny Vines")?
Thanks.

You can use the Search API:
/search?type=page&q=Funny Vines&fields=name,link
Docs: https://developers.facebook.com/docs/graph-api/using-graph-api#search
Keep in mind that this is a search, so you don´t just get one result, obviously:
{
"data": [
{
"name": "Funny Vines",
"link": "https://www.facebook.com/funnyvinesofficalpage/",
"id": "662605137102011"
},
{
"name": "Funny Vines",
"link": "https://www.facebook.com/FunnyVinesLovers/",
"id": "979586622060309"
},
{
"name": "Iligan Funny Vines and Pictures",
"link": "https://www.facebook.com/Iligan-Funny-Vines-and-Pictures-304142043018984/",
"id": "304142043018984"
},
{
"name": "Funny Vines",
"link": "https://www.facebook.com/vines6/",
"id": "433033710153363"
},
{
"name": "Funny Viral Vines",
"link": "https://www.facebook.com/Funny-Viral-Vines-1375072712767279/",
"id": "1375072712767279"
},
...

Related

facebook graph api doesn't return the statuses i shared

I'm trying to fetch all my facebook timeline posts throw the facebook Graph API.
I'm playing with the Graph Explorer and have an access token with this permissions: (user_posts, read_stream) but when i call the endpoint "/posts" or "/feed" in the graph-api, the statues i shared (not i created) on my timeline (friends public status that i shared) didn't return.
this is a screenshot from my timeline
any idea?
If you share another POST - status then I dont think there is a way that will show up in your feed. It will show up under the user's feed who originally shared it, under posts and sharedposts
But if you share a link then it will show up under your feed as shared_story
Example from my feed
{
"data": [
{
"id": "XXXXXXXX",
"from": {
"id": "XXXXXXXX",
"name": "XXXXXXXX"
},
"story": "Vrashabh Irde shared a link.",
"story_tags": {
"0": [
{
"id": "XXXXXXXX",
"name": "XXXXXXXX",
"type": "user",
"offset": 0,
"length": 13
}
]
},
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQAvV7MyLsxFjRDc&w=130&h=130&url=https%3A%2F%2Ftctechcrunch2011.files.wordpress.com%2F2015%2F05%2Fdave-goldberg.jpg%3Fw%3D560%26h%3D292%26crop%3D1&cfs=1&sx=1&sy=0&sw=292&sh=292",
"link": "http://tcrn.ch/1GR0HU3",
"name": "Dave Goldberg, SurveyMonkey CEO, Dies Unexpectedly",
"caption": "tcrn.ch",
"description": "Silicon Valley and the wider world of technology are mourning the very sudden death of Dave Goldberg, a long time entrepreneur and investor, CEO of..",
"icon": "https://www.facebook.com/images/icons/post.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
},
{
"name": "Like",
"link": "https://www.facebook.com/XXXXXXXX/posts/XXXXXXXX"
}
],
"privacy": {
"value": "ALL_FRIENDS",
"description": "Your friends",
"friends": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "shared_story",
"created_time": "2015-05-03T14:45:09+0000",
"updated_time": "2015-05-03T14:45:09+0000",
"is_hidden": false,
"subscribed": true
}
This is from what I know, I dont see any documentation that says otherwise, good to have someone from Facebook comment here or you should probably raise a bug if this is not intended.

Getting high res photos from Facebook News Feed API

I am trying to get a high resolution photo from the post below in my news feed. I tried calling https://graph.facebook.com/v2.1/10154603506630195 using the object_id based on advice here (getting high resolution photos that were posted on a page wall/feed) but it doesn't seem to work, any help would be much appreciated :)
{
"id": "10154603665915195_10154603509055195",
"from": {
"id": "10154603665915195",
"name": "John Smith"
},
"message": "I've taken up queuing as a new hobby during my short time in England. Here we are outside a store that won't open for another half hour...",
"picture": "https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xpf1/v/t34.0-12/s130x130/10699259_10154603507605195_419931109_n.jpg?oh=ff3ec0e772fea164bbd9d61e9ee9a4d0&oe=540E80D2&__gda__=1410242521_d3b2dc1c8f971610b07e0408cd62815b",
"link": "https://www.facebook.com/photo.php?fbid=10154603506630195&set=a.10150303996795195.555860.698310194&type=1&relevant_count=1",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yx/r/og8V99JVf8G.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
},
{
"name": "Like",
"link": "https://www.facebook.com/10154603665915195/posts/10154603509055195"
}
],
"privacy": {
"value": ""
},
"type": "photo",
"status_type": "added_photos",
"object_id": "10154603506630195",
"application": {
"name": "Facebook for iPhone",
"namespace": "fbiphone",
"id": "6628568379"
},
"created_time": "2014-09-07T10:40:03+0000",
"updated_time": "2014-09-07T10:40:03+0000",
"likes": {
"data": [
{
"id": "711243852300920",
"name": "Megumi Yoshida Atobe"
},
{
"id": "10152707756462594",
"name": "Emily Stokes-Rees"
},
{
"id": "10152741507272044",
"name": "Lina Kumamaru Sato"
}
],
"paging": {
"cursors": {
"after": "MTAxNTI3NDE1MDcyNzIwNDQ=",
"before": "NzExMjQzODUyMzAwOTIw"
}
}
}
}
If you are using the FB Graph API, ask for the full_picture field in your request:
FB.api('10153224297552834_10153268631032834?fields=full_picture', function (response) {
console.log(response.full_picture);
});
Try specifying the attachments field in your request.
/v2.2/<someId>/feed?fields=attachments
This will give you an 'attachments' field, with some media inside. You'll find there high res images.

How can I get the liked photo from a Facebook post with description "XXX liked a photo."?

Using the Facebook graph API I can get a post that looks like this:
{
"id": "774345031_10153960483905032",
"from": {
"id": "774345031",
"name": "Ben Davis"
},
"story": "Ben Davis likes a photo.",
"story_tags": {
"0": [
{
"id": "774345031",
"name": "Ben Davis",
"offset": 0,
"length": 9,
"type": "user"
}
]
},
"privacy": {
"value": ""
},
"type": "status",
"created_time": "2014-03-25T20:47:39+0000",
"updated_time": "2014-03-25T20:47:39+0000"
}
How can I get the mentioned photo?
You could try the following FQL query:
select pid, object_id, images from photo where pid in (select attachment.media.photo.pid from stream where post_id="774345031_10153960483905032")
For sure this is only working for Posts whih contain a photo reference. Be sure to gather the read_stream permission beforehand.

Facebook Graph API posts not appearing for users of page, only admin

I created a page on facebook, and am using the graph api to make posts on the timeline. These post show up just fine for me as the admin, but for users the page is empty.
I verified with the graph api explorer. As an admin a GET of /NewsCrier/feed is filled with data.
As a non admin user the same request returns
{
"data": [ ]
}
Here is an example post from the response of my admin user, notice the privacy is set to public:
{
"id": "383422711781035_404880726301900",
"from": {
"category": "Community",
"name": "News Crier",
"id": "383422711781035"
},
"message": "This appears to be the DC shooter, Aaron Alexis",
"picture": "https://fbexternal-a.akamaihd.net/safe_image.php?d=AQD4wR0Y9UVbb4Js&w=154&h=154&url=http%3A%2F%2Fwww.justmugshots.com%2Fimg%2F814064%2Flg%2Faaron-alexis.jpg",
"link": "http://www.justmugshots.com/texas/fort-worth/814064",
"name": "Aaron Alexis, Arrested on 2010-09-04",
"caption": "www.justmugshots.com",
"description": "Aaron Alexis was arrested in Fort Worth, Texas on 2010-09-04. See the mugshot now.",
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/383422711781035/posts/404880726301900"
},
{
"name": "Like",
"link": "https://www.facebook.com/383422711781035/posts/404880726301900"
}
],
"privacy": {
"description": "Public",
"value": "EVERYONE",
"friends": "",
"networks": "",
"allow": "",
"deny": ""
},
"type": "link",
"status_type": "shared_story",
"application": {
"name": "Reddit News Alerts",
"id": "693375074022011"
},
"created_time": "2013-09-16T19:36:07+0000",
"updated_time": "2013-09-16T19:36:07+0000"
}
The problem is that your Facebook app is in sandbox mode, as soon as you take the app from sandbox all the users will se the newly created posts ;)

Get more detail from Facebook Notifications?

I'm writing an app that gathers info from a users Facebook notifications. Using the Graph Explorer, I request:
me/notifications?include_read=true
and this returns a bunch of data. Each item is a notification item you would see when logging into Facebook. For example (ID/names changed slightly):
{
"id": "notif_630262196_168132987",
"from": {
"name": "John Bloggs",
"id": "822724665"
},
"to": {
"name": "Dermot Bloggs",
"id": "680265196"
},
"created_time": "2013-01-23T22:58:28+0000",
"updated_time": "2013-01-23T22:58:28+0000",
"title": "John Bloggs commented on your link: \"Goodbye Great Barrier Reef. Goodbye...\"",
"link": "http://www.facebook.com/<removed>/posts/330788937030559?comment_id=1702155",
"application": {
"name": "Links",
"id": "2309869772"
},
"unread": 0,
"object": null
}
The notification is in relation to a comment, but the "title:" field gets truncated if it is too long.
Is there a clean way I can programmatically access the comment directly, so I can get all the text, even if it is a 1000 character comment?
Thanks! :-)
You should be able to get the comment by parsing the link field and querying:
/330788937030559_1702155
or
/POSTID_COMMENTID
When I tested this on my account, I am getting a comments object in the returned data, with the full text of the comments. I've got most permissions enabled in my Graph API. I suspect adding read_stream to the permissions is what will give you this data.
You can avoid parsing! I've been doing a lot of experimentation with notifications and getting what I've called the 'source' object (the source object being the Facebook Graph Object from which the notification originates). Unfortunately, I can't find any documentation on how exactly this mechanism works, but if your app has been granted a lot of permissions, the "object" field which in the JSON you posted is null will actually be populated with the 'source object'. Instead of just "object" : null it will look like this:
"object": {
"id": "587140489_588632201147717",
"from": {
"name": "Dave Rodríguez",
"id": "587140489"
},
"message": ":D ",
"picture": "https://fbcdn-vthumb-a.akamaihd.net/hvthumb-ak-prn1/632550_478955408819349_478954732152750_60483_1892_t.jpg",
"link": "https://www.facebook.com/photo.php?v=478954732152750",
"source": "http://video.ak.fbcdn.net/hvideo-ak-prn1/v/754708_478955348819355_1792301950_n.mp4?oh=c7295ccfc3773f24de931e4c29f512ce&oe=513F1728&__gda__=1363127340_9302c108824176369427a0b17491b800",
"name": "¡¡¡EL SECRETO DE LA CHANCLA!!!!",
"description": "EL SECRETO DE LAS MADRES, EL MÁS UTILIZADO EN TODAS LAS GENERACIONES, VÉALO USTED MISMO Y ((COMPARTA))!",
"properties": [
{
"name": "Length",
"text": "1:13"
}
],
"icon": "https://fbstatic-a.akamaihd.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif",
"actions": [
{
"name": "Comment",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
},
{
"name": "Like",
"link": "https://www.facebook.com/587140489/posts/588632201147717"
}
],
"privacy": {
"value": ""
},
"type": "video",
"status_type": "shared_story",
"object_id": "478954732152750",
"application": {
"name": "Video",
"namespace": "video",
"id": "2392950137"
},
"created_time": "2013-03-10T20:45:20+0000",
"updated_time": "2013-03-10T20:45:20+0000",
"likes": {
"data": [
{
"name": "Adrian Guerra Cuenta Verificada",
"id": "674364748"
}
],
"count": 1
},
"comments": {
"count": 0
}
}
I hope somebody more knowledgeable than me can tell us exactly what permissions we need to see this field populated. I'd figure it out myself but there are so many permissions that brute-forcing the SUM(nCk(77,k),k,1,77)=151115727451828646838271 possible combinations of permissions would take a very long time.