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.