I am using facebook new requests 2.0 for sending apprequests via application. Now I have a custom message which is shown in the preview while sending the invitations, however, on the recipient side the message is not shown and a standard message is displayed. Please see the below code that I am using for this purpose.
<script type="text/javascript" src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
$(document).ready(function()
{
FB.init(
{
appId: '<?php echo $this->fbappid; ?>',
status: true,
cookie: true,
oauth: true,
frictionlessRequests: true
});
function sendRequestViaMultiFriendSelector()
{
FB.getLoginStatus(function(response)
{
if (response.status === 'connected')
{
var uid = response.authResponse.userID;
var accessToken = response.authResponse.accessToken;
FB.ui(
{
method: 'apprequests',
message: 'My Custom Message',
filters: ['all'],
data: '<?php echo $this->application . 'buddies/gifts/' . $this->gift_id ; ?>',
title: 'Send Gifts',
display: 'iframe'
},
function(response)
{
//console.log(response);
if (response && response.to)
{
var idds = response.to.join(',');
$('input[name=ids]').val(idds);
$('#invite').submit();
return false;
} else {
$('#invite_fail').submit();
return false;
}
});
$(document).oneTime(500,'check', function()
{
$(".FB_UI_Dialog").css('width','550px');
});
$(".FB_UI_Dialog").css('width','550px');
}
else if (response.status === 'not_authorized')
{
$('#login_fail').submit();
}
else
{
$('#login_fail').submit();
}
});
}
sendRequestViaMultiFriendSelector();
});
</script>
<?php endif; ?>
I need to display that custom message otherwise there are huge chances that the users will ignore it and will consider it as spam.
Actually historically apps used to have control over the message and too many evil apps took way too much advantage of them. Facebook then re-engineered apps to give them less control over the content and how they are sent for very good reasons. This is the new Requests 2.0 variety. Right now, the only custom message you can provide to a recipient is on your auth dialog or in your app screens when the user is not an app user.