This project is read-only.

Add to Profile BOX

Oct 6, 2008 at 10:51 AM
Hi there,
I have been developing a facebook application for the last weeks using ASP.Net & C++, IFrame
I am stuck now with these issues:
1) How can I allow the user to Add my application to his Profile after he accepted my invitation?
Should I use the following?

string strfbml ="<fb:add-section-button section=\"profile\" />";
fbapplication.Service.Profile.setFbml(fbapplication.UserID, strfbml, "", "");

Is it correct to put this 2 lines in the page_load of the canvas page (in the Default.aspx.cs page)?

2) When I manually add the profile to my wall, my application is empty.
Which page is the wall loading from?
Where can I set this?

Thanks a zillion!!

Buddy



 

Oct 24, 2008 at 10:06 AM

Hi guys,

I have solved my problems and I will like to share this insight so hopefully this can help to reduce your development time for your Facebook application.
1) If you want your application to be able to be added to others' profile BOXES, you should add this line of code to your canvas page so that
when someone installs your application, the profile is activated for this application. 

string strfbml ="<fb:add-section-button section=\"profile\" />";
fbapplication.Service.Profile.setFbml(fbapplication.UserID, strfbml, "", "");


2) Next to add content to you and your friend's profile boxes, you need to add your content using FBML.
Here's a sample code to add a flash to the profile box.

 

fbmlBuilder.Append("<div>");

fbmlBuilder.Append("<fb:name capitalize=\"true\" uid=\"");

fbmlBuilder.Append(fbApplication.Service.UserID);

fbmlBuilder.Append("\" firstnameonly=\"true\" />");

fbmlBuilder.Append("<div>");

fbmlBuilder.Append("<fb:share-button class=\"meta\">");

fbmlBuilder.Append("<meta name=\"medium\" content=\"blog\"/>");

fbmlBuilder.Append("<meta name=\"title\" content=\"Check out Picbox's slideshow\"/>");

fbmlBuilder.Append("<meta name=\"video_type\" content=\"application/x-shockwave-flash\"/>");

fbmlBuilder.Append("<meta name=\"video_height\" content=\"300\"/>");

fbmlBuilder.Append("<meta name=\"video_width\" content=\"300\"/>");

fbmlBuilder.Append("<meta name=\"description\" content=\"My slideshow\"/>");

fbmlBuilder.Append("<link rel=\"image_src\" href=\"http://www.phlook.com/phlpicbox/images/default.gif\"/>");

fbmlBuilder.Append("<link rel=\"video_src\" href=\"http://www.phlook.com/box.swf" + "\"/>");

fbmlBuilder.Append("<link rel=\"target_url\" href=\"http://apps.facebook.com/phlpicbox/slide.aspx" + "\"/>");

fbmlBuilder.Append("</fb:share-button>");

fbmlBuilder.Append("</div>");

fbmlBuilder.Append("<div><fb:swf imgsrc=\"http://www.phlook.com/phlpicbox/images/default.gif\" swfsrc=\"http://www.phlook.com/phlpicbox/box.swf\" width=\"300\" height=\"300\" flashvars=\"id=" + id + "\" waitforclick=\"false\" swfbgcolor=\"000000\" imgstyle=\"border-width:3px; border-color:white;\" /></div>");

fbmlBuilder.Append("<div><a href=\"http://apps.facebook.com/phlpicbox/box.aspx" + ">See All...</a></div>");


3) The current method to post to the WALL / Mini-Feed does not work anymore.

    I have edited the source code in FeedService.cs

    Step 1, you have to register a bundle once and you can use it again & again in your application.
    The method is "feed.registerTemplateBundle".
    Step 2, you have to pass in the variables needed for the template and the template_bundle_id received from Step 1.
    The method is "feed.publishUserAction".

    Here's some sample code:

  1.  

Register Template

string one_line_story_templates = "[\"{*actor*} created a new {*slideshow*}.\"]";

request.Parameters["one_line_story_templates"] = one_line_story_templates;

FacebookResponse response = request.InvokeMethod("feed.registerTemplateBundle");

 

Publish User Action

Dictionary<string, string> template_data = new Dictionary<string, string>();

string sb = “title”;

req.Parameters["template_bundle_id"] = template_bundle_id;

req.Parameters["template_data"] = "{\"slideshow\":\""+ sb+ "\"}";

FacebookResponse res = req.InvokeMethod("feed.publishUserAction");

Hope this is useful for you....

Finally, thank you Nikhil for the source codes!

Buddy
http://www.phlook.com

 

 

 

Nov 16, 2008 at 11:44 AM
Thank you very much buddy81!
I am also trying to create an application in Asp.NET, but I find it quite hard and I have several questions. Perhaps you know the answers:
First, to add the application to the profile, you propose to make a button; but I don't really understand where in the code I have to write this line; and, what is "fbapplication" in your example?
I also wanted to know how to fill, during the facebook registration of the application, the field: "canvas page url", as whatever I can write inside, when I click on the logo of the application I am creating, it is written: "this url doesn't exists". I mean, what is it supposed to do??
Thank you for any answers
Nov 16, 2008 at 11:49 AM
Oh, and do we have in this case to check the "Desktop Application" in that case?
Thank you again :)
Nov 18, 2008 at 6:55 AM
Dear buddy81,
     I don't know how to get the template_bundle_id. Can you provide me some example about the method to post to the WALL / Mini-Feed. Thank you.

    

Nov 19, 2008 at 6:55 AM
Hi wongpv,

