Facebook Invite Friends API
Wall Script
Wall Script
Wednesday, July 04, 2012

Facebook Invite Friends API

Have you noticed the new button "Bring Your Friends" just take a quick look at the page position top right. Actually this is Facebook invite friends API system. For implementing this you have to create a Facebook application to setup your webpage canvas URL, just few lines of code but before that your web page should be SSL (https) enable.

Facebook Invite Friends API

Download Script     Live Demo

Facebook Invite Friends API

Facebook Application
You have to create a Facebook application at developers.facebook.com click here. Here selected text is Facebook app id.
Facebook Invite Friends API
Facebook supports only https canvas URL, my next post I will explain how to configure SSL.

Code
You have to modify appId value.
<script src="http://connect.facebook.net/en_US/all.js"></script>
<script>
FB.init({
appId:'APP_ID',
cookie:true,
status:true,
xfbml:true
});

function FacebookInviteFriends()
{
FB.ui({
method: 'apprequests',
message: 'Your Message diaolog'
});
}
</script>


//HTML Code
<div id="fb-root"></div>
<a href='#' onclick="FacebookInviteFriends();">
Facebook Invite Friends Link
</a>

Facebook invite friends screen.
Facebook Invite Friends API

Code IFrame
The following code is for breaking Iframe, include this code into your webpage.
<script type='text/javascript'>
if (top.location!= self.location)
{
top.location = self.location
}
</script>

The inivite notification appears like this.
Facebook Invite Friends API
web notification

