Priyank Gupta
Priyank Gupta

Reputation: 803

facebook send API Error Code: 100 API Error Description: Invalid parameter Error Message: 'link' is invalid

I am using facebook post GRAPH UI for posting private message with link to my application in facebook. Earlier it was working fine but from last two days the dialog started throwing error as :

An error occurred. Please try again later.

API Error Code: 100
API Error Description: Invalid parameter
Error Message: 'link' is invalid.

for sending message I am using code :

function sendMessage(id) {
  FB.ui({
    method : 'send',
    name : 'My APP',
    link : 'https://apps.facebook.com/MY_APP/',
    to : id,
    show_error : 'true',
    description : 'my description'
  });
}

I have Googled about this and only relevant information I get is that facebook is blocking the link to its own domain as to avoid spam. as I change the link to other live site its working.

I need to send link to my application as I have to provide such functionality.

Upvotes: 10

Views: 39166

Answers (4)

Zach Lysobey
Zach Lysobey

Reputation: 15714

I've had similar issues, and figured I'd share the results of my investigation here.

The only information in the Facebook documentation describing the link parameter is not terribly helpful:

link -The URL that is being sent in the message.

There are a couple other StackOverflow questions similar / related to this one:

Facebook API Error 100 - invalid link

this problem ended up being a malformed picture parameter

Facebook FB.ui send dialog intermittently returns invalid link error -

"The issue revolved around our url being dynamic and needing force caching each time. I now make an ajax call to "https://developers.facebook.com/tools/debug/og/object" to refresh it and then launch the send dialog."

I still don't know precisely what constitutes a valid link parameter, but...

Making some inferences from the above questions & responses, as well as some testing on my part, valid link parameters:

  • Must be "fully qualified". I.E. containing http:// or https://
  • Must not be facebook.com links
  • Might not like redirects (or you have to be sneaky with them)
  • Do support URLs not in the "App Domains" list
  • Do support Query Strings
  • May be finicky regarding dynamically generated pages (as in this question)

Apparently Facebook has some sort of link crawling mechanism that performs some unknown tests on a link parameter to determine its validity. I only wish they would choose to document it for us.

Upvotes: 6

mike
mike

Reputation: 1

If bad parameter occurs and and message reads "API Error Code: 100" - Make sure the box beside "Share with playlist starting from" is unchecked in youtube and that error won't show.

Upvotes: -1

Ishank Gupta
Ishank Gupta

Reputation: 1593

Found a solution:

Facebook Send Dialog Error Code: 100 API Error Description: Invalid parameter Error Message: ‘link’ is invalid.


Problem Cause:

Facebook is not allowing to use its own link as to stop spamming.

Problem Solution:

There is as such no solution as its bared by Facebook API.

Other workout:

Shorten URL, but its didn’t works as Facebook check the provided URL. Redirect URL, same as above. In my case I have deployed an additional HTML page just use to redirect to the Facebook App link. Just remember that you should have a timer for few seconds as Facebook scans the provided URL, so it wont be able to detect that the page is redirecting to same Application Link. I have used the following code for my HTML file:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>My Application</title>
</head>
<body>
    <p id="demo"></p>
</body>
<script type="text/javascript">
    var url = "https://apps.facebook.com/MY_APPLICATION_ID";
    var myVar = setInterval(function() {
        myTimer()
    }, 1000);
    var counter = 3;
    function myTimer() {
        if (counter == 0) {
            window.location.replace(url);
            window.clearInterval(myVar);
        }
        document.getElementById("demo").innerHTML = "you will be redirected in "
                + counter + " seconds...";
        counter = counter - 1;
    }
</script>
</html>

Upvotes: 3

glautrou
glautrou

Reputation: 3198

I had the exact same problem except that my link was pointing to my website.

In case someone is in a similar scenario please check at this solution. Hope that will help some people.

Upvotes: 0

Related Questions