September 30, 2007

WhatIWantMost: How to post to your Twitter timeline

Last week I attended a presentation about Web 2.0 that described the recurring concepts behind the buzzword and looked at how (as well as if and when) those can be applied to enterprise systems and organizations.

One of the points of the presentation was that platforms are better than applications. Companies building platforms rather than just applications are the darlings of the web world. Some of the examples the presenter pointed out were: Facebook, Salesforce.com, Twitter, Wikipedia, Amazon, and Microsoft. As I was reviewing this list I was mentally noting the following: Microsoft - yes I've used live search and the APIs; Amazon - use this a lot on WIWM; Facebook - I use the site and I've been working on an application to bring WIWM into facebook; Twitter - yes, I use it but I haven't worked with it much other than some contributions to TeleTwitter... then it hit me. Why am I not making use of Twitter on the WIWM site? The site offers the ability to keep track of user's wishlists with RSS, why not post to their Twitter timeline when they add something new to their list.

Last Thursday night I set out to make it so. First I checked out the Twitter API documentation which said that basically you need to post to a URL with the updated text and it makes use of basic auth. Next I looked at the TeleTwitter code to see how the Twitter communication was handled. There was some good stuff there, but much more than I needed and it was tied to the TeleTwitter implementation. I'm sure I could have harvested the needed code (Hooray Open Source!) but I was looking for a simpler path.

That is when I found that Twitteroo offers their Core library (in binary form) on their site - look for TwitterooCore 1.4 API in the left-hand menu under "Download Twitteroo" - along with a console sample application and some pretty good documentation. After checking it out I knew this is what I was looking for.

Next step, reference the TwitterooCore.dll in my project and add the simple code to send a Twitter update to the user's twitter account. In the case of the WIWM site, I'm simply sending out "I added ProductX to my wishlist" along with a link to the user's wishlist on the site.

Here is the basic code needed to do so:

TwitterooCore core = new TwitterooCore(UsersTwitterID, UsersTwitterPassword);
core.ChangeStatus("The text that you want to post to the user's twitter timeline");

That's all there is to it. I've been wondering what other applications that I have worked on or even that I have used in the past could make use of this. One natural usage is updating your status whenever you make a blog post. I follow several people who do this and Kyle created a Community Server Module for doing so with your Community Server blog. What other places can you think of where something like this would be useful - to automate a Twitter Status update based on some action on your site, web app, or any other software really? I know this could really be abused. I don't really want to see things like "I just logged on to Ebay", "I'm chatting with Billy", and "I just spent $114.57 at Walmart" in twitter status updates, but it could be done.

Comments,

  • Trackbacks,
  • and Pingbacks
  1.  avatar Venkat.KL says:

    Hi,

    I tried Updating my Twitter, but I am getting error as below;

    The remote server returned an error: (417) Expectation Failed.

    Here is the code;

                   TwitterooCore core = new TwitterooCore("venkatkl", "mypassword");

    string updateMessage="@SharePoint2010  Engineering SharePoint By Jeff Teper – tinyurl.com/yzhrq87";

    core.ChangeStatus(updateMessage);

    What could be the Issue?

    Regards,

    Venkat.KL

  2.  avatar Venkat.KL says:

    Hi,

    When I tried, I am getting an error; "The remote server returned an error: (417) Expectation Failed."

    Here is the code;

    TwitterooCore core = new TwitterooCore("venkatkl", "myPassword");

    string updateMessage="@SharePoint2010  Engineering SharePoint By Jeff Teper – tinyurl.com/yzhrq87";

    core.ChangeStatus(updateMessage);

    Regards,

    Venkat.KL

  3. Venkat.KL, a couple of months ago I noticed the same error from the code I was using in production. It seems that the Twitter API has changed and whatever changes were made caused an exception by TwitterooCore. I looked on the Twitteroo site to see if they had an updated assembly available. At that time there was none.

    The TwitterooCore is a nice abstraction, but I'm sure there are other alternatives available by now - a LINQ To Twitter implementation created yet? Or you can just write directly vs. the Twitter API.

  4. Stumbled across this today, the Linq To Twitter implementation on CodePlex: www.codeplex.com/LinqToTwitter

Comments are closed.

 

Trackbacks and Pingbacks


  1. A couple of weeks ago I wrote post about updating your Twitter timeline using the Twitteroo Core API

  2. A couple of weeks ago I wrote post about updating your Twitter timeline using the Twitteroo Core API

Shortcuts

Where is Dan?


My Blog
My Blog
Twitter
Twitter
Facebook
Facebook
LinkedIn
LinkedIn
Flickr
Flickr
YouTube
YouTube
Delicious
Delicious
Foursquare
Foursquare
Pinterest
Pinterest
GetGlue
GetGlue
Pintley
Pintley
XBOX Live
XBOX Live
Last.fm
Last.fm
Windows Live
Windows Live
Telligent.com
Telligent
Graffiti CMS on CodePlex
Graffiti CMS
Popular

Recent Posts