I am sending a private message via facebook from my app (website). It is an invitation link to the website - however, it gives the following error:
The website encountered an error while retrieving https://www.facebook.com/dialog/send. It may be down for maintenance or configured incorrectly.
Here are some suggestions:
Reload this webpage later.
HTTP Error 500 (Internal Server Error): An unexpected condition
The link invitation link being sent is something like
http://myapp.com/invitation - doesnt work
http://myapp.com - works!
How can I make it work with something after a forward slash?
The actual code:
:javascript
$(function(){
$('li.friend:not(.invited) label').live('click', function() {
FB.init({appId: #{Rails.application.config.fb_app_id}, xfbml: true, cookie: true})
FB.ui({
method: 'send',
display: 'popup',
name: 'New Invitation',
link: 'http://myapp.com/invitation/',
to: this.parentNode.getAttribute("data-id"),
frictionlessRequests:true,
show_error: 'true'
})
$(this).parent().addClass("invited")
$(this).siblings().prop("checked", true)
})
});
You have 'frictionlessRequests' and 'method: send' there; those aren't compatible options. The frictionlessRequests: true, should be in your FB.init() call and affects how the Requests dialog works when pre-filling recipients, what you have there is a mix of parameters from different dialogs
A sample send dialog call is:
FB.ui({
method: 'send',
name: 'People Argue Just to Win',
link: 'http://www.nytimes.com/2011/06/15/arts/people-argue-just-to-win-scholars-assert.html',
});
and a sample apprequests dialog:
FB.ui({
method: 'apprequests',
message: 'Come use this app with me.'
});
}
Also (as you discovered) the link needs to resolve correctly a return a 200 response; if it redirects immediately it won't work correctly
Related
I can initiate dialog to send a link to Facebook Messenger. Everything goes fine and recepient gets the message with URL. However, when a message is added in Facebook's UI, only that message is received and URL NOT.
Message field causes link to be ignored in received message
Desktop
I have tried both methods according to
https://developers.facebook.com/docs/sharing/reference/send-dialog/
URL
https://www.facebook.com/dialog/send?display=page&link=https://developers.facebook.com/docs/sharing/reference/send-dialog&redirect_uri=https://www.facebook.com&app_id=<APP_ID>
SDK
window.fbAsyncInit = function () {
FB.init({
appId: '<APP_ID>',
autoLogAppEvents: true,
xfbml: true,
version: 'v11.0',
});
};
FB.ui({
method: 'send',
link: 'https://developers.facebook.com/docs/sharing/reference/send-dialog/',
});
I have tried different SDK versions and different APP IDs.
Mobile
Curriosly so, my setup for mobile works fine, link is received with or without a message.
fb-messenger://share?=<APP_ID>&link=<MY_LINK>
I am really confused as there does not seem much to configure... Thanks in advance for any leads on this.
It has been acknowledged as a bug by Facebook already in May https://developers.facebook.com/support/bugs/201777038410094/
Again reported in July
https://developers.facebook.com/support/bugs/2934678630125393/?join_id=f3c21b71e26d8c
I am trying to send a facebook private message via facebook send dialog in my facebook app, i have a problem while setting the custom image each time user clicks on it, i am sending the parameters as
send msg
and on the function side,
FB.init({
appId: '<?=$this->facebook->getAppID()?>',
xfbml: true,
cookie: true
});
function send_message(user_id, image_name) {
FB.ui({
to: user_id,
method: 'send',
name: 'The Image',
description: 'Description here',
link: 'https://www.something.com/',
picture: '<?=baseurl()?>imagepath/'+image_name
});
}
It works fine without picture parameter, but all the time it uses default image that facebook automatically pick from my link.
please your kind help will greatly be appreciated!
Using HTTPS protocol in picture link (if you do so), you might cause your problems. Take a look at Images not working in FB.ui
I'm trying to do a basic facebook wall post with an embedded flash object based on the following documentation:
https://developers.facebook.com/docs/reference/dialogs/feed/
I'd like to do this using just a direct URL, like (note parameters get encoded):
https://www.facebook.com/dialog/feed?
app_id=SOME_APP_ID&
link=http://www.myregisteredfbdomain.com/someurl&
picture=http://www.myregisteredfbdomain.com/cfg/media/imagelink.png&
name=Flash%20Test&
caption=Just%20a%20test&
description=A%20Description&
redirect_uri=http://www.myregisteredfbdomain.com/someurl&
source=http://www.myregisteredfbdomain.com/facebook/aflashfile.swf
Although I've also tried it using javascript, with the same result:
<script>
FB.init({appId: SOME_APP_ID, status: true, cookie: true});
function postToFeed() {
var obj = {
method: 'feed',
redirect_uri: 'http://www.myregisteredfbdomain.com/someurl',
link: 'http://www.myregisteredfbdomain.com/someurl',
picture: 'http://www.myregisteredfbdomain.com/cfg/media/imagelink.png',
name: 'Flash Test',
description: 'A Description',
source: 'http://www.myregisteredfbdomain.com/facebook/aflashfile.swf'
};
function callback(response) {
document.getElementById('msg').innerHTML = "Post ID: " + response['post_id'];
}
FB.ui(obj, callback);
}
</script>
When I do the post under my development fb account, the post shows up fine, and I can click on the icon which displays the flash correctly.
However when I post under my own personal fb account, the post shows with the image only, but no flash activation when I click it - it just goes to the link/redirect link I defined.
Can anyone give me any pointers as to why this might be the case?
Found out why - It's because I'm accessing the post to my personal account through a https connection, which doesn't show the flash - it's linked via a http connection.
I am trying to build application request on my website using request dialog box.
When i send app request to friends, notification appears for a moment & goes away. Also it is not showing any new notifications either in "App & games" and "notifications" pages.
Here Sample Code :-
FB.init({
appId : '127617823933232',
status : true,
cookie : true,
oauth: true,
});
function sendRequestToRecipients() {
var user_ids = document.getElementsByName("user_ids")[0].value;
FB.ui({method: 'apprequests',
message: 'EventSeekr Join Request',
to: user_ids,
}, requestCallback);
}
function sendRequestViaMultiFriendSelector() {
FB.ui({method: 'apprequests',
message: 'EventSeekr Join Requestt'
}, requestCallback);
}
I answered a similar question based on some issues I was having with my app, see if it helps:
From my experience and from reading the Facebook Developer Guide, it seems like it's mandatory for you to have a Canvas defined for your Facebook app so the requests render as Notifications.
I am trying to solve a problem where these notifications show fine in the Facebook website but not on the Facebook Android client's notification popup.
The initialization code:
FB.init({
appId: '123456789012345',
channelUrl: 'http://localhost/Some/Url/FacebookChannel',
status: true,
cookie: true,
oauth: true,
xfbml: true
});
The following code is called with an onclick:
FB.ui({
method: 'feed',
name: settings.facebookShareName,
link: settings.facebookLinkUrl,
caption: settings.facebookShareCaption,
description: settings.facebookShareDescription,
message: message,
display: 'popup'
});
This code works fine in FF and Chrome, and mostly works in IE8. The popup is shown and the user can post to their wall, but after submitting, the window doesn't close. It turns white with no further interaction, but must manually be closed by the user.
Why doesn't the window auto-close in IE, and/or are there any workarounds to force the popup to close?
Edit:
This issue may be related to this outstanding bug.
I have the same problem and have never been able to get a response from Facebook for the callback function. I don't see anything in console.log or any alerts I insert in the function.
My solution was to put a URL in FB.ui's redirect_uri that goes to an HTML page with self.close (or window.close). The FB.ui popup redirects there after the user's input and immediately closes. Remember to change your FB app's Site URL setting so it matches the domain the file resides on.
Here's my code, tied to my form's submit action. The function(response) callback is still there but not used. If anyone sees a syntax error please comment on it.
FB.ui ({
method: 'feed',
name: '',
link: '',
picture: '',
caption: '',
description: '',
actions: {name:'',link:''},
redirect_uri: 'http://.../self.close.html'
},
function(response) {
console.log(response);
if (response && response.post_id) {
alert('yes');
self.close();
} else {
alert('else yes');
}
});
The line of code in self.close.html:
<script type="text/javascript">self.close();</script>
A bit old thread, but this might help someone...
The popup will self close if you neglect to put in the "redirect_uri" parameter. (plus, the response callback will now work too)
add return false; to your method call.
onsubmit="someMethod(); return false;"
Not an easy one... but it could work:
First, to force closing the dialog you must pay attention to the response:
See the entire documentation and example here: https://developers.facebook.com/docs/reference/javascript/FB.ui/
Once you have the response you should close the dialog:
See: http://facebook.stackoverflow.com/questions/4646441/how-to-close-a-facebook-sdk-dialog-opened-with-fb-ui
Hope that helps! :)
The pop up will close if you do not give the redirect_uri as mentioned above - as well as if you do not give display (that is, do not give display: 'popup' or display: 'iframe').
Make sure 'http://localhost/Some/Url/FacebookChannel' hosted in the same domain with your app callback url.