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

3

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.

Gyronny answered 5/9, 2012 at 17:32 Comment(1)
any luck with this? I'm running into the same issue...Schapira
E
1

As detailed in this post http://facebook.https://mcmap.net/q/738581/-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.

Exclusive answered 5/9, 2012 at 17:43 Comment(8)
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".Gyronny
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.Gyronny
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. :(Exclusive
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?Gyronny
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(); } });Gyronny
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..Smectic
I've seen that intermittently; most likely it is something on their end. Who knows.Exclusive
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"Coffey
D
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.

Drouin answered 6/9, 2012 at 16:11 Comment(1)
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!Gyronny
S
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/

Screw answered 11/9, 2012 at 8:12 Comment(1)
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.Gyronny

© 2022 - 2024 — McMap. All rights reserved.