Search code examples
facebookfacebook-graph-apifacebook-social-plugins

Can I send dynamic messages with the Facebook send button?


I would like to allow my users to invite their friend through Facebook private message to earn some rewards. I am wondering if it is possible to do it using the facebook send button. Sadly I found that the send button can only send a static url (such as www.website.com). However, I'd like to append different arguments from person to person (such as www.website.com/invite.php?token=tk12345) to the url. Any ideas?


Solution

  • With jQuery:

    <script src="http://code.jquery.com/jquery-latest.js"></script>
    <fb:send id="mysendbtn" href="www.website.com"></fb:send>
    <script>
        $("#mysendbtn").attr("href", "www.website.com/invite.php?token=tk12345");
    </script>