Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Posting OpenGraph Object #759

Closed
jkassis opened this issue Oct 24, 2014 · 10 comments
Closed

Posting OpenGraph Object #759

jkassis opened this issue Oct 24, 2014 · 10 comments

Comments

@jkassis
Copy link

jkassis commented Oct 24, 2014

How do I post an Open Graph API Story?

In Javascript on the web it looks like this...
FB.api('me/' + fbAppName + ':' + storyId, 'post', objects, respond);

The FacebookConnectPlugin is read only?

Obj-C:

  • (void) makeGraphCall:(NSString *)graphPath

Javascript:
cordova.exec(respond, respond, "FacebookConnectPlugin",
"graphApi", [ 'me/' + fbAppName + ':' + storyId,
permissions ], [ "publish_actions" ]);

@jkassis
Copy link
Author

jkassis commented Oct 24, 2014

Anyone want to implement this?

Javascript 🔢
cordova.exec(respond, respond, "FacebookConnectPlugin",
"graphApi", [ 'me/' + fbAppName + ':' + storyId,
permissions ], [ "publish_actions" ], { restaurant : {title : "Chevy's", type : "restaurant.restaurant", description : "Fresh Mex", image : "http://chevys.com.s181584.gridserver.com/wp-content/uploads/2014/02/chevys_logo_171x95.png"}});

Obj-C ("Posting objects to the graph" Example from Facebook Docs @ https://developers.facebook.com/docs/ios/graph):

// Create an object
NSMutableDictionary *restaurant = [FBGraphObject openGraphObjectForPost];

// specify that this Open Graph object will be posted to Facebook
restaurant.provisionedForPost = YES;

// Add the standard object properties
restaurant[@"og"] = @{ @"title":@"Restaurant Name", @"type":@"restaurant.restaurant", @"description":@"a description", @"image":image };

// Add the properties restaurant inherits from place
restaurant[@"place"] = @{ @"location" : @{ @"longitude": @"-58.381667", @"latitude":@"-34.603333"} };

// Add the properties particular to the type restaurant.restaurant
restaurant[@"restaurant"] = @{@"category": @[@"Mexican"],
@"contact_info": @{@"street_address": @"123 Some st",
@"locality": @"Menlo Park",
@"region": @"CA",
@"phone_number": @"555-555-555",
@"website": @"http://www.example.com"}};

// Make the Graph API request to post the object
FBRequest *request = [FBRequest requestForPostWithGraphPath:@"me/objects/restaurant.restaurant"
graphObject:@{@"object":restaurant}];
[request startWithCompletionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
if (!error) {
// Sucess! Include your code to handle the results here
NSLog(@"result: %@", result);
_objectID = [result objectForKey:@"id"];
alertTitle = @"Object successfully created";
alertText = [NSString stringWithFormat:@"An object with id %@ has been created", _objectID];
[[[UIAlertView alloc] initWithTitle:alertTitle
message:alertText
delegate:self
cancelButtonTitle:@"OK!"
otherButtonTitles:nil] show];
} else {
// An error occurred, we need to handle the error
// See: https://developers.facebook.com/docs/ios/errors
}
}];

@aogilvie
Copy link
Collaborator

I'll implement the iOS version after this PR #747 for the Android version

@aogilvie
Copy link
Collaborator

We've decided it willl be part of the facebookConnectPlugin.shareDialog() API. As it is under the Facebook documentation:
screen shot 2014-10-29 at 10 39 39 am

@asoyfer
Copy link

asoyfer commented Nov 1, 2014

What exactly will you implement? I can already post a custom story now using an existing custom action and object using your plugin. Will your update allow for creating a new instance of an object from the share Dialog call?

@auching
Copy link

auching commented Dec 3, 2014

how can i make this simple open graph call using the plugin:

FB.api(
'me/video.watch',
'post',
{video: myVDO},
function(response) {}
);

As open graph story does not prompt a share dialog

@gabrielmancini
Copy link

i need post too, how i do?

@sunshineo
Copy link

+1 I just need to post to current user's wall without bring up the share dialog.

@thomasvbe
Copy link

Can it be that the share dialog with open graph stories only works in the web browser on your smart phone? Not in the native app?

@romuloctba
Copy link

+1 for opengraph posts support

@jkassis
Copy link
Author

jkassis commented Nov 11, 2020

stale

@jkassis jkassis closed this as completed Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants