Hi so I am making a Facebook app which uses the send dialog. I was wondering why it doesn't work when I put 'https://apps.facebook.com/APP_NAME/' as my link parameter. I want the link in the send message to be a link to my app but on the send dialog is appears as apps.facebook.com. Is there anyway to do this?
Edit: Yes sorry here is the code:
<script>
FB.init({appId: 'App_ID', xfbml: true, cookie: true});
function sendMessage(){
// assume we are already logged in
var token = FB.getAuthResponse().accessToken;
FB.ui({
method: 'send',
name: 'Test',
link: 'https://www.apps.facebook.com/APP_NAME',
description: 'This is a test',
picture: '',
display: 'iframe',
access_token: token
});
}
</script>
If you dont want the apps.facebook.com domain showing up in the caption for the post, you ca theren create a new page in your site. Set all the og meta tags to what you want to show up in the feed. The only other content in the page should just be a javascript redirect to your you canvas app. This way when FB scrapes your site, they get all the necessary data and when a user clicks on the link, the js redirects them to your app.
Also, there is not a "www" in the url for app canvas pages.
Related
In my website I want to integrate the "Invite your friends to like this Page" similar to the Facebook Fan Page(Any), where people can search a friend and send an invite to like a page, after receiving and clicked that notification the user will be redirected to the Facebook Fan Page.
This what I do, by adding an App and Creating a Facebook Canvas in the Developer Tools and with this piece of code in my website:
window.fbAsyncInit = function() {
FB.init({
appId : '577325869064730',
cookie : true,
xfbml : true,
version : 'v2.2'
});
};
function sendInvite() {
FB.ui(
{
method: 'apprequests',
message: "I am inviting you to like my page"
},
function(response) {
console.log(response);
}
);
}
It seems do the work, but the problem is it is not really the one I'm expecting because, It's not redirecting to the my Facebook Fan Page and the Facebook canvas URL only allowed a secure URL ("https") and doesn't allow the URL Facebook.
Is there a workaround for the redirection of the URL, rather than redirect to the declared URL in the Facebook canvas it should be pointed to my Facebook Fan Page. And the result should be the FULL Page of the Facebook Fan Page not in the Canvas.
Can this be done?
apprequests are for inviting friends to a game app on Facebook Canvas, not for inviting them to a Page (APP requests, hence the name). It will always redirect to the Canvas Page.
Better use the Send Dialog or Share Dialog. Of course you donĀ“t need https for those.
So far I was able to find a way to redirect it on the Facebook Fan Page, I just don't know if this is the correct solution:
In the website header, the one I declared in the Facebook Canvas URL:
I inserted this code:
<script type='text/javascript'>
top.location = "www.facebook.com/fanpage"
</script>
It is now redirecting to the Facebook Fan Page.
so I implemented Facebook send dialog in my Facebook app, but the problem is that it always displays server name and some random thumbnail. I put everything as it shown in Facebook documentation but nothing works.
This is my code:
FB.ui({
method: 'send',
name: 'myName',
picture: 'image/path',
link: 'https://apps.facebook.com/APP_ID/',
});
You should read https://developers.facebook.com/docs/sharing/reference/send-dialog according to that page the parameters you can pass in are: app_id, redirect_uri, display, to, link. Neither name or picture are listed.
I have an invite dialog on my page:
<a href="#" onclick="sendRequestToManyRecipients(); return false;" >xx</a>
<script language="javascript" type="text/javascript">
FB.init({appId : 'myappid', status : true, cookie : true, oauth: true});
function sendRequestToManyRecipients() {
FB.ui({ method: 'apprequests', message: 'xxx'},requestCallback);
}
function requestCallback(response) {
// Handle callback here
}
</script>
When the invited user clicks the invite, he gets linked to the app, but I want the user to get redirected to a page like http://www.facebook.com/pages/xxx/xxx?sk=app_xxxx.
How can I do that?
That's not possible without some custom coding - the requests interface exists to drive traffic to apps on facebook, not to page tabs, there's no way to have Facebook send users to a tab when they accept the request.
You could just implement something on your canvas landing page that redirects users back to a page tab based on the information in the request as a workaround.
previous version of the apprequest which is request-form this was possible: How can I include a link in a FB app request?
However current version of apprequest : facebook guys lets only redirect to your app: https://apps.facebook.com/yourapp
#Vihay comments helps this custom workaround to redirect to page.
Hoping next version apprequests, facebook enables redirect to links within the fb app.
Agree with previous answers. Facebook will redirect to your app, which is just a Facebook wrapper around a page you can provide. That page can then use a client-side redirect to whatever page you'd like (like what Klout does).
FB.init({
appId:'Application ID', cookie:true,
status:true, xfbml:true
});
FB.ui({ method: 'apprequests', message: 'Here is a new Requests dialog...'});
How to redirect the user to my external website rather than the Canvas Page inside facebook?
There are a couple posts about this online that suggest making a dummy canvas page that sets
window.location.top = 'yoursiteurl'
... but this does not seem satisfactory to me. Facebook docs are wildly unclear about whether external website ("Facebook Connect") devs are encouraged to use requests.
I have a web-site, where I have facebook comments social plugin on each page and I have facebook page, where I publish items as "shared links" from my site via RSS (through dlvt.it). Links to items are the same.
Now comments are diferent in two places (on facebook page and on web-site)
The question is how can I make that comments on facebook page items appears also on my web-site's comment form ?
Regards,
Anton.
You need to create a Facebook application. Once you have created this, you'll get your app_id. In your website, you can then add:
xmlns="http://www.facebook.com/2008/fbml"> to your HTML tag, and then add in the body tag:
<script src="http://connect.facebook.net/en_US/all.js#appId=YOURAPPID&xfbml=1"></script>
<script type="text/javascript">
FB.init({
appId: 'YOUR APP ID',
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true // parse XFBML
});
</script>
This will allow you to access Facebook plugins from your website. So, for comments you can use:
<fb:comments href="Your Page" num_posts="10"></fb:comments>