lambda8
lambda8

Reputation: 317

Post a message to Facebook using Facebook URL scheme on mobiles

From the website, I need to have a share button which will share some text to a user's wall through FACEBOOK APP.

I tried Facebook Javascript SDK, but it sometimes opens share in a new window instead of forcing on Facebook app.

So, I am trying to do this through Facebook Url scheme.

I have tried all of these but none of them worked.

fb://publish/?text=test
fb://post/test
fb://dialog/feed?app_id=fb_app_id&display=touch&href=test
fb://publish/post/?text=test

What are all the custom URL schemes supported by the Facebook iPhone app?

Can you please help? Thanks in advance.

Upvotes: 2

Views: 1067

Answers (1)

driedler
driedler

Reputation: 4190

This was working for me:

url = `fbapi://dialog/share?app_id=${fbid}&version=20130410&method_args=`
let methodArgs = {
  name: null,
  description: null,
  link: value,
  quote: null,
  hashtag: null,
  dataFailuresFatal: false
}

url += encodeURIComponent(JSON.stringify(methodArgs))

Where 'fbid' is your facebook app ID. And 'value' is the URL you want to share.

Then do something like:

<a href="url">Share link on facebook</a>

Upvotes: 1

Related Questions