FBService.SendRequest not sending invitation

Aug 21, 2007 at 10:16 PM

Uri img = new Uri("http://profile.ak.facebook.com/profile6/949/30/t5342065378584.jpg");

string url = this._fbService.SendRequest("<fb:req-choice url=\"http://apps.facebook.com/urapp/default.aspx\" label=\"Add Application\" ></fb:req-choice>", "56371043", "request", _img, true);


I logged in as user with the userid - 56371043 and I do not see any new request. Can someoneplease let me know if I'mdoing any mimstake in the above code?

thanks
Sara

Aug 23, 2007 at 12:22 AM
anyone done this SendRequest successfully?

still didnt get it to work

thanks
sara
Coordinator
Sep 12, 2007 at 4:51 AM
If this is still an issue, please post an issue. I plan to spend time the next couple nights working through the current issue list. and trying to get version 1.3 ready.
Sep 27, 2007 at 9:58 PM
I still cannot get SendRequest to send out the request.

FBService.SendRequest("<fb:req-choice url=\"http://apps.facebook.com/example/confirm.php\" label=\"Confirm\"></fb:req-choice>",FBService.UserId.ToString(), "event",_img,true);
Sep 27, 2007 at 10:20 PM
after looking at the website maybe they don't use this function anymore...
from
http://developers.facebook.com/news.php?blog=1&story=29

Requests
We will be deprecating the notifications.sendRequest API method. In its place, we will provide a standard invitation tool that allows users to select which friends they would like to send a request to. We are working hard on multiple versions of this tool to fit into different contexts. The tool will not have a "select all" button, but we hope it enables us to increase the maximum number of requests that can be sent out by a user. The standardized UI will hopefully make it easier for users to understand exactly what they are doing, and will save you the trouble of building it yourself.
Oct 18, 2007 at 6:52 PM
Edited Oct 18, 2007 at 6:57 PM
Yes, notifications.sendRequest API has been removed.

Using a page that inherits CanvasFBMLBasePage you can insert the following FBML on a page (this cannot be inside <form></form> tags)

<fb:requestform action='default.aspx' method='POST' invite='true' type='My Application Name' Content="This application does something to your friends. Join me in the Application! <fb:reqchoice url='http://www.facebook.com/add.php?apikey=MYAPIKEY' label='Check out the Application!' />"><fb:multifriendselector showborder='false' actiontext='Invite your friends to the Application.' rows='3' max='20' /></fb:requestform>
Oct 19, 2007 at 2:18 AM
Edited Oct 19, 2007 at 2:24 AM
If your application runs in IFrame mode by default a new change went in on Wednesday night where you can force a page to run in either iFrame or FBML mode. Simply add ?fb_force_mode=fbml ?fb_force_mode=iframe to the querystring of the page when loading it.

e.g. http://apps.facebook.com/moodstones/?fb_force_mode=fbml (you should get an FBML error message as that page of mine runs as an iframe but you get the idea)

This means you can have some pages FBML and some Iframe in your application (remember to set the correct CanvasBasePage in your code behind ;))...
Oct 19, 2007 at 2:50 PM
FWIW, dashes need to go into into the fbml tags.

So, it should be "<fb:request-form ..." and "<fb:multi-friend-selector ..." and "</fb:request-form>"

They may have been stripped out of the original post, but I figured I would mention it.

John


bflood wrote:
Yes, notifications.sendRequest API has been removed.

Using a page that inherits CanvasFBMLBasePage you can insert the following FBML on a page (this cannot be inside <form></form> tags)

<fb:requestform action='default.aspx' method='POST' invite='true' type='My Application Name' Content="This application does something to your friends. Join me in the Application! <fb:reqchoice url='http://www.facebook.com/add.php?apikey=MYAPIKEY' label='Check out the Application!' />"><fb:multifriendselector showborder='false' actiontext='Invite your friends to the Application.' rows='3' max='20' /></fb:requestform>

Developer
Oct 19, 2007 at 7:49 PM
I made a fix for this in the toolkit a few days ago and checked it into source control, so if you get the latest build from there you can use the new SendRequest method in FacebookService.
Oct 26, 2007 at 4:20 PM
I'm running into some of the same problems reported by others in this forum. I'm currently using the 1.2 libraries. I want to create an invite page for my app. I have an ASPX page with the following source:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addfriends.aspx.cs" Inherits="addfriends" %>
<form id="form1" runat="server">
<div>

<fb:request-form
action="default.aspx"
method="POST"
invite="true"
type="My App"
content="Get started with My App <?php echo htmlentities("<fb:req-choice url=\"apps.facebook.com/myapp\" label=\"Add My App!\" />"); ?>">

<fb:multi-friend-selector
showborder="false"
rows="5"
max="20"
actiontext="Invite your friends to use My App.">
</fb:request-form>

</div>
</form>

The result in IE6 is that I get some garbage characters at the top of the screen and a search box that doesn't do anything. In Firefox, I see the correct-looking Add Friends display but there are still garbage characters up top, there's an error message at the bottom ("Attribute names can only contain alphanumeric characters, underscores, and hyphens"), and nothing actually works - that is, clicking on send invites doesn't do anything.

Any thoughts? Is this fixed in the 1.3 library? If so, what is the ETA for that library?

Thanks!
Will
Developer
Oct 26, 2007 at 5:15 PM
I think the problem is that you're trying to use PHP in your content attribute. When they suggest using PHP's htmlentities in the docs, they mean that you should use it if you're using PHP as your backend. Since you're using ASP.NET instead, you'll want to somehow use System.Web.HttpUtility.UrlEncode() to properly encode the text you're passing into your content attribute.
Oct 26, 2007 at 6:05 PM
Ha! Good point. However, I've been poking around at this for the last 45 minutes still and I can't get anything to work. Here is the code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addfriends.aspx.cs" Inherits="addfriends" %>
<form id="form1" runat="server">
<div>

