2

I want to follow up this question. I use FB.ui to send link and got exactly the same error for some users. Is there anyway to check it and decide whether to display the ui to the user ?

API Error Code: 100
API Error Description: Invalid parameter
Error Message: Viewer cannot message specified recipients.

<a href='#' onClick="
        FB.ui({
          method: 'send',
          link: 'http://www.xxxxxxxxxxx.com',
          to: ###########,
          });
">Send a message</a>

Even when I use the url send method, some user does not work. For example:

Error User : https://www.facebook.com/dialog/send?app_id=123050457758183&name=People%20Argue%20Just%20to%20Win&link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&redirect_uri=https://www.bancsabadell.com/cs/Satellite/SabAtl/&to=100000104626944

Normal User: https://www.facebook.com/dialog/send?app_id=123050457758183&name=People%20Argue%20Just%20to%20Win&link=http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html&redirect_uri=https://www.bancsabadell.com/cs/Satellite/SabAtl/&to=1311251197

(this is the share link example taken from https://developers.facebook.com/docs/reference/dialogs/send/)


bug reported to facebook: https://developers.facebook.com/bugs/538638372825668

w00d
  • 5,416
  • 12
  • 53
  • 85

2 Answers2

2

Edit: in fact, everyone should be reachable through messages now. It's only there are new "filtering preferences". I guess this can_message field is now useless because it should always return true. I think it is going to be deprecated in a while.


In the user FQL table, you have a field that must verify what you need:

can_message (boolean): whether the user can send a message to another user

Source: https://developers.facebook.com/docs/reference/fql/user

select can_message from user where uid=USER_ID

USER_ID being the person that your app user want to send a message to.

Stéphane Bruckert
  • 21,706
  • 14
  • 92
  • 130
  • As I remember, I tried this. The can_message show that I can send message, but the FB.ui still show the error for that specific user. So I must assume that it must be in a different permission. – w00d Mar 06 '13 at 22:34
-3

You can use the FB api;

I use something like:

FB.api('/me/permissions', function (response) 
{
//check contents of response for required permissions here
fb_publish_perm = response.data[0]['publish_stream'] ? response.data[0]['publish_stream'] : false;

if (fb_publish_perm)
{
    // it permissions exist
}
else 
{
    // permissions dont exist launch the ui to request.
}

});

Please treat the above as psedo code, as it came straight off the top of my head!

  • but this is publish_stream permission ? Is it related to the send message permission ? – w00d Mar 02 '13 at 10:52
  • just swap out publish_stream with whatever permission you require – Mark Stephenson Mar 02 '13 at 14:53
  • 2
    that doesn't answer my question. I do not know which permission it is. – w00d Mar 02 '13 at 20:57
  • If its posting to someones wall (even if that includes a link) etc it would be publish_stream, https://developers.facebook.com/docs/howtos/login/handling-revoked-permissions/#step1 and https://developers.facebook.com/docs/concepts/login/permissions-login-dialog/ should tell you which permission to chose, based on the action you want. Reading the other message you cite you may want to look at the extended permissions around friends etc – Mark Stephenson Mar 02 '13 at 22:50
  • this is not a normal permission of the app that a user has authorized, but the permission of the user who is using the app toward another user. I cannot use your method to check this permission – w00d Mar 04 '13 at 12:30
  • replace the '/me/permissions' with '/fb user id/permissions'. – Mark Stephenson Mar 04 '13 at 14:37
  • also, I would wrap the permissions check with some thing like the code that follows, if you get an error you should be able to take appropriate action based on the response; if (!response || response.error) { // Error } else { // Successful } – Mark Stephenson Mar 04 '13 at 14:38
  • I dont understand why this is downvoted? The answer I have given works as described. If you disagree, can you let me know why? – Mark Stephenson Mar 14 '13 at 09:16