To get the template_bundle_id, you can edit the code in the Facebook.Net source code.

string one_line_story_templates = "[\"{*actor*} has a new {*slideshow*}.\"]";

request.Parameters["one_line_story_templates"] = one_line_story_templates;

FacebookResponse response = request.InvokeMethod("feed.registerTemplateBundle");

 

From the response, you will be able to get the template_bundle_id.

Buddy
http://www.phlook.com

Nov 19, 2008 at 7:03 AM
Hi wongpv,

You will get the template_bundle_id from
  response.Result.ToString();

Buddy
http://www.phlook.com
Nov 19, 2008 at 7:13 AM
Hi ilan27,

You can write the code on the default page where the user goes after adding your application.

My fbapplication is a control on the aspx page.

<fb:FacebookApplication ID="fbApplication" EnableExternalBrowsing="true" Mode="IFrame" ApplicationName="buddy" runat="server"></fb:FacebookApplication>

The canvas url
http://apps.facebook.com/phlpicbox/

Don't forget the last "slash".

Buddy
http://www.phlook.com

 

Nov 19, 2008 at 10:17 PM
Thank you buddy81,
Now I  can see my app.
But now, to make it funnier, I would like the users to be able to add it on there profile... I have the button to do that, but when I click on it, I can see the message:
"there is no content to display" or something like that. I tried the tags <fb:narrow> or <fb:wide> but nothing works. I just can't "say" to facebook: here is what I want you to display on the profile.
I visited several links on the web and found nothing.
Thank you for your help!
Nov 24, 2008 at 1:45 AM
Dear buddy81,

       Thank you for your reply. I succeed to register the template bundle but I still cannot see any Wall or mini-feed  that I posted. Can you provide me any example. Thank you.

       The below is the template bundle and post wall or mini-feed coding.
        
Template Bundle 35731338619
Primary One Line Template
{*actor*} created a new {*slideshow*}.


Dictionary<string, string> template_data = new Dictionary<string, string>();

string sb = “title”;

req.Parameters["template_bundle_id"] = template_bundle_id;

req.Parameters["template_data"] = "{\"slideshow\":\""+ sb+ "\"}";

FacebookResponse res = req.InvokeMethod("feed.publishUserAction");

Nov 24, 2008 at 7:44 AM
Hello ilan27,

Try this

System.Text.StringBuilder fbmlBuilder = new System.Text.StringBuilder();

fbmlBuilder.Append("<div>");

fbmlBuilder.Append("<fb:name capitalize=\"true\" uid=\"");

fbmlBuilder.Append(fbApplication.Service.UserID);

fbmlBuilder.Append("\" firstnameonly=\"true\" />");

fbmlBuilder.Append("<div>");

fbmlBuilder.Append("<fb:share-button class=\"meta\">");

fbmlBuilder.Append("<meta name=\"medium\" content=\"blog\"/>");

fbmlBuilder.Append("<meta name=\"title\" content=\"Check out Picbox's slideshow\"/>");

fbmlBuilder.Append("<meta name=\"video_type\" content=\"application/x-shockwave-flash\"/>");

fbmlBuilder.Append("<meta name=\"video_height\" content=\"300\"/>");

fbmlBuilder.Append("<meta name=\"video_width\" content=\"300\"/>");

fbmlBuilder.Append("<meta name=\"description\" content=\"My slideshow\"/>");

fbmlBuilder.Append("<link rel=\"image_src\" href=\"http://www.phlook.com/phlpicbox/images/default.gif\"/>");

fbmlBuilder.Append("<link rel=\"video_src\" href=\"http://www.phlook.com/box.swf" + "\"/>");

fbmlBuilder.Append("<link rel=\"target_url\" href=\"http://apps.facebook.com/phlpicbox/slide.aspx" + "\"/>");

fbmlBuilder.Append("</fb:share-button>");

fbmlBuilder.Append("</div>");

fbmlBuilder.Append("<div><fb:swf imgsrc=\"http://www.phlook.com/phlpicbox/images/default.gif\" swfsrc=\"http://www.phlook.com/phlpicbox/box.swf\" width=\"300\" height=\"300\" flashvars=\"id=" + id + "\" waitforclick=\"false\" swfbgcolor=\"000000\" imgstyle=\"border-width:3px; border-color:white;\" /></div>");

fbmlBuilder.Append("<div><a href=\"http://apps.facebook.com/phlpicbox/box.aspx" + ">See All...</a></div>");

Hope this helps!

Buddy
http://www.phlook.com

Nov 24, 2008 at 8:32 AM
Hi Guys,
I have been trying to get the FBML on my facebook .net application. Can any one suggest me the way I can get it done. I used the code above and could not get any thing on my application. Please suggest. Is there any thing that I am missing out on settings. My application is a IFrame application. I also observed that the div is not rendered when checked in ViewSource. Any suggestions we will greatly appreciated.

Thanks in advance.

Phani...
Nov 26, 2008 at 8:00 AM
Edited Nov 26, 2008 at 9:06 AM
Hi Phani,

What would u like to post? In a box or what?
Can you post your code?

Try my facebook app - http://www.facebook.com/home.php?#/apps/application.php?id=38563222315

Buddy
http://www.phlook.com



Apr 30, 2009 at 3:50 PM
That's hillarious - I got excited thinking that buddy81s app would work and it doesn't. I added it to my profile, moved it to my wall, and got the dreaded "No content to display.This box will not be visible to people who view your profile until this application adds content to it."