153 comments:

  1. sahi hai bheedooo...;)

    ReplyDelete
  2. Thanks for the script. Worked Perfect.

    ReplyDelete
  3. Thanks for this tutorial I was looking for it.

    ReplyDelete
  4. good article can u please post about the multiselector one ..
    using facebook javascript multi friend selector

    ReplyDelete
  5. Thanks...
    Released this script on time as
    I am currently doing a project which requires this script

    ReplyDelete
  6. it was really very helpfull.

    ReplyDelete
  7. I want to facebook connect.. can you guide me how I can get?? and I have question.. SSL must for facebook connect????

    ReplyDelete
  8. Wow this is what i am expecting...now i can drive more traffic from fb...thanks for your post...

    ReplyDelete
  9. You missed one thing,
    There isn't a "Select All" check-box...

    It would make life easier for a USER if he/she wants to INVITE all their friends...

    Comes in Handy...

    ReplyDelete
  10. Wowww incredible!!! thank for much

    ReplyDelete
  11. Excellent!
    Thanks for share it!

    ReplyDelete
  12. Absolutely Excellent. Thanks for this!

    ReplyDelete
  13. thanks, but how to get the number who accept the invite? and the name list?

    ReplyDelete
  14. thanks its really useful

    ReplyDelete
  15. You are great. Thanks for the article.

    ReplyDelete
  16. Nice tutorial.. How to get the number of persons that the message sent in the return url ?

    ReplyDelete
  17. still a lot is available in facebook sdks

    ReplyDelete
  18. what if I don't want to use javascript side and I prefer to use a server side php script... I mean, from php, launch that dialog request??

    nice article...very helpfull

    ReplyDelete
  19. wow i love that tutorial thanks man

    ReplyDelete
  20. waiting for the ssl configuring

    ReplyDelete
  21. thnx for info. but what are the disadvantages of using facebook api for inviting friends?

    ReplyDelete
  22. Nice one.
    But i don't think people would accept these requests , where farm ville and other shit ville requests make people irritating.

    ReplyDelete
  23. getting error on API_ID of facebook help me

    ReplyDelete
  24. Hello, well i want to thank you so so much for this code. I actually add it on my website and works so fine. i wait for results and let you know soon. Thanks again!

    ReplyDelete
  25. API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: redirect_uri is not owned by the application.

    ReplyDelete
  26. it cannot reditect to any site or any where pls

    ReplyDelete
  27. send invitation to friend then it show in notification and then click on it where to redirect explain this code pls hlp me

    ReplyDelete
  28. Code is very Useful, but can I know the way how to exclude those friends that are already registered on my site

    ReplyDelete
  29. Great website. Lots of helpful information here. I am sending it to some friends and also sharing in delicious. And obviously, thank you in your effort!

    ReplyDelete
  30. Quite helpful blog.
    Those who are facing errors, please make sure that your URL is given properly as App Domains. This will solve errors.

    ReplyDelete
  31. Great post : is this possible to add our fanpage ?

    ReplyDelete
  32. Thanks for your script.very helpfull.

    I had implemented your code,but still mysite is showing inside facebook page.

    how to redirect it?


    Thanks

    ReplyDelete
  33. Please help i got the error
    "An error occurred. Please try later"

    ReplyDelete
  34. Exactly what I am looking for ! Thanks

    ReplyDelete
  35. Very Helpful I like very much

    Thanks

    ReplyDelete
  36. Hi,

    I downloaded source code.I given activated appid,but for me showing following error,
    An error occurred. Please try again later.

    API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: redirect_uri is not owned by the application.

    Please help me...
    Thanks,
    Prasad.

    ReplyDelete
  37. Working on localhost, not on a domain, but within my Facebook app settings I've set a different, existing website. I keep getting this error:

    API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: redirect_uri is not owned by the application.

    In the firebug console I get this:

    Given URL is not allowed by the Application configuration.: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains.

    Does this mean this will not work on localhost?

    ReplyDelete
  38. thanks for this nice tutorial

    ReplyDelete
  39. Awesome, seamlessly integrated into my site :)
    Thank you Srinivas

    ReplyDelete
  40. Thank you so much for this artcile. It helps me alot

    ReplyDelete
  41. How do you get the blue image to appear over the dialog?

    ReplyDelete
  42. API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: redirect_uri is not owned by the application.

    ReplyDelete
  43. Great Tutorial...But it should stay on page after click on submit button or it should display that invitation sent successfully and all, currently inviter window get disappeared when we invite

    ReplyDelete
  44. How do you do it so you dont need a pop up window? Ive noticed sites like quora... when you login, they will show a list of friends to invite right on the page.

    ReplyDelete
  45. Thanks for script...
    I need you help with the Invite Friends API How I can to do to redirect an aplication when a friend accept the application it's lik = http://apps.facebook.com/lae_espana_icte_uq but I want to redirect = fan page application

    ReplyDelete
  46. hi

    that code, work with Page Tab?

    BR

    ReplyDelete
  47. after sending the invitation, the concerned person is not getting any notification on facebook.

    Is there any configuration that needs to be done?

    ReplyDelete
  48. Hi,
    I have fellow this tutorial but none of my selected friends get a notification...
    Does anyone get also this issue ?

    ReplyDelete
  49. good code, very useful... big thanks.

    ReplyDelete
  50. Nice Article. Thanks

    ReplyDelete
  51. nice post.. it hepled me a lot

    ReplyDelete
  52. Hallo 9lessons.greate artikel,ferry nice.

    Can you help me. My qustion is.how to redrirect to another web page after user invite their friends.like a Thanks Page.

    sorry about my english....!.Thnks :)

    ReplyDelete
  53. Hallo 9lessons, actually i am using the same code in grails Application, so fine the pop is coming with my friend list,and when i select one of my friend and click on send button request is send but the notification is not coming in friends wall, i did all configuration very well, so can you just more elaborate how it will work for mine.i am very glade if you give me a response

    ReplyDelete
  54. its very helpfull.. thnx

    ReplyDelete
  55. For those who has not received the notification try to disable sandbox mod for the app. I had the same problem, but after the sandbox mode was disabled the notification appears on friends wall

    ReplyDelete
  56. Facebook is note redirecting to me

    ReplyDelete
  57. Will this trigger a mail to friend's email.

    ReplyDelete
  58. I want to offer scheme as a gift after 100 like as per invited from particular one user reference

    Small base Affiliation System for tracking there inviting user is proceed or not cross 100 like

    Any body have Idea?

    ReplyDelete
  59. When you receive a friend's request, it simply redirects to your website instead of facebook app / canvas page....
    Please specify what trick did you use for that

    ReplyDelete
  60. Very helpful application for me, thank's for sharing

    ReplyDelete
  61. very good tutorial, i enjoy it, bookmarked already !

    ReplyDelete
  62. API Error Code: 191
    API Error Description: The specified URL is not owned by the application
    Error Message: redirect_uri is not owned by the application.


    can u please explain me about this error???

    ReplyDelete
  63. thank you very much ,i tried a lot of way but it works fine thank .

    ReplyDelete
  64. When you receive a friend's request, it simply redirects to your website instead of facebook app / canvas page....
    Please specify what trick did you use for that

    ReplyDelete
  65. hello... Can you say how can I change text 'Preview of request'?

    ReplyDelete
  66. hello everyone i am able to open the request pop up but the invitations are not coming to the accounts

    ReplyDelete
  67. Cannot send notifications to a user who has not installed the app

    ReplyDelete
  68. I am able to send apprequest and these are displaying at apprequest section but there is no notification like in your case.

    ReplyDelete
  69. @Sam have you got how to do what you were asking in above comment.

    ReplyDelete
  70. Using Fb.ui method apprequests for website app is the violation of Facebook policy. It is allowed for games, andriod and IOS app only.
    https://developers.facebook.com/docs/reference/dialogs/requests/

    ReplyDelete
  71. hi. why i do same example but when click notification it not redirect to my homepage

    ReplyDelete
  72. Hi! It seemed to work well until i realized nobody can receive any of those notification? How come? Thanks

    ReplyDelete
  73. very good article, but when u say Code IFrame and say to add these code in iframe, what does it mean? where do i have to put these cose? i need this answer, thank you very much!

    ReplyDelete
  74. i get " Method Not Allowed Error 405 " How can i redirect from canvas to website?

    ReplyDelete
  75. I have received any notification. could you please tell me exact reason behind that?

    ReplyDelete
  76. i have used this code but my friend don't received any notification, what is the problem ? please help me using this

    ReplyDelete
  77. like above users.. my friend does not receive any notification while the demo version works..

    ReplyDelete
  78. I am having the same issue that arouse with "farrukh farid" can you please guide us to solve this out......

    ReplyDelete
  79. very nice.
    Is there any way to get back info of how many or which friends were invited?

    ReplyDelete
  80. Hi i am not using app but using fb sdk for sending request to invite friend but it not shown in notification tab in facebook instead of post is there. so what can i do for notification.

    plz give me reply asap....

    thanks in advance.

    ReplyDelete
  81. Hi!

    I tried to do this procedure, but I not found this option: basic info under the settings option.
    Could you help with more details, please?

    ReplyDelete
  82. Hello

    I have implemented same and its working. Notifications displays on friends page but my problem is when click on notification not redirecting to My URL.

    Please help me on this.

    I have Given Both Canvas URL and everything you have mention but still not redirecting on my URL.

    Thanks in Advance.

    ReplyDelete
  83. when click on notification the requested page not redirected..

    what's the problem behind that?pls help

    ReplyDelete
  84. Please help me.
    Actually when i have send invitation then the receiver not getting any notification.
    What will i do...?

    ReplyDelete
  85. i have created this app and use this same code for my website and it works fine.but the receivers to those who receives notification on thier wall cannot get redirected to my website given as canvas url in app while click on notification.


    what is that problem.any help will be greatly appreciated.

    ReplyDelete
  86. i have send invitation then the receiver not getting any notification.

    ReplyDelete
  87. Hello,
    i have send invitation then the receiver not getting any notification.
    what should i do
    please help

    ReplyDelete
  88. hi notifications not received ,but invite successfull,please help me very urgent

    ReplyDelete
  89. hi notifications not received ,but invite successfull,please help me very urgent

    ReplyDelete
  90. HI
    I am using same code with my api key n all its work but when i send invite to my friends no notification going

    ReplyDelete
  91. Great tutorial, thank you! But like a few others my invites don't reach Facebook. They seem to send but don't. Is there a problem with app approval, or should what you explained just work without any more set up?

    Many Thanks.

    ReplyDelete
  92. Got the invite working but now all i does is invite people to try the app. It didn't do this the first few times, very strange, something in my app set up? Any suggestions welcome, thanks

    ReplyDelete
  93. This works great in woindows but was unable to see the notifications in IOS and android
    Can any one please explain me about this
    thanks in advance

    ReplyDelete
  94. My friend can't get my invitation.

    ReplyDelete
  95. Confirm, it didn't work in fresh api.

    ReplyDelete
  96. Great tutorial...
    i have a question. is there any way to change notification message which is now like 'Sent you request in a (app name)'. i want to add custom message here with a url. is it possible ? if yes then how ? can you please guide ?

    ReplyDelete
  97. those not getting notification simply do
    Go to your app->setting->add platform->App on Facebook. Then fill-up Canvas URL and Secure Canvas URL. And then invite you friends again and enjoy.

    ReplyDelete
  98. I am sending requests, but no notification received at the other end.

    ReplyDelete
  99. For all users facing problem like invitation not received,this script work only if you have created proper "facebook canvas" in facebook app.So if you are using this code to invite to your website,you have to create "facebook canvas" and put https url.Note that in this page(https url) you have to write "javascript url redirection code" which will redirect to your website.

    ReplyDelete
  100. I am getting the error when tried to use the above code
    "Given URL is not allowed by the Application configuration: One or more of the given URLs is not allowed by the App's settings. It must match the Website URL or Canvas URL, or the domain must be a subdomain of one of the App's domains."
    please help me

    ReplyDelete
  101. Hi !
    Is this link goes to your web page or your facebook page ?
    Thanks

    ReplyDelete
  102. Why am i not getting the invite dialog box, if I'm already logged into facebook ?

    It works only if i'm not logged in. anyone else faced this problem ?

    ReplyDelete
  103. I tried this code and it works for me in my older apps. But it is not working on the latest version of app and shows an error like game URL is needed for the app

    ReplyDelete
  104. after disabling sandbox mode i am still not geting notefication

    ReplyDelete
  105. hi... i tried to create fb app and run... im getting "Game Requests are only available to games." error... could u pls let us know how to create app in right way... the screen shots in this tutorial is old way of creating app... could u help us to do it in new way

    ReplyDelete
  106. I have added the "facebook canvas" for app, But no notification in mobile. Please let me know the solutions for this problem.

    Thanks

    ReplyDelete
  107. does this also works with Facebook API 2.5?

    ReplyDelete
  108. My FB app works fine for login, like, share. But still this doesn't work. The fb window appears, you may select your friends and click Done. But the invitations wont go to the friends notifications. Can someone help us?

    ReplyDelete
  109. can we send the custom app request notification to my friends?

    ReplyDelete
  110. can we send the custom notification to my friends

    ReplyDelete
  111. My friends unable to receive notifications.

    ReplyDelete
  112. Invitations wont go to the friends notifications.Please check it..

    ReplyDelete
  113. not work for me, the windown pop up view but only loading

    ReplyDelete
  114. Hey First of all thank you very much for a great tutorial.
    I am using the same code as you mention above, but when i trying to get the friends list it returns me "You app must be game category " like. so Please could you help me out. I don't want to use send-dailog for inviting friends. Is there any other way to render friends for inviting for my website registration.
    Thank you very much.

    ReplyDelete

mailxengine Youtueb channel
Make in India
X