2

I am creating objects through the open graph object API, and attaching these to published stories. Both the object and the story are created, and FB returns id's as if everything worked out just fine.

However, while submitting the object/story for review it turned out two objects are created (of different object types) even though I only make one HTTP POST request.

Background

  • Our app is using namespace 'mynamespace'
  • We have created a custom open graph object with name 'myobject'
  • We have created a custom open graph action with name 'myaction'

Request details:

1) First we create an object:

POST /me/objects/mynamespace:myobject HTTP/1.1\r\nConnection: close\r\nHost: graph.facebook.com\r\nContent-Length: LENGTH\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n

URI decoded http body:

access_token=TOKEN&object={"url":"http://url.com","title":"My title","image":"https://imageurl.com","description":"My description"}

Response:

"{\"id\":\"123456789\"}"

2) Then we create a story (with this object referenced):

POST /me/mynamespace:myaction HTTP/1.1\r\nConnection: close\r\nHost: graph.facebook.com\r\nContent-Length: LENGHT\r\nContent-Type: application/x-www-form-urlencoded\r\n\r\n

URI decoded http body:

access_token=TOKEN&myobject=123456789&fb:explicitly_shared=true&message=User generated message

Response:

"{\"id\":\"12121212121\"}"

Expected result

  • One object of type mynamespace:myobject should be created
  • One story of type mynamespace:myaction should be created

Actual result

  • One object of type mynamespace:myobject is created
  • One story of type mynamespace:myaction is created
  • One object of type Object is created (according to reviewer)
  • One action of type Post is created (according to reviewer)

Only one story turned up in the user feed and in the object browser, but the reviewer told us following: Your action produces more than one published story when the user triggers the action. Users shouldn’t be surprised by multiple stories being published for a single in-app action. The action I took produced a "post" and a "myaction" story.

We had a look under (Open Graph -> Types) and it turned out that each time we make this request an object of type 'Object' and an action of type 'Post' is automatically created/defined! This must be what the reviewer complains about, but we haven't been able to figure out what we're doing wrong!

Any suggestions on how this can be solved is be very much appreciated.

Exact same issue when using the Open Graph API explorer

Turns out the exact same thing happens when creating an object through the Facebook Graph API explorer. When doing so the 'Object' object and the 'Post' action suddenly appears under Open Graph -> Types. Right now I see following reasons to this issue:

  • The object/action/story is set up incorrect in some way
  • The reviewer thought it was an issue when it actually wasn't
  • It's a FB bug

Object(s) created through the Graph API explorer

When creating an object through the Graph API explorer this is the resulting object:

{
  "id": "4324324234234234", 
  "url": "http://url.com", 
  "type": "mynamespace:myaction", 
  "title": "My title", 
  "image": [
    {
      "url": "https://imageurl.com"
    }
  ], 
  "description": "My description", 
  "updated_time": "2013-07-09T14:14:38+0000", 
  "created_time": "2013-07-09T14:14:38+0000", 
  "application": {
    "id": "432423423423", 
    "name": "appname", 
    "url": "https://www.facebook.com/apps/appurl"
  }, 
  "is_scraped": false, 
  "post_action_id": "23423423423423423"
}

The 'post_action_id' seems weird, and when requesting that object I get:

{
  "id": "423423423423", 
  "from": {
    "name": "My name", 
    "id": "234234"
  }, 
  "start_time": "2013-07-09T14:14:38+0000", 
  "end_time": "2013-07-09T14:14:38+0000", 
  "publish_time": "2013-07-09T14:14:38+0000", 
  "application": {
    "name": "appname", 
    "namespace": "mynamespace", 
    "id": "432423423423"
  }, 
  "data": {
    "object": {
      "id": "4324324234234234", 
      "url": "http://url.com", 
      "type": "mynamespace:myaction", 
      "title": "My title"
    }
  }, 
  "type": "og.posts", 
  "likes": {
    "count": 0, 
    "can_like": true, 
    "user_likes": false
  }, 
  "comments": {
    "count": 0, 
    "can_comment": true, 
    "comment_order": "chronological"
  }
}

