Publish a story on Facebook timeline - facebook

I'm very new to Facebook Open Graph. What I want to do is simply when a user opens a webpage, it will send a story to his/her timeline. I have created an "Eat a Meal" action on Open Graph. When I click Get code, I get something like this :
https://graph.facebook.com/me/project:eat?
access_token=ACCESS_TOKEN&
method=POST&
meal=http%3A%2F%2Fsamples.ogp.me%2F325653997592127
When I click on this code, I am redirected to another page. I get an Access Token there and then when I click submit I get something like this :
{
"id": "274655529384281"
}
When I click the id, I get this :
{
"id": "274555552716206",
"from": {
"id": "274673726099999",
"name": "Jason McJason"
},
"start_time": "2014-07-16T14:23:26+0000",
"end_time": "2014-07-16T14:23:26+0000",
"publish_time": "2014-07-16T14:23:26+0000",
"application": {
"name": "Project",
"namespace": "project",
"id": "325123427594834"
},
"data": {
"meal": {
"id": "539535656565608",
"url": "http://samples.ogp.me/325625656562127",
"type": "project:meal",
"title": "Sample Meal"
}
},
"type": "project:eat",
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
}
But I don't know what to do with all of this data. I just have a simple HTML page. Where should I put these data? I'm a little lost and Facebook's documentation didn't help much. I'd appreciate if you tell me what to do with these. Thanks.

You need to integrate Facebook JS SDK on your web page.
Read up through this documentation- https://developers.facebook.com/docs/javascript/quickstart/v2.0
The very last example creates a post.

Related

page-id/notifications returns an empty array

I'm writing a desktop application using Facebook SDK .NET. This app must do somethink for every post, comment or message sent to a Facebook page. I'm using the page-id/notifications API command:
page-id/notifications?fields=id,title,unread,application,from,message,object&limit=250
This command returns correct unseen count in summary section but data array is empty:
{
"data": [
],
"summary": {
"unseen_count": 2,
"updated_time": "2016-02-05T14:53:10+0000"
}
}
If someone write a new wall post on the page or send a private message to the page, unseen_count is updated but data array is always empty. If someoune write a comment to an exisiting wall post unseen_count is updates and data array is populated with a comment notification (only this type of notification are added to data array):
{
"data": [
{
"id": "notif_XXXXXXXXXXXXXXX_XXXXXXXXXXXXXXXX",
"title": "yyyyy yyyyyyy commented on his post.",
"unread": 1,
"application": {
"link": "https://www.facebook.com/games/?app_id=xxxxxxxxxxx",
"name": "Feed Comments",
"id": "1967xxxxxxx"
},
"from": {
"name": "Mxxxx Sxxxxxx",
"id": "1020xxxxxxxxxxxxx"
},
"object": {
"created_time": "2016-02-05T14:52:32+0000",
"message": "ABCDEFGHILMNOPQRSTUVZ",
"id": "36xxxxxxxxxxxx0_546xxxxxxxxxxx0"
},
"to": {
"name": "Ixxxxxxx",
"id": "36xxxxxxxxxxxxx"
}
}
],
"paging": {
"previous": "xxxxxxxxxxxxxxxxxxxxxxxxxx",
"next": "xxxxxxxxxxxxxxxxxxxx
},
"summary": {
"unseen_count": 3,
"updated_time": "2016-02-05T14:55:23+0000"
}
}
Is it an API bug or there is something wrong in my API request?
I CANNOT use real time notification.
Thanks
Marco

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.

How To Find Out What A User "Liked" Facebook API

