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

help using the open graph #667

Closed
rhadu opened this issue Sep 16, 2014 · 5 comments
Closed

help using the open graph #667

rhadu opened this issue Sep 16, 2014 · 5 comments

Comments

@rhadu
Copy link

rhadu commented Sep 16, 2014

Can someone please direct me in the right direction of implementing a custom story using the open graph?

i tried the following code but it doesn't even fire. i know i'm doing something wrong.

facebookConnectPlugin.api('me/Claimed:find?method=post&fb:explicitly_shared=true&message=You should really try this app', ['publish_actions'],
function(response) {
// Return the id of the posted element !
console.log(response);
},
function(error) {
console.log(error);
}
);

do i also have to do something else in the facebook developer dashboard as long as i'm in development stage?
Any help is appreciated! Thanks!

@chauthai
Copy link

Hi,

I had a similar problem and implemented a custom apiPost method to reflect the Facebook JS SDK API (https://developers.facebook.com/docs/javascript/reference/FB.api)

It is a fix for the web version only at the moment.
You need to add this method to the facebookConnectPlugin.js:

apiPost: function (graphPath, method, object, s, f) {
        try {
            FB.api(graphPath, method, object, function (response){
                if (response.error) {
                    f(response);
                } else {
                    s(response);
                }
            });
        } catch (error) {
            if (!f) {
                console.error(error.message);
            } else {
                f(error.message);
            }
        }
    }

Success and error callbacks are handled like the rest of the plugin.
I think the normal api method only supports GET methods to retrieve information, but not to post a custom story.

This fix still needs testing with the mobile app SDKs on Android and iOS.

@mellinger
Copy link

Fix gets overwritten by the injected JS file upon build :(

@chauthai
Copy link

chauthai commented Oct 9, 2014

Hi mellinger,

you need to check where you edit the facebookConnectPlugin.js.
If you edit it in the destination folder of a platform, it may get overwritten by the cordova build process for each platform.
So I suggest to double check that.
Since I'm only using this fix for the web version atm, I manually copied it into my deployment folder.
After a while I build a grunt task for it.

I'm beginning with the implementation for this feature for Android now. I'll keep you posted and will submit a pull request when it is done.

Cheers

Chau

@mellinger
Copy link

Thanks for your response! I've just been using the HTTP API, excited to see it in though.

@aogilvie
Copy link
Collaborator

@rhadu PR for Open Graph Story is here: #747 still work in progress

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

4 participants