The fact that the object already has a related og.posts object must be what the review think is the issue here. I still don't understand why this og.posts object automatically shows up as an open graph object though.

  • You don’t have to create an object beforehand when you just set your object up as a publicly reachable HTML page with all the relevant info in the OG meta tags – then you just have to give the URL of that object when posting an action. – CBroe Jul 08 '13 at 14:00
  • 1
    We started off using self-hosted objects (what you describe) but from my understanding this only works if you're sharing publicly accessible pages (no user authentication). In our case we're sharing a url which should only be reachable by logged in users on our site.Because of this we'll need to create the objects using the Object API, since the Facebook scrapers won't be able to reach any og tags on a secure page. (related: https://developers.facebook.com/docs/opengraph/using-object-api/). This means that your suggested solution unfortunately doesn't solve the issue. – Daniel Grahn Jul 08 '13 at 16:18
  • Got another reply from the reviewer, asking me to _not_ send 'message' and 'fb:explicitly_shared' in the publish action. This seems a bit weird since this is action properties, and now I'm not really sure how these should be passed in using their object API. – Daniel Grahn Jul 09 '13 at 14:11
  • And worth mentioning as well is the fact that the 'Object' object and the 'Type' object automagically shows up when creating the object, and not when making the publish request. – Daniel Grahn Jul 09 '13 at 14:12

2 Answers2

0

The issue here is that when the user clicks the "Peace" button on your site, two Open Graph actions are published and that's against our policy - one user action should not publish multiple stories. If you log in as your Open Graph Test User and check the Activity Log, you'll see the following two published actions with the same timestamp:

https://www.facebook.com/100006264788511/activity/1388570951361718 https://www.facebook.com/100006264788511/activity/1388570924695054

Are you sure your code is only making a single call to the Graph API when publishing the action?

  • I now see in the activity log that there's duplicate actions created when user does an action, but only one of them show up on their timeline. However, I am sure I only do one call to 'create object' and on call to 'publish story', as mentioned in my question. Are you sure we're supposed to make both of these calls to publish a story to the users timeline? – Daniel Grahn Jul 10 '13 at 08:17
  • Turns out both of these calls creates an activity in the activity log, but it's only the latter one (publish story) which ends up on my timeline. – Daniel Grahn Jul 10 '13 at 08:27
  • Seems like there could be a bug with the Object API. We'll investigate further and get back to you shortly. – Joseph Tuấn Anh Phan Jul 10 '13 at 08:38
  • Could you give us any updates around this Joseph? When can we expect this issue to be fixed? Right now our story can't get approved because of this issue, and it's blocking our release. – Daniel Grahn Jul 12 '13 at 13:19
  • This issue still happens when using the Object API. Joseph, please give us an update on when we can expect a fix for this. – Daniel Grahn Jul 15 '13 at 08:02
  • We are still waiting for feedback from Facebook regarding this issue. Please give us an update around this, and when we can expect our story to get approved. – Daniel Grahn Jul 18 '13 at 13:54
0

I'm not sure how this would map to your POSTs, but I was dealing with the same issue on iOS and the problem is posting both the object and the action. If you set the object on the field other of the action (instead of the objectId after posting) only one Activity is created. In my case, instead of doing:

NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost];
object.provisionedForPost = YES;
object[@"title"] = @"Title";
object[@"type"] = @"video.other";
object[@"url"] = url;
[FBRequestConnection startForPostOpenGraphObject:object
                               completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
    if (!error && [result objectForKey:@"id"]) {
        NSString* objectId = [result objectForKey:@"id"];
        id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
        action[@"explicitly_shared"] = @"true";
        action[@"other"] = objectId;
        [FBRequestConnection startForPostWithGraphPath:@"me/myNamespace:post"
                                           graphObject:action
                                     completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
         {
             // handle success and failures
         }];
    }
}];

I had to do:

NSMutableDictionary<FBOpenGraphObject> *object = [FBGraphObject openGraphObjectForPost];
object.provisionedForPost = YES;
object[@"title"] = @"Title";
object[@"type"] = @"video.other";
object[@"url"] = url;
id<FBOpenGraphAction> action = (id<FBOpenGraphAction>)[FBGraphObject graphObject];
action[@"explicitly_shared"] = @"true";
action[@"other"] = object;
[FBRequestConnection startForPostWithGraphPath:@"me/myNamespace:post"
                                   graphObject:action
                             completionHandler:^(FBRequestConnection *connection, id result, NSError *error)
{
    // handle success and failures
}];
elibud
  • 8,119
  • 2
  • 21
  • 21