I'm currently calling the facebook me/home edge to get the users home feed. In the results I might get an entry like the JSON posted below.
My question is, when I get an entry like that where the user's friend ".. likes a link." How do I find out what link they liked? I'm trying to get the title and URL, but can't seem to figure out how. I've try just about every option using facebook's graph explorer.
Ideally, I would like that information to be returned when I made the /me/home request. I tried adding "attachments" to the fields parameter, but that didn't work.
{
actions=({
link="https://www.facebook.com/10154950234790111/posts/323892414481111";name=Comment;
});
comments={
};
"created_time"="2015-01-02T23:18:16+0000";from={
id=10154950234790453;name="Brian Joe";
};
id="10154950234790453_3238924144862222";
likes={
};
privacy={
value="";
};
story="Brian Joe likes a link.";
"story_tags"={
0=({
id=10154950234790111;
length=14;
name="Brian Joe";
offset=0;
type=user;
});
};
type=status;
"updated_time"="2015-01-02T23:18:16+0000";
}
This is a long standing bug in Facebook, probably older than two years.
https://developers.facebook.com/bugs/648986871793611/
https://developers.facebook.com/bugs/522743067756848/
I and many others have given up trying to repro this for Facebook Support.
You can give it a go if you want by reporting it to https://developers.facebook.com/bugs
Ideally Facebook should be inserting the object target in the story_tags like this
{
"story": "phwd likes Moët & Chandon.",
"story_tags": {
"0": [
{
"id": "13608786",
"name": "phwd",
"offset": 0,
"length": 17,
"type": "user"
}
],
"24": [
{
"id": "38995979792",
"name": "Moët & Chandon",
"offset": 24,
"length": 14,
"type": "page"
}
]
},
"id": "13608786_10101895322580287",
"created_time": "2015-01-03T17:35:51+0000"
},
Where this object
"24": [
{
"id": "38995979792",
"name": "Moët & Chandon",
"offset": 24,
"length": 14,
"type": "page"
}
]
Would instead be something like
"24": [
{
"id": "event_id",
"name": "Name of event",
"offset": 24,
"length": 14,
"type": "event"
}
]
So it ends up really being a feature request.

Facebook Graph API: read posts by other apps on users wall

this is my first question on stackoverflow. Tried searching for this but none of the answers helped.
The problem is that im trying to use Graph API's read_stream permission to read the users stream. That works (mostly) but what i'm really instrested is posts from other apps like Endomondo and Runtastic (sports tracking stuff) -- but they dont show up at the graph explorer, only posts by the user himself.
What can i do?
You will need the proper OG action permission. For example, assuming Runtastic is a fitness action application, you will use user_actions.fitness permission and then call /me/fitness.runs
{
"data": [
{
"id": "10101174611725617",
"from": {
"name": "☃",
"id": "4"
},
"start_time": "2013-05-24T20:22:26+0000",
"end_time": "2013-05-24T20:22:26+0000",
"publish_time": "2013-05-24T20:22:26+0000",
"application": {
"name": "runtastic.com",
"namespace": "runtastic",
"id": "162918433202"
},
"data": {
"course": {
"id": "375109895929036",
"url": "http://www.runtastic.com/en/users/☃/sport-sessions/75329736",
"type": "fitness.course",
"title": "a 0h 0m 20s run"
}
},
"type": "fitness.runs",
"no_feed_story": false,
"likes": {
"count": 0,
"can_like": true,
"user_likes": false
},
"comments": {
"count": 0,
"can_comment": true,
"comment_order": "chronological"
}
},

Is there a way to get recent video.watches activity for a specific app?

I want to give the user a UI to delete activity. I'm aware of it, but I'd rather not use the Activity social plugin. I know that it is possible to get activity using Graph API:
me/video.watches
example response:
{ "data": [ {
"id": "10101573590568760",
"from": {
"id": "123546",
"name": "John Doe"
},
"start_time": "2012-02-01T18:53:34+0000",
"end_time": "2012-02-01T18:53:34+0000",
"publish_time": "2012-02-01T18:53:34+0000",
"application": {
"id": "123456789123",
"name": "test_app"
},
"data": {
"movie": {
"id": "123456789123456789",
"url": "http://example.com/movie/My-Movie-Title",
"type": "video.movie",
"title": "My Movie Title"
}
}, "likes": {
"count": 0
}, "comments": {
"count": 0
}
}
However, for global action types, this may return other apps as well. I am only interested in my app specifically. Is there a way to limit returned data to my app only?
Appears that video.watches only returns activity items for the current app.