Karan
Karan

Reputation: 15114

Sending message via Facebook throws 500 error

I am sending a private message via facebook from my app (website). It is an invitation link to the website - however, it gives the following error:

The website encountered an error while retrieving https://www.facebook.com/dialog/send. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition 

The link invitation link being sent is something like http://myapp.com/invitation - doesnt work http://myapp.com - works!

How can I make it work with something after a forward slash?

The actual code:

  :javascript
    $(function(){
      $('li.friend:not(.invited) label').live('click', function() {
        FB.init({appId: #{Rails.application.config.fb_app_id}, xfbml: true, cookie: true})
        FB.ui({
          method: 'send',
          display: 'popup',
          name: 'New Invitation',
          link: 'http://myapp.com/invitation/',
          to: this.parentNode.getAttribute("data-id"),
          frictionlessRequests:true,
          show_error: 'true'
        })
        $(this).parent().addClass("invited")
        $(this).siblings().prop("checked", true)
      })
    });

Upvotes: 2

Views: 2211

Answers (1)

Igy
Igy

Reputation: 43816

You have 'frictionlessRequests' and 'method: send' there; those aren't compatible options. The frictionlessRequests: true, should be in your FB.init() call and affects how the Requests dialog works when pre-filling recipients, what you have there is a mix of parameters from different dialogs

A sample send dialog call is:

  FB.ui({
          method: 'send',
          name: 'People Argue Just to Win',
          link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
          });

and a sample apprequests dialog:

FB.ui({
    method: 'apprequests',
    message: 'Come use this app with me.'
  });
}

Also (as you discovered) the link needs to resolve correctly a return a 200 response; if it redirects immediately it won't work correctly

Upvotes: 1

Related Questions