2

I'm currently developing a Facebook canvas app in which I let the users invite others to use the app, pretty standard stuff. For this I'm using the FB.ui method of the JavaScript SDK.

FB.ui({
    method: 'apprequests',
    title: "Title",
    message: 'Custom Message',
    to: UserIDs
});

Which currently renders this UI dialog. See this image (notice the Preview section with standard invite message):

The invited user then receives the standard message: USER_NAME sent you a APP_NAME request. However, as it is always the case, we want the user to get a custom message in the first notification (At least this is for a charity donation campaign!). I have read through Facebook documentation and I am aware that user-to-user requests in which the recipient has not installed the app supposedly do not display the message parameter. Nonetheless, I know for a fact (because I have received them!) that certain apps are being able to send custom messages to users that have not installed them. For example, this UI request dialog (notice the custom message in the preview area):

I know there are alternate ways to send notifications, e.g. the Notifications API, currently in Beta. But they seem to be subject to the same restriction.

I would really appreciate if someone could help me to figure out how those apps are generating these requests with custom messages.

Sicco
  • 6,167
  • 5
  • 45
  • 61
Jorge Camacho
  • 21
  • 1
  • 3

3 Answers3

1

As detailed in this post http://facebook.stackoverflow.com/questions/6297853/facebook-requests-dialog-not-showing-message-to-recepient you need to use the undocumented new_style_message boolean parameter.

   FB.ui({method:'apprequests',
      title:'Custom window title',
      to: [1,2,3],
      message:'the custom application message',
      new_style_message:true
   }, function (response) {;});

And the correct message will be sent along with your application request.

tmarthal
  • 1,498
  • 19
  • 28
  • Sorry, tmarthal! I had accepted the answer as that parameter effectively appears to be working in the preview window, but the actual apprequest appears with a standard message "SENDER invited you to try". – Jorge Camacho Sep 05 '12 at 21:12
  • At least for users that haven't installed the app. Whereas requests from apps like BranchOut seem to be reaching non-users with new_style_message. – Jorge Camacho Sep 05 '12 at 21:23
  • Doubt its the 'big players'. There seems to be a problem with complex message strings however. Try with a simplified message and see if it works. P.S. It's also going to be the best you can do. :( – tmarthal Sep 10 '12 at 20:04
  • Thanks @tmarthal, actually I just realized that, even among users that have already installed the app, the apprequest reaches them without the message parameter. All that reaches them are "invited you to try", "send you a request" type of messages. Do you have a clue if perhaps it has to do with some global configuration of the app or permissions? – Jorge Camacho Sep 11 '12 at 00:15
  • This is my code: FB.ui({method: 'apprequests', new_style_message: 'true', title: "Invita a tus amigos", message: "mensaje sencillo", to: [UID1, UID2]}, function(response) { if (!response || response.error) { alert('Error occured'); compartirAmigos(); } else { compartirAmigos(); } }); – Jorge Camacho Sep 11 '12 at 00:17
  • Jorge, have you solved the problem? I have the same issue... I used new_style_message and it worked for a while. Now I just get is "send you are request", even if the user installed my app.. – EugeneMi Sep 29 '12 at 19:15
  • I've seen that intermittently; most likely it is something on their end. Who knows. – tmarthal Oct 02 '12 at 05:57
  • Branchout.com figured out how to make it work. I spent a while trying to get it, but couldn't figure it out. Here's what branchout had though in case anyone feels like digging: `frictionless=true&locale=en_US&message=asked to add you as a professional contact. Accept invite ->&new_style_message=true&sdk=joey&title=Add Friends&_fb_noscript=1"` – crunkchitis Oct 05 '12 at 18:28
0

Nonetheless, I know for a fact (because I have received them!) that certain apps are being able to send custom messages to users that have not installed them.

These are most likely “big players”, who have gotten white-listed by Facebook to do so.

CBroe
  • 91,630
  • 14
  • 92
  • 150
  • Wow, thanks CBroe. I hope this is not the case given how difficult it is to get in touch with someone at Facebook in order to enquire about this. Cheers! – Jorge Camacho Sep 07 '12 at 17:23
0

What you are asking has been removed by Facebook a while ago because of all the abuse (spam).

You can still use the message parameter.

Facebook docs:

The message value is displayed in Notifications and can also be viewed on the Apps and Games Dashboard. Invites (requests where the recipient has not installed the app) do not display this value.

So for example:

function sendRequestToRecipients() {
        var user_ids = document.getElementsByName("user_ids")[0].value;
        FB.ui({method: 'apprequests',
          message: 'My Great Request',
          to: user_ids
        }, requestCallback);
      }

More info: https://developers.facebook.com/docs/reference/dialogs/requests/

Baba Yaga
  • 1,819
  • 15
  • 20
  • 2
    Thanks NoScope. As I mentioned in my question, I am very familiar with the documentation regarding invites and the message parameter. The fact is that the undocumented 'new_style_message:true' parameter (mentioned in @tmarthal's answer) seems to work in the preview popup. Moreover, as I also mentioned in my question, I have received in the last few days invites from apps such as BranchOut or Birthday Calendar, which deliver the message parameter even for non-authenticated users. – Jorge Camacho Sep 11 '12 at 15:43