<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Thought Labs Blog &#187; Bebo</title>
	<atom:link href="http://www.thoughtlabs.com/category/bebo/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thoughtlabs.com</link>
	<description>A blog about Social Media by John Maver and Cappy Popp</description>
	<lastBuildDate>Sat, 04 Feb 2012 17:50:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Cappy Popp&#8217;s Slides from GSP East: &#8216;Migrating from Facebook to Bebo&#8217;</title>
		<link>http://www.thoughtlabs.com/2008/06/09/cappy-popps-slides-from-gsp-east-migrating-from-facebook-to-bebo/</link>
		<comments>http://www.thoughtlabs.com/2008/06/09/cappy-popps-slides-from-gsp-east-migrating-from-facebook-to-bebo/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 20:28:42 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Strategy]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=64</guid>
		<description><![CDATA[Here are my slides from my presentation this morning at GSP East. Please let me know if you have any questions. You can also get them on slideshare here.]]></description>
			<content:encoded><![CDATA[<p></p><p><a href="http://www.thoughtlabs.com/blogs/wp-content/uploads/2008/06/migrating-from-facebook-to-bebo.ppt">Here are my slides from my presentation this morning at GSP East</a>. Please let me know if you have any questions.</p>
<p>You can also get them on <a href="http://www.slideshare.net/hiscapness/migrating-from-facebook-to-bebo/" target="_blank">slideshare here</a>.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=64&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/06/09/cappy-popps-slides-from-gsp-east-migrating-from-facebook-to-bebo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>John Maver&#8217;s slides from GSP East &#8211; Introduction to Bebo Development Workshop</title>
		<link>http://www.thoughtlabs.com/2008/06/09/slides-from-gsp-east-introduction-to-bebo-development/</link>
		<comments>http://www.thoughtlabs.com/2008/06/09/slides-from-gsp-east-introduction-to-bebo-development/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 17:48:52 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=62</guid>
		<description><![CDATA[Here is my slide deck from GSP East workshop on creating a Bebo Application. Link to Slideshare.com. The notes for each slide contain additional information useful in building your first application. Post any questions below or on the Bebo Forums.]]></description>
			<content:encoded><![CDATA[<p></p><p>Here is my slide deck from GSP East workshop on creating a Bebo Application.<br />
<a href='http://www.slideshare.net/jmaver/intro-to-bebo-applications/'>Link to Slideshare.com</a>. The notes for each slide contain additional information useful in building your first application.<br />
Post any questions below or on the Bebo Forums.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=62&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/06/09/slides-from-gsp-east-introduction-to-bebo-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>John Maver and Cappy Popp presenting at GSP East</title>
		<link>http://www.thoughtlabs.com/2008/06/08/john-maver-and-cappy-popp-presenting-at-gsp-east/</link>
		<comments>http://www.thoughtlabs.com/2008/06/08/john-maver-and-cappy-popp-presenting-at-gsp-east/#comments</comments>
		<pubDate>Sun, 08 Jun 2008 22:42:35 +0000</pubDate>
		<dc:creator>Thought Labs</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=61</guid>
		<description><![CDATA[John Maver and Cappy Popp will be presenting at the GSP East Intro To Facebook and Bebo Applications workshop at 9:00 on Monday, June 9th in Washington, DC. Stop by and say hi, if you are there. http://en.oreilly.com/gspeast2008/public/schedule/detail/3272]]></description>
			<content:encoded><![CDATA[<p></p><p>John Maver and Cappy Popp will be presenting at the GSP East <strong>Intro To Facebook and Bebo Applications</strong> workshop at 9:00 on Monday, June 9th in Washington, DC.  Stop by and say hi, if you are there.</p>
<p><a href="GSP East Workshop">http://en.oreilly.com/gspeast2008/public/schedule/detail/3272</a></p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=61&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/06/08/john-maver-and-cappy-popp-presenting-at-gsp-east/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to create a Bebo application using PHP 5</title>
		<link>http://www.thoughtlabs.com/2008/05/08/how-to-create-a-bebo-application-using-php-5/</link>
		<comments>http://www.thoughtlabs.com/2008/05/08/how-to-create-a-bebo-application-using-php-5/#comments</comments>
		<pubDate>Fri, 09 May 2008 02:49:11 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=43</guid>
		<description><![CDATA[A tutorial in how to build a Bebo Application using PHP. Shows how to build a canvas page, profile box, generate news stories, and allow invites.]]></description>
			<content:encoded><![CDATA[<p></p><h2>Introduction</h2>
<p>I have been answering a lot of email requests for how to get started with a Bebo application. Since applications can be written in any language that supports interaction with the Bebo REST API, developers have a lot of choices in how they build their application. The focus of this article will be on the "officially supported language" - PHP. I saw officially supported, because the Bebo Platform Team has released a simple PHP wrapper that makes using the REST API very simple, and they update this from time to time.</p>
<p>Before creating an application, you need to understand the parts of an application and how they interact with Bebo. I will go over each part below, and then show an example of a very simple application that uses each part.</p>
<h2>The parts of a Bebo Application</h2>
<p><strong>The Bebo URL</strong> - this is the URL that users go to on Bebo. It is in the format "<strong><em>http://apps.bebo.com/yourapp/</em></strong>"</p>
<p><strong>The Callback URL </strong>- this is the URL on your server that Bebo redirects to. It is where the actual application lives.</p>
<p><strong>The Canvas Page</strong> - this is the main page of a Bebo application. It takes up the entire web page, except for the Bebo top header and footer. User's going to your canvas page are using your server directly via the callback URL. Canvas pages can either be written in SNML, a markup language that is standardized across Facebook and Bebo and is fast to load, or in an iFrame. Javascript is only allowed in iFrame based applications, but they cannot use SNML.</p>
<p><strong>The Profile Box</strong> - each application can create a presence on the installing user's Profile page. This contents of this box are set by the application, but when the user is seeing this Profile box, it is running a cached version on Bebo's servers. The user can click links or interact with Flash to go to the canvas page or call back to your server using simple AJAX. Since browsing other people's Profiles is one of the main activities on Bebo, creating a compelling Profile Box is a very important part of helping your application to spread.</p>
<p><strong>Invitations</strong> - each application can provide a way for users to recommend it to their friends. Bebo provides a common dialog for selecting friends, and limits the total number of invitations that can be send per person per day. You can control some of the text that the inviter sees when selecting their friends, and some of the text in the actual invitation. Your application must give the user a reason to want to send an invitation, either by being innately good, or by some type of reward system for invited friends.</p>
<p><strong>News Stories</strong> - applications can produce news stories based on how the users interact with the application. These stories appear on the user's Profile page in the news section. Bebo will also show the most interesting stories from a user's friends on their home page. News stories should be interesting and actionable in order to help your application spread and provide value to the user.</p>
<h2>Building a Bebo Application</h2>
<ol>
<li><strong>Get a Server</strong> - As I said above, we will focus on building an application using PHP. The first thing you need is a server to host your application files. Some likely candidates might be your home pc to start, Joyent or another hosting company, or the Amazon EC2 web server platform. As your application grows, your server needs will probably grow as well, so it good to think about how you will handle thousands of users early on. RightScale.com provides some automatic scaling services on top of the Amazon EC2 platform, that let you spin up and shut down servers to meet your demand, so that you only pay for what you use. You will need the information about this server to set up and deploy your application.</li>
<li><strong>Install the Bebo Developer Application</strong> - go to <a href="http://www.bebo.com/Profile.jsp?MemberId=5036051566">http://www.bebo.com/Profile.jsp?MemberId=5036051566</a> and install this application. It is written by Bebo, and is required to let you set up your application with Bebo. Once you have it installed, you can go to create a new application.
<ol>
<li>Click the Create New Application link at the top right</li>
<li>Enter the Application Name - this is the name you want people to see. Example: "Favorite Birds".</li>
<li>Enter the Application URL - this is the Bebo URL that users will go to. This name doesn't have to match the Application Name, and in some cases cannot, because the name you pick might already be in use. Example: "favoritebirds".</li>
<li>Pick a canvas style - If you want to use the Bebo SNML markup language, choose SNML. If you want to host an external site in an iframe or use javascript frameworks, then choose iFrame. For this example, we will choose SNML.</li>
<li>Enter a description - Type something, but don't worry too much about this now, you can fill this out later.</li>
<li>Enable on a profile - Check this box if you want to let users have your application on their profile. In almost every case, you will leave this checked.</li>
<li>Callback URL - the location on your server that holds your files. I like to have the directory match the application url I set above, and I end it in a slash. Example: <strong><em>http://myserver.com/favoritebirds/</em></strong></li>
<li>Post Add URL - Leave this blank for now. I will go over how to handle this later.</li>
<li>Remove Callback URL -Leave this blank for now. I will go over how to handle this later.</li>
<li>Default SNML - this is a way to initially set the contents of all new user's profile boxes.</li>
<li>Categories - pick one that fits your application. You can change it later.</li>
<li>Icons - you can update this later, so leave it for now.</li>
<li>Leave the Manage Test Group checkbox checked and set to Only Developers.</li>
<li>Check the I have read the terms checkbox.</li>
<li>Click Create Application.</li>
<li>It should take you to the My Applications page and you should see your new application along with a bunch of other information. We will use this later, so leave the page up.</li>
</ol>
</li>
<li><strong>Get the Bebo library</strong> - the Bebo platform team provides an updated wrapper library here <a href="http://developer.bebo.com/downloads/example-libs-php.php">http://developer.bebo.com/downloads/example-libs-php.php</a>.
<ol>
<li>Create a new source directory - c:\src\favoritebirds.</li>
<li>Download this file and save it in your source directory.  Call it something simple, like bebo.php.</li>
</ol>
</li>
<li><strong>Set up your web host</strong>
<ol>
<li>In Apache, edit your http.conf or create an .htaccess file so that your new callback url <strong><em>http://myserver.com/favoritebirds/</em></strong> points to your source directory.</li>
<li>In IIS, use the IISAdmin tool to create a new Virtual Directory so that your new callback url <strong><em>http://myserver.com/favoritebirds/</em></strong> points to your source directory.</li>
</ol>
</li>
<li><strong>Create your index.php file</strong>
<ol>
<li>For this example, we will do all the work in this file. In a real application, you would want to split up your work into classes or modules or include files that make sense for your project.</li>
<li>Include the bebo php library.
<pre class="php">    <span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">&quot;bebo.php&quot;</span>;</pre>
</li>
<li>Your file needs to have some globals that define the project.
<pre class="php">    <span style="color: #0000ff;">$appVisibleName</span> = <span style="color: #ff0000;">&quot;Example App&quot;</span>;
    <span style="color: #0000ff;">$appApiKey</span> = <span style="color: #ff0000;">'copy API Key from the developer application page'</span>;
    <span style="color: #0000ff;">$appSecret</span> = <span style="color: #ff0000;">'copy API Secret from the developer application page'</span>;
    <span style="color: #0000ff;">$appCallback</span> = <span style="color: #ff0000;">'put in your callback url. Ex - http://myserver.com/favoritebirds/ '</span>;
    <span style="color: #0000ff;">$appBeboURL</span> = <span style="color: #ff0000;">'put in the Application URL above - http://apps.bebo.com/favoritebirds/'</span>;</pre>
</li>
<li>The easiest way to handle users is to force everyone to add right away. If they haven't Bebo will take then to the add page and then send them back. If they have already added your application, then you will just get their userid.
<pre class="php">    <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">require_add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;</pre>
</li>
<li>Now you can display the page to them using some SNML.</li>
<pre class="php">    displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">function</span> displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">&quot;Welcome back, &lt;sn:name uid='$userID' useyou='false' /&gt;.&lt;br/&gt;
            You have a nice picture:&lt;sn:profile-pic uid='$userID' linked='false'/&gt;&quot;</span>;
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$output</span>;
    <span style="color: #66cc66;">&#125;</span></pre>
</ol>
<p>You now have a fully functional Bebo application. But, let's add some more features.</li>
<li><strong>Updating the user's profile</strong>
<ol>
<li>It is simple to update a user's Profile Box each time they access your application. Just create a new updateProfile function and call it after your displayPage function.
<pre class="php">    updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">function</span> updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$snml</span> = <span style="color: #ff0000;">&quot;This is the $appVisibleName profile box of &lt;sn:name uid='$userID' useyou='false' /&gt;
			&lt;br/&gt;&lt;sn:profile-pic uid='$userID' size='square' linked='false'/&gt;&quot;</span>;
        <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">profile_setSNML</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$snml</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span></pre>
</li>
</ol>
</li>
<li><strong>Creating a News Story when the user accesses your page</strong>
<ol>
<li>News stories are a great way to let a user's friends know about the great things the user is doing with your application. Just add a new publishStory function and call it when the user does something meaningful.
<pre class="php">    publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #000000; font-weight: bold;">function</span> publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
&nbsp;
        <span style="color: #0000ff;">$actor</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$title_template</span> = <span style="color: #ff0000;">&quot;{actor} used &lt;a href='$appBeboURL'&gt;$appVisibleName&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$title_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_template</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_general</span> = <span style="color: #ff0000;">&quot;Everyone should try $appVisibleName. &lt;a href='$appBeboURL'&gt;
			Install $appVisibleName today.&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$image1</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$image1Link</span> = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
        try <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$result</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">feed_publishTemplatizedAction</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$actor</span>, <span style="color: #0000ff;">$title_template</span>,
			<span style="color: #0000ff;">$title_data</span>, <span style="color: #0000ff;">$body_template</span>, <span style="color: #0000ff;">$body_data</span>, <span style="color: #0000ff;">$body_general</span>,
            <span style="color: #0000ff;">$image1</span>, <span style="color: #0000ff;">$image1Link</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span> catch<span style="color: #66cc66;">&#40;</span> Exception <span style="color: #0000ff;">$ex</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span></pre>
</li>
</ol>
</li>
<li><strong>Allow users to share your application with Invites</strong>
<ol>
<li>If your application is worthwhile, users will want to let their friends know about it. Use the standard Bebo Invite control to let them invite up to 20 friends/day. Just add a new getInvitePageURL function, and add a link somewhere on your page to that url.
<pre class="php">    <span style="color: #0000ff;">$invitePageURL</span> = getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">&quot;&lt;a href='$invitePageURL'&gt;Would you like to invite some friends?&lt;/a&gt;&quot;</span>;
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appApiKey</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$beboInvitePage</span> = <span style="color: #ff0000;">&quot;http://www.bebo.com/multi_friend_selector.php&quot;</span>;
        <span style="color: #808080; font-style: italic;">// What the inviter sees</span>
        <span style="color: #0000ff;">$actionText</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Which friends do you want to invite?&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$action</span> = <span style="color: #0000ff;">$appBeboURL</span>;
        <span style="color: #0000ff;">$type</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Invite&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// What the recipient sees</span>
        <span style="color: #0000ff;">$acceptInviteButtonURL</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">get_add_url</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$appBeboURL</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$acceptInviteButtonLabel</span> = <span style="color: #ff0000;">&quot;Add $appVisibleName&quot;</span>;
        <span style="color: #0000ff;">$acceptInviteButton</span> = <span style="color: #ff0000;">&quot;&lt;sn:req-choice url='$acceptInviteButtonURL' label='$acceptInviteButtonLabel' /&gt;&quot;</span>;
        <span style="color: #0000ff;">$content</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hey, try out $appVisibleName. $acceptInviteButton&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0000ff;">$sig</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #808080; font-style: italic;">// update with the signature tool. This is a two step process. Generate the url for the invite page</span>
        <span style="color: #808080; font-style: italic;">// Then go to http://www.bebo.com/AppToolSig.jsp and paste it in. At the bottom, you will get a signature. Update the value above.</span>
        <span style="color: #808080; font-style: italic;">// If you change the invite text, you will have to regenerate the sig above</span>
        <span style="color: #0000ff;">$invitePageURL</span> = <span style="color: #ff0000;">&quot;$beboInvitePage?sig=$sig&amp;api_key=$appApiKey&amp;content=$content&amp;type=$type
			&amp;action=$action&amp;actiontext=$actionText&amp;invite=true&quot;</span>;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$invitePageURL</span>;
    <span style="color: #66cc66;">&#125;</span></pre>
</li>
</ol>
</li>
</ol>
<p><strong>Here is the completed sample:</strong></p>
<pre class="php">    &lt;!DOCTYPE html <span style="color: #000000; font-weight: bold;">PUBLIC</span> <span style="color: #ff0000;">&quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span> <span style="color: #ff0000;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;</span>&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span>
    date_default_timezone_set<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;America/New_York&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #b1b100;">require_once</span> <span style="color: #ff0000;">&quot;bebo.php&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Global definitions for your app</span>
    <span style="color: #0000ff;">$appVisibleName</span> = <span style="color: #ff0000;">&quot;Favorite Birds&quot;</span>;
    <span style="color: #0000ff;">$appApiKey</span> = <span style="color: #ff0000;">&quot;copy API Key from the developer application page&quot;</span>;
    <span style="color: #0000ff;">$appSecret</span> = <span style="color: #ff0000;">&quot;copy API Secret from the developer application page&quot;</span>;
    <span style="color: #0000ff;">$appCallback</span> = <span style="color: #ff0000;">&quot;http://myserver.com/favoritebirds &quot;</span>;
    <span style="color: #0000ff;">$appBeboURL</span> = <span style="color: #ff0000;">&quot;http://apps.bebo.com/favoritebirds/&quot;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">///Main Entry Point ///</span>
    <span style="color: #808080; font-style: italic;">// Force everyone to add the application.</span>
    <span style="color: #808080; font-style: italic;">// If they have already added it, then display the page</span>
    <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
    <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">require_add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Update the user's profile</span>
    updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
    <span style="color: #808080; font-style: italic;">// Publish a news story</span>
    publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #808080; font-style: italic;">///End Main Entry Point ///</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">&quot;Welcome back, &lt;sn:name uid='$userID' useyou='false' /&gt;.&lt;br/&gt;
            You have a nice picture:&lt;sn:profile-pic uid='$userID' linked='false'/&gt;&quot;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// Add the link to the invite page</span>
        <span style="color: #0000ff;">$invitePageURL</span> = getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$output</span> .= <span style="color: #ff0000;">&quot;&lt;br/&gt;&lt;a href='$invitePageURL'&gt;Would you like to invite some friends?&lt;/a&gt;&quot;</span>;
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$output</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// returns the url for the Bebo standard invite page</span>
    <span style="color: #000000; font-weight: bold;">function</span> getInvitePageURL<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appApiKey</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$beboInvitePage</span> = <span style="color: #ff0000;">&quot;http://www.bebo.com/multi_friend_selector.php&quot;</span>;
        <span style="color: #808080; font-style: italic;">// What the inviter sees</span>
        <span style="color: #0000ff;">$actionText</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Which friends do you want to invite?&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$action</span> = <span style="color: #0000ff;">$appBeboURL</span>;
        <span style="color: #0000ff;">$type</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Invite&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// What the recipient sees</span>
        <span style="color: #0000ff;">$acceptInviteButtonURL</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">get_add_url</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$appBeboURL</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$acceptInviteButtonLabel</span> = <span style="color: #ff0000;">&quot;Add $appVisibleName&quot;</span>;
        <span style="color: #0000ff;">$acceptInviteButton</span> = <span style="color: #ff0000;">&quot;&lt;sn:req-choice url='$acceptInviteButtonURL' label='$acceptInviteButtonLabel' /&gt;&quot;</span>;
        <span style="color: #0000ff;">$content</span> = <a href="http://www.php.net/urlencode"><span style="color: #000066;">urlencode</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Hey, try out $appVisibleName. $acceptInviteButton&quot;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
        <span style="color: #0000ff;">$sig</span> = <span style="color: #cc66cc;">0</span>; <span style="color: #808080; font-style: italic;">// update with the signature tool. This is a two step process. Generate the url for the invite page</span>
        <span style="color: #808080; font-style: italic;">// Then go to http://www.bebo.com/AppToolSig.jsp and paste it in. At the bottom, you will get a signature. Update the value above.</span>
        <span style="color: #808080; font-style: italic;">// If you change the invite text, you will have to regenerate the sig above</span>
        <span style="color: #0000ff;">$invitePageURL</span> = <span style="color: #ff0000;">&quot;$beboInvitePage?sig=$sig&amp;api_key=$appApiKey&amp;content=$content&amp;type=$type&amp;action=$action&amp;actiontext=$actionText&amp;invite=true&quot;</span>;
&nbsp;
        <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$invitePageURL</span>;
    <span style="color: #66cc66;">&#125;</span>	
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
&nbsp;
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$snml</span> = <span style="color: #ff0000;">&quot;This is the $appVisibleName profile box of &lt;sn:name uid='$userID' useyou='false' /&gt;
			&lt;br/&gt;&lt;sn:profile-pic uid='$userID' size='square' linked='false'/&gt;&quot;</span>;
        <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">profile_setSNML</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$snml</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">function</span> publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appVisibleName</span>;
        <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$appBeboURL</span>;
&nbsp;
        <span style="color: #0000ff;">$actor</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">user</span>;
        <span style="color: #0000ff;">$title_template</span> = <span style="color: #ff0000;">&quot;{actor} used &lt;a href='$appBeboURL'&gt;$appVisibleName&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$title_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_template</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_data</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$body_general</span> = <span style="color: #ff0000;">&quot;Everyone should try $appVisibleName. &lt;a href='$appBeboURL'&gt;Install $appVisibleName today.&lt;/a&gt;&quot;</span>;
        <span style="color: #0000ff;">$image1</span> = <span style="color: #000000; font-weight: bold;">null</span>;
        <span style="color: #0000ff;">$image1Link</span> = <span style="color: #000000; font-weight: bold;">null</span>;
&nbsp;
        try <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$result</span> = <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">feed_publishTemplatizedAction</span><span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$actor</span>, <span style="color: #0000ff;">$title_template</span>,
			<span style="color: #0000ff;">$title_data</span>, <span style="color: #0000ff;">$body_template</span>, <span style="color: #0000ff;">$body_data</span>, <span style="color: #0000ff;">$body_general</span>,
            <span style="color: #0000ff;">$image1</span>, <span style="color: #0000ff;">$image1Link</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #000000; font-weight: bold;">NULL</span>, <span style="color: #000000; font-weight: bold;">NULL</span>,
            <span style="color: #ff0000;">&quot;&quot;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span> catch<span style="color: #66cc66;">&#40;</span> Exception <span style="color: #0000ff;">$ex</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<h2>Advanced user state management</h2>
<p>The example above just forces everyone to add, but isn't able to specially handle new installs or removals. You can handle those by looking at the $_REQUEST parameters that Bebo passes your application. These parameters show that users come to your application in 1 of 3 states:</p>
<ol>
<li>Just installed the application</li>
<li>A normal user of the application</li>
<li>Just removed the application</li>
</ol>
<p>By changing the block marked ///Main Entry Point /// above to one that detects the state, you can handle each one differently. You will need to add new functions to handle new user installs and uninstalls</p>
<pre class="php">    <span style="color: #808080; font-style: italic;">///Main Entry Point ///</span>
    <span style="color: #808080; font-style: italic;">// An existing user will have the fb_sig_in_canvas variable set, unless they are removing</span>
    <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_in_canvas'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>    
&nbsp;
        <span style="color: #808080; font-style: italic;">//  Bebo will pass their user id and that they have added the application</span>
        <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_user'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_added'</span><span style="color: #66cc66;">&#93;</span> == <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_user'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// If the user has just installed, Bebo will pass installed as a GET parameter</span>
            <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'installed'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
                newInstall<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span>;
            <span style="color: #66cc66;">&#125;</span>
&nbsp;
            <span style="color: #808080; font-style: italic;">// Normal users will go through here, so display the page</span>
            <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
            displayPage<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// Update the user's profile</span>
            updateProfile<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
            <span style="color: #808080; font-style: italic;">// Publish a news story</span>
            publishStory<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// If you set up your own post add handler, then you must handle the add request the way you want,</span>
    <span style="color: #808080; font-style: italic;">// and then redirect back to your Bebo URL. If you don't specify a post add handler, Bebo does this for you.</span>
    <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'installed'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
          <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
          newInstall<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$bebo</span> <span style="color: #66cc66;">&#41;</span>;
          <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">redirect</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$appBeboURL</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #808080; font-style: italic;">// If you specify a post remove URL, then Bebo will call it with this POST variable.</span>
    <span style="color: #808080; font-style: italic;">// After this call, you won't get anything else from this user unless they re-add your application</span>
     <span style="color: #b1b100;">else</span> <span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#41;</span> &amp;&amp; <a href="http://www.php.net/isset"><span style="color: #000066;">isSet</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_uninstall'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$userID</span> = <span style="color: #0000ff;">$_POST</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'fb_sig_user'</span><span style="color: #66cc66;">&#93;</span>;
        uninstallUser<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// If the user goes to your callback URL directly, they didn't come in from Bebo, and you will have no information about the user</span>
    <span style="color: #808080; font-style: italic;">// In most cases, you will just want to force the user to add the application by using require_add. This will force them back through</span>
    <span style="color: #808080; font-style: italic;">// the existing user path above</span>
    <span style="color: #b1b100;">else</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #0000ff;">$bebo</span> = <span style="color: #000000; font-weight: bold;">new</span> Bebo<span style="color: #66cc66;">&#40;</span> <span style="color: #0000ff;">$appApiKey</span>, <span style="color: #0000ff;">$appSecret</span> <span style="color: #66cc66;">&#41;</span>;
        <span style="color: #0000ff;">$bebo</span>-&gt;<span style="color: #006600;">require_add</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
    <span style="color: #66cc66;">&#125;</span>
&nbsp;
    <span style="color: #808080; font-style: italic;">// Handle a new user installation</span>
    <span style="color: #000000; font-weight: bold;">function</span> newInstall<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// We can use the SNML to say hello to the user</span>
        <span style="color: #0000ff;">$output</span> = <span style="color: #ff0000;">&quot;Hello, &lt;sn:name uid='$userID' useyou='false' /&gt;. Thanks for adding the application!&quot;</span>;
        <a href="http://www.php.net/echo"><span style="color: #000066;">echo</span></a> <span style="color: #0000ff;">$output</span>;
    <span style="color: #66cc66;">&#125;</span>
    <span style="color: #000000; font-weight: bold;">function</span> uninstallUser<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$userID</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
        <span style="color: #808080; font-style: italic;">// You can't actually display anything to the user, or redirect them.</span>
        <span style="color: #808080; font-style: italic;">// All you can do is clean up inside your application.</span>
&nbsp;
    <span style="color: #66cc66;">&#125;</span>	
&nbsp;
    <span style="color: #808080; font-style: italic;">///End Main Entry Point ///</span></pre>
<h2>About Thought Labs</h2>
<p>Thought Labs provides custom software development and consulting services with a specialization in Social Network technologies. We build branded Facebook Pages for your company or multiple Pages for your various products. In addition, we create rich interactive applications on your Page to help users find your products and services. Thought Labs can also create custom Facebook, Bebo or OpenSocial applications carrying your message and your brand with them.</p>
<p>We pride ourselves on the quality of our work. We employ top application developers who are creative, highly skilled, up-to-date on the Social Networks' constantly changing APIs, and excellent at project management. We set high standards for ourselves and we meet them. In this new world of social marketing, Thought Labs delivers extremely innovative, high-quality work on time and on budget. Find out more at <a href="http://www.thoughtlabs.com">http://www.thoughtlabs.com.</a></p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=43&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/05/08/how-to-create-a-bebo-application-using-php-5/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
		<item>
		<title>A brief example of how to use fb:ref on Facebook or sn:ref on Bebo</title>
		<link>http://www.thoughtlabs.com/2008/05/06/42/</link>
		<comments>http://www.thoughtlabs.com/2008/05/06/42/#comments</comments>
		<pubDate>Tue, 06 May 2008 19:29:24 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Facebook]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/?p=42</guid>
		<description><![CDATA[fb:ref is a way to set a placeholder on a bunch of user profiles, and then update it across all those profiles with a single call. It makes sense to use when you have data or images that would need to be updated occasionally, but are not specific to the current viewing user. Some examples [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>fb:ref is a way to set a placeholder on a bunch of user profiles, and then update it across all those profiles with a single call. It makes sense to use when you have data or images that would need to be updated occasionally, but are not specific to the current viewing user. Some examples would be banner, application news updates, or perhaps an entire theme for a profile box.</p>
<p>You can have multiple fb:ref's - they are keyed off the one of two things:</p>
<ol>
<li>A callback url. In this case, you use the &lt;fb:ref&gt; to place the block, and the fbml_refreshRefUrl() to update it.</li>
<li>A handle name. In this case, you use &lt;fb:ref&gt; to place the block, and fbml_setRefHandle() to update it.</li>
</ol>
<p>Below, I will show steps for implementing the callback method:</p>
<ol>
<li>Set users' profiles with code like this:
<pre>
  $fbml = "&lt;fb:ref url='http://yourserver.com/callbackurl' /&gt;";
  $facebook->api_client->profile_setFBML("", NULL, $fbml, "", "");
</pre>
<p>on Bebo it would be:</p>
<pre>
  $snml = "&lt;sn:ref url='http://yourserver.com/callbackurl' /&gt;";
  $bebo->api_client->profile_setSNML($snml , $userid);
</pre>
<p>For the callback url, you can either use a unique page or just pass a GET parameter that you can check for later like this:</p>
<pre>
  &lt;fb:ref url='http://yourserver.com/yourapp/callbackurl/?refcallback=1' /&gt;
</pre>
</p>
</li>
<li>In the callback page, add some code the detects that it is the refresh, and updates the ref block:
<pre>
  if ( isset($_GET['refcallback']) ) {
    $text = "
      &lt;div&gt;
        &lt;img src='http://yourserver.com/yourapp/someimage.jpg'/&gt;
      &lt;/div&gt;
    ";
    echo $text;
  }
</pre>
</li>
<li> When you want to update the ref in all the profiles, call:
<pre>
  $refreshURL = "whatever you used for the sn:ref above";
  $facebook->api_client->fbml_refreshRefUrl("$refreshURL");
 </pre>
<p>on Bebo it would be:</p>
<pre>
   $refreshURL = "whatever you used for the sn:ref above";
   $bebo->api_client->snml_refreshRefUrl("$refreshURL");
 </pre>
</li>
</ol>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=42&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/05/06/42/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>The Changing Meaning of ROI: Proving the Value of Social Media</title>
		<link>http://www.thoughtlabs.com/2008/05/01/the-changing-meaning-of-roi-proving-the-value-of-social-media/</link>
		<comments>http://www.thoughtlabs.com/2008/05/01/the-changing-meaning-of-roi-proving-the-value-of-social-media/#comments</comments>
		<pubDate>Thu, 01 May 2008 16:50:40 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[OpenSocial]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/2008/05/01/the-changing-meaning-of-roi-proving-the-value-of-social-media/</guid>
		<description><![CDATA[One of the first questions we usually are asked by potential clients of Thought Labs involves ROI (return on investment.) It is a valid  and critical question, no matter the size of  the company or its marketing budget. It's the yardstick used when evaluating the success of a traditional media campaign, so why not expect [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>One of the first questions we usually are asked by potential clients of <a href="http://www.thoughtlabs.com">Thought Labs</a> involves ROI (return on investment.) It is a valid  and critical question, no matter the size of  the company or its marketing budget. It's the yardstick used when evaluating the success of a traditional media campaign, so why not expect the same rules to hold true for social media? How can one be sure in the changing world of the web and online marketing that their dollar will have an impact on their bottom line? Will their investment increase brand recognition, generate leads, or increase their market penetration? Unfortunately there is currently no 'silver bullet' of measurement that can demonstrably prove ROI for a social media investment. There are startups working feverishly on the problem, to be sure, but the state of affairs today requires a different approach and restatement of the problem.</p>
<p>This approach is based on setting and meeting a set of clearly defined objectives rather than using measurements in the traditional sense, though some of them may still be valid. Companies have to ask themselves a very simple question: &quot;Why are we investing in social media, and what would we consider a successful result?&quot; It seems trite, in a way, but it is critical to understanding the new meaning of ROI. It's not about return on investment anymore. It's all about gaining influence or leverage for your investment and measuring the return on that influence. Influence is the key concept at the core of social media. Peer/friend opinions and reviews hold more sway than any other. Brands can be created in an instant and just as quickly destroyed when you are dealing with the economies of scale and the numbers of users involved on social networks such as Facebook and MySpace. But social media encompasses so much more. Myriad online communities exist and all are potentially valid social media outlets. Companies need to understand that by focusing only on the immediate effect on their bottom lines they may be missing the point.</p>
<p>One other area that companies need to understand is the new concept of 'engagement' as it applies to their social and new media strategies. What is 'engagement?' That's the million- or perhaps billion-dollar question. There is no metric for it that means the same thing to everyone. One interesting equation of sorts has been proposed by <a href="http://socialmedia.com">socialmedia</a>: </p>
<p><span style="font-family:monospace">E = mc^2</span></p>
<p>...which means:</p>
<p>Engagement = media buy * (creative ^ 2)</p>
<p>I agree in a sense. Creativity is STILL KING. You can spend millions on your media buy to get your social media prodcut noticed. But, if it's not creative (or for you math geeks as creativity approaches 0) your engagement tanks. It's simple, but critical to understand this. True, this all depends upon your objectives. You have to put your social media assets in context: if you are looking for tons of repeat users (i.e. page views, visits, etc.) and engagement is near zero, FAIL.There are enough single-use social media apps and widgets out there that support this hypothesis that it's not worth expanding upon. If you want your clients to come back, you need to interact with them. You have to engage them to make them come back.This is critical for both growing brands and generating leads. The traditional marketing funnel is still relevant - but the rules that govern the journey from one end of it (eyeballs on your content) to the other (the buy) have changed.</p>
<p>Another thing companies need to Think of it as an extension of the 80/20 rule. In the past when content was put on the web you could expect about 80% of your audience to see that content within a short period of time. If your spend was X at some specific or measured CPM you could expect some specific results based on traditional measurements. This is no longer the case with social media. Now, you can expect about 20% of your media to be viewed (if you're lucky) and over time, if you're influence and engagement are high enough, you can expect that 80% to come trickling - or ideally virally pouring - in after it's available for some time. It's not a linear graph anymore. You hope it's exponential. But it's not guaranteed.</p>
<p>It's about creating a social media campaign that is relevant to YOUR business and your needs. No one can do it for you if you don't understand why your business is playing in the social media space in the first place.</p>
<p>So:</p>
<ul>
<li>Develop a social media plan: 'Why are we doing this? What would we consider a social success?'</li>
<li>Make sure that plan is realistic: viral spread of apps and widgets is much harder on ALL the networks these days. Do NOT assume that it will spread just because it's there!</li>
<li>Define your own ROI: it's about meeting your objectives. Seriously. Tell your CEO/CFO. Make them understand this.</li>
<li>Make someone OWN your problem on YOUR end: you cannot expect someone to do everything for you and guarantee excellent results; you need to understand and manage your end of the social media strategy. It's not easy (anymore) - you are going to need to work at it and understand that you are going to need to work at it.</li>
<li>Develop metrics that matter to YOU: since there are no global ones in the current sense you need your own based on what your plan deems a successful result</li>
<li>ITERATE, ITERATE, ITERATE: set a timed goal for reviewing your strategy; if it's not on target at the end of that time then review why, refactor, retest, and relaunch until you get it right. It's NOT ABOUT being the best, smartest, or brightest anymore. It's all about being the fastest and getting the most relevant results based on your plan and the metrics that matter to you. And do it fast. Very, very fast.</li>
<li>Understand the social media lifecycle: how long do you expect your strategy to live in the wild? Lifetimes are shorter these days. You cannot expect a drop-in solultion to be relevant in a year from now. See the last point. See the fact that the top 25 Facebook applications have changed drastically in the last year. And will again.</li>
<li>Cast a net that matters to you: there are a ton of social media outlets out there now. Find out where your demographic lives. If they are 50-year-old financial executives then MySpace is probably not worth investing in.</li>
</ul>
<p>It's all about the conversation now. Be a part of it. Don't fight it or you will lose.</p>
<p><small>Tags: <a rel="tag" href="http://technorati.com/tag/social+media">social media</a>, <a rel="tag" href="http://technorati.com/tag/facebook">facebook</a>, <a rel="tag" href="http://technorati.com/tag/myspace">myspace</a>, <a rel="tag" href="http://technorati.com/tag/opensocial">opensocial</a>, <a rel="tag" href="http://technorati.com/tag/marketing">marketing</a>, <a rel="tag" href="http://technorati.com/tag/ROI">ROI</a></small></p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=66&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/05/01/the-changing-meaning-of-roi-proving-the-value-of-social-media/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bebo Platform team selects John Maver as their &#8220;featured developer&#8221;</title>
		<link>http://www.thoughtlabs.com/2008/03/13/bebo-platform-team-selects-john-maver-as-their-featured-developer/</link>
		<comments>http://www.thoughtlabs.com/2008/03/13/bebo-platform-team-selects-john-maver-as-their-featured-developer/#comments</comments>
		<pubDate>Thu, 13 Mar 2008 12:48:06 +0000</pubDate>
		<dc:creator>Thought Labs</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/2008/03/13/bebo-platform-team-selects-john-maver-as-their-featured-developer-2/</guid>
		<description><![CDATA[John has been spending a lot of time over the past few months trying to actively participate in the Bebo Developer forums. After working on the Inner Circle and Doorbell applications for Facebook, he had learned a lot about the platform. As we worked to port those applications over to Bebo, John thought that he [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>John has been spending a lot of time over the past few months trying to actively participate in the Bebo Developer forums. After working on the <a href="http://www.facebook.com/apps/application.php?id=2459697025">Inner Circle</a> and <a href="http://www.facebook.com/apps/application.php?id=9729051194">Doorbell</a> applications for Facebook, he had learned a lot about the platform. As we worked to port those applications over to Bebo, John thought that he could help others on the new Bebo platform get going as well.</p>
<p>A week ago, John got an email from the Bebo Platform Team telling him that he had been selected as the “featured developer” on the <a href="http://developer.bebo.com/">Bebo Developer Site</a>. He is very flattered. The Bebo Platform team is a very hardworking set of people, and we look forward to continuing to interact with them and with the Bebo Developer Community in the future.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=39&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/03/13/bebo-platform-team-selects-john-maver-as-their-featured-developer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bebo platform is still down, but some new features coming</title>
		<link>http://www.thoughtlabs.com/2008/02/19/bebo-platform-is-still-down-but-some-new-features-coming/</link>
		<comments>http://www.thoughtlabs.com/2008/02/19/bebo-platform-is-still-down-but-some-new-features-coming/#comments</comments>
		<pubDate>Tue, 19 Feb 2008 20:01:09 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/2008/02/19/bebo-platform-is-still-down-but-some-new-features-coming/</guid>
		<description><![CDATA[Bebo is still working on fixing performance problems, and the applications are still down. In a blog post today, the Bebo developers talked about some features that they will be releasing in the near future. More visible Notifications and Requests &#8211; they are going to redesign the home page to show these off more. Profile [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Bebo is still working on fixing performance problems, and the applications are still down. In a blog post today, the Bebo developers talked about some features that they will be releasing in the near future.</p>
<ol>
<li>More visible Notifications and Requests &ndash; they are going to redesign the home page to show these off more.</li>
<li>Profile application index &ndash; just like Facebook, they will have a icon index of all the applications that can be clicked to go to that application.</li>
</ol>
<p>This sound great for encouraging the spread of applications, but I worry that, like on Facebook, abuses of the system will render it mostly useless. Facebook has implemented limiting features to cut down on the spam, but the Bebo developers made no mention of implementing them on Bebo.</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=35&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/02/19/bebo-platform-is-still-down-but-some-new-features-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bebo application platform is turned off!</title>
		<link>http://www.thoughtlabs.com/2008/02/18/bebo-application-platform-is-turned-off/</link>
		<comments>http://www.thoughtlabs.com/2008/02/18/bebo-application-platform-is-turned-off/#comments</comments>
		<pubDate>Mon, 18 Feb 2008 21:24:40 +0000</pubDate>
		<dc:creator>John Maver</dc:creator>
				<category><![CDATA[Bebo]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/2008/02/18/bebo-application-platform-is-turned-off/</guid>
		<description><![CDATA[Bebo posted this today: Bebo is slow. Sorry! It's been growing a lot recently and we're not quite keeping up with the demand. Even though apps has nothing to do with the problem, we turned off apps temporarily to help reduce the load. We're working hard on a permanent fix and hope to have it [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>Bebo posted this today:</p>
<blockquote>
<p>Bebo is slow. Sorry! It's been growing a lot recently and we're not quite keeping up with the demand. Even though apps has nothing to do with the problem, we turned off apps temporarily to help reduce the load. We're working hard on a permanent fix and hope to have it all working fast again soon.</p>
</blockquote>
<p>This means, of course, that <a href="http://www.bebo.com/Profile.jsp?MemberId=5410592098">Doorbell</a> and <a href="http://www.bebo.com/Profile.jsp?MemberId=5542684875">Inner Circle</a> for Bebo are down. The good news is that the Bebo developers seem to generally be on top of their game, so I don&rsquo;t expect this to last too long.</p>
<p>&nbsp;</p>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=34&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/02/18/bebo-application-platform-is-turned-off/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facebook API: Undocumented Cookie Management REST APIs</title>
		<link>http://www.thoughtlabs.com/2008/02/15/facebook-api-undocumented-cookie-management-rest-apis/</link>
		<comments>http://www.thoughtlabs.com/2008/02/15/facebook-api-undocumented-cookie-management-rest-apis/#comments</comments>
		<pubDate>Fri, 15 Feb 2008 19:38:51 +0000</pubDate>
		<dc:creator>Cappy Popp</dc:creator>
				<category><![CDATA[Bebo]]></category>
		<category><![CDATA[Facebook]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.thoughtlabs.com/blogs/2008/02/15/facebook-api-undocumented-cookie-management-rest-apis/</guid>
		<description><![CDATA[The Facebook API does have a way to set and get cookies, but it is in beta so is not currently part of the FB PHP libraries. I found it out by searching through forums, by trial-and-error, and on the FB Beta docs page. There are 2 functions available: &#160; data.getCookies&#40; user_id, cookie_name &#41;; data.setCookie&#40; [...]]]></description>
			<content:encoded><![CDATA[<p></p><p>The Facebook API does have a way to set and get cookies, but it is in beta so is not currently part of the FB PHP libraries. I found it out by searching through forums, by trial-and-error, and on the FB Beta docs page. There are 2 functions available:</p>
<pre class="php">&nbsp;
  data.getCookies<span style="color: #66cc66;">&#40;</span> user_id, cookie_name <span style="color: #66cc66;">&#41;</span>;
  data.<a href="http://www.php.net/setcookie"><span style="color: #000066;">setCookie</span></a><span style="color: #66cc66;">&#40;</span> user_id, cookie_name, cookie_value, expires, path <span style="color: #66cc66;">&#41;</span>;
&nbsp;</pre>
<p>To use these functions from PHP I simply wrapped them in functions that call the RESTful APIs correctly:</p>
<pre class="php">&nbsp;
<span style="color: #808080; font-style: italic;">// to get cookies for a given user (optionally by name):</span>
<span style="color: #000000; font-weight: bold;">function</span> get_cookie<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$uid</span>, <span style="color: #0000ff;">$name</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
  <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$facebook</span>;
  <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$facebook</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">call_method</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'data.getCookies'</span>, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'uid'</span> =&gt; <span style="color: #0000ff;">$uid</span>, <span style="color: #ff0000;">'name'</span> =&gt; <span style="color: #0000ff;">$name</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">// to set a cookie for a given user:</span>
<span style="color: #000000; font-weight: bold;">function</span> set_cookie<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$uid</span>, <span style="color: #0000ff;">$name</span>, <span style="color: #0000ff;">$value</span>, <span style="color: #0000ff;">$expires</span>=<span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #0000ff;">$path</span>=<span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
  <a href="http://www.php.net/global"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$facebook</span>;
  <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">$facebook</span>-&gt;<span style="color: #006600;">api_client</span>-&gt;<span style="color: #006600;">call_method</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'data.setCookie'</span>, <a href="http://www.php.net/array"><span style="color: #000066;">array</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'uid'</span> =&gt; <span style="color: #0000ff;">$uid</span>, <span style="color: #ff0000;">'name'</span> =&gt; <span style="color: #0000ff;">$name</span>,
    <span style="color: #ff0000;">'value'</span> =&gt; <span style="color: #0000ff;">$value</span>, <span style="color: #ff0000;">'expires'</span> =&gt; <span style="color: #0000ff;">$expires</span>, <span style="color: #ff0000;">'path'</span> =&gt; <span style="color: #0000ff;">$path</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<img src="http://www.thoughtlabs.com/?ak_action=api_record_view&id=32&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.thoughtlabs.com/2008/02/15/facebook-api-undocumented-cookie-management-rest-apis/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