<fb:request-form
method="POST"
invite="true"
type="MyApp"
content="Get started with MyApp! (i left out the fb:req for now b/c I couldn't get it to process correctly)"
>

<fb:multi-friend-selector
showborder="false"
rows="5"
max="20"
actiontext="Invite your friends to use MyApp.">
</fb:request-form>

</div>
</form>

The garbage characters at the top of the screen are gone, but I'm running into the same basic problem. In IE6, I only see a search box. In Firefox, I see the whole form, and I can select users, but hitting the 'Invite' and 'Send' buttons has no effect. Has anyone gotten this to work? Can you post some code? I'm really just trying to do the most basic invite page I can do, and I can't figure out what is going wrong here.

Thanks!
Will
Developer
Oct 26, 2007 at 7:47 PM
Have you tried setting an "action" attribute on your fb:request-form tag? I think that might be necessary, so that Facebook will forward you to the correct page once you've clicked Send/Invite/whatever. Also, even if pressing the buttons doesn't seem to do anything, do the users still receive invitations/requests? It may be that there is no new page loading, but the stuff still gets sent behind the scenes.
Oct 26, 2007 at 8:14 PM
Yeah - I tried that to no avail. I'm pretty sure a dialog is supposed to pop up when 'send invites' is pushed (and no, no invites are sent). For example,

http://apps.facebook.com/tripadvisortravelmap/?a=INVITEFRIENDS&fbsrc=dashInvFs
http://apps.facebook.com/pandora/invite

both do the same thing - they pop up that dialog. Has anyone actually gotten this code to work in this manner using the Facebook Developer Toolkit? If so, a code sample would be much appreciated!

Thanks,
Will
Oct 26, 2007 at 11:44 PM
your <fb:request-form control must not be between <form></form> tags and it should work.


weisner wrote:
Ha! Good point. However, I've been poking around at this for the last 45 minutes still and I can't get anything to work. Here is the code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addfriends.aspx.cs" Inherits="addfriends" %>
<form id="form1" runat="server">
<div>

<fb:request-form
method="POST"
invite="true"
type="MyApp"
content="Get started with MyApp! (i left out the fb:req for now b/c I couldn't get it to process correctly)"
>

<fb:multi-friend-selector
showborder="false"
rows="5"
max="20"
actiontext="Invite your friends to use MyApp.">
</fb:request-form>

</div>
</form>

The garbage characters at the top of the screen are gone, but I'm running into the same basic problem. In IE6, I only see a search box. In Firefox, I see the whole form, and I can select users, but hitting the 'Invite' and 'Send' buttons has no effect. Has anyone gotten this to work? Can you post some code? I'm really just trying to do the most basic invite page I can do, and I can't figure out what is going wrong here.

Thanks!
Will

Oct 31, 2007 at 5:02 AM
Thank you!

Moving it out of the FORM made things work a whole lot better. I am 90% of the way there. I'm still running into small problem surrounding correctly encoding the Fb:req-choice tag. However, I'm going to play around with that a little bit in the next few days and I think I'll get it working.

If anyone has any sample working code for that, please post it and save me some time!
Nov 8, 2007 at 10:02 PM
BTW - I have this working like a charm now. I was trying to dynamically generate the URL code that is part of the content value, but I couldn't get it to work because, as you can see, this source code is mainly operating outside of the ASPX form so code isn't executed. However, because the URL is static I simply ran this code:

string encoded = System.Web.HttpUtility.HtmlEncode(TextBox1.Text);

where the textbox value equalled: <fb:req-choice url="http://apps.facebook.com/runwaytracker/play.aspx" label="Confirm" />

And then I paste the result directly into the ASPX source, as shown below. I have tested this out and it works - successful send and success accept. You'll need to replace "default.aspx" with a real page in your app and myapp with your app name, of course.

Here is the source of the ASPX page:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addfriends.aspx.cs" Inherits="addfriends" %>
<form id="form1" runat="server">
<div>
</div>
</form>
<fb:request-form
method="POST"
action="default.aspx"
invite="true"
type="My App"
content="Get started with My App! <fb:req-choice url="http://apps.facebook.com/myapp/default.aspx" label="Confirm" />"
>
<fb:multi-friend-selector
showborder="false"
rows="5"
max="20"
actiontext="Invite your friends to use My App.">
</fb:request-form>
Nov 8, 2007 at 10:11 PM
WHOOPS - sorry that is not correct. This forum software processed my HTMLEncoded string. Let me try that again:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="addfriends.aspx.cs" Inherits="addfriends" %>
<form id="form1" runat="server">
<div>
</div>
</form>
<fb:request-form
method="POST"
action="default.aspx"
invite="true"
type="My App"
content="Get started with MyApp! &lt;fb:req-choice url=&quot;http://apps.facebook.com/myapp/default.aspx&quot; label=&quot;Confirm&quot; /&gt;"
>
<fb:multi-friend-selector
showborder="false"
rows="5"
max="20"
actiontext="Invite your friends to use MyApp.">
</fb:request-form>
Nov 8, 2007 at 10:12 PM
Yes - that's it. Good luck with that!
Nov 20, 2007 at 5:04 AM
hey all,

i have iframe application and trying to send invite.
i try lots of diff thing, but counldn't get to work.
i would really appreciate if someone can please post front and backend code.

Thanks,
apsa