0

I'm developing a referral application where users can refer their Facebook friends using a referral code. I'm using Facebook Javascript SDK. The problem I'm facing is that the send method works only for particular URLs, I mean if I change the users referral token in link parameter it gives me error 100 invalid link.

Here is the method :

FB.init({appId: app_id, xfbml: true, cookie: true});

FB.ui({        
    to : '********',    
    method: 'send',    
    name: 'Message',    
    link: 'example.com/emp?token=fAiS1ywL0lS8cUYtgLjk',    
    redirect_uri:'http://example.com'   
});

For some particular link values it works fine but if the token is changed it fails with invalid link error.

I'm stuck with fixing this issue. Am I missing something?

sakibmoon
  • 2,026
  • 3
  • 22
  • 32
Mahesh Gosemath
  • 416
  • 1
  • 4
  • 12
  • Duplicate of [this question](http://stackoverflow.com/questions/17982183/facebook-fb-ui-send-dialog-intermittently-returns-invalid-link-error/) – glautrou Aug 07 '13 at 08:17
  • Thanks. One more question what is og:url actually? The url of the page on which the script is written is different that the url in link I want to send. Then which URL should I specify in og:url meta tag? – Mahesh Gosemath Aug 07 '13 at 08:37
  • I created an answer summarizing this. – glautrou Aug 07 '13 at 09:00

1 Answers1

1

Duplicate of Facebook FB.ui send dialog intermittently returns invalid link error.

For your second question related to the og:url meta, to simplify you have to provide the URL of the current page.

The Open Graph Protocol says:

og:url - The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/".

To understand how those metas work you can check how News websites implement this with the Facebook Object Debugger. For example this link shows you the implemention of metas for a well-known newspaper website.

Community
  • 1
  • 1
glautrou
  • 3,140
  • 2
  • 29
  • 34
  • still having issues may be I'm not configuring url properly – Mahesh Gosemath Aug 07 '13 at 10:16
  • suppose my homepage is www.example.com and I want to share link with url www.example.com/emp?token=1234. What should be my og:url example.com or exmaple.com/emp? and on which page I need to mention og tags?. My questions may seem absurd but I'm a beginner. Please help. – Mahesh Gosemath Aug 07 '13 at 10:58
  • Your URL should be `www.example.com/emp?token=1234` and your meta are on your target page(www.example.com/emp?token=1234). Look at [how the New-York Times do it in Facebook debugger](https://developers.facebook.com/tools/debug/og/object?q=http%3A%2F%2Fwww.nytimes.com%2F2013%2F08%2F08%2Fworld%2Fafrica%2Fhuge-fire-shuts-down-nairobis-international-airport.html%3Fhp%26_r%3D0) – glautrou Aug 07 '13 at 11:34
  • Thanks for the link to the debugger, helped me solve my issue. FB needs to be able to scrape the url provided. – stephenmuss Aug 09 '13 at 01:28
  • I have tried with Facebook Debugger..but no improvement. Still getting the same. Please advice me. – user2003356 Oct 12 '13 at 06:22
  • Yesterday you asked help in multiple solved questions. Just read the answer and try to fix it, otherwise please create a new question. – glautrou Oct 13 '13 at 11:00