通过Facebook发送消息会引发500错误

时间:2012-05-03 19:46:26

标签: facebook facebook-javascript-sdk

我从我的应用程序(网站)通过Facebook发送私人消息。它是网站的邀请链接 - 但是,它会出现以下错误:

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 

正在发送的链接邀请链接类似于 http://myapp.com/invitation - 不起作用 http://myapp.com - 有效!

如何在正斜杠后使其与某些东西一起使用?

实际代码:

  :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)
      })
    });

1 个答案:

答案 0 :(得分:1)

你有'frictionlessRequests'和'方法:发送'那里;那些不兼容的选项。 frictionlessRequests: true应该在您的FB.init()调用中,并影响预填充收件人时“请求”对话框的工作方式,您所拥有的内容是来自不同对话框的混合参数

示例send dialog来电是:

  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',
          });

和示例apprequests dialog

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

另外(正如您所发现的)链接需要正确解析返回200响应;如果它立即重定向它将无法正常工作