How to send Facebook apprequests/notifications with custom message parameter?

Jorge Camacho picture Jorge Camacho · Sep 5, 2012 · Viewed 7.3k times · Source

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.

Answer

tmarthal picture tmarthal · Sep 5, 2012

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.