Twitter

Jan 14, 2010 at 6:39 PM

Anyone have a twitter plugin that can post updates to twitter when you post a blog entry, like Wordpress does?

Jan 14, 2010 at 11:53 PM

If you use Live Writer you can use the Twitter Notify plugin.

Jan 15, 2010 at 9:03 AM

Ah, cool. thanks for that!

Feb 2, 2010 at 12:31 PM

I wrote a blog post about how to add a “tweet this” button below each post: http://www.codecapers.com/post/Adding-a-Tweet-This-Button-To-Your-Blog-Posts.aspx

The concept is generic enough where you can reuse it on any ASP.NET enabled site. Enjoy!

Mar 3, 2010 at 8:30 PM

Hi: I'm curious if there's anyone working on the ability to tweet a post automatically in BE.NET? It would be a nice feature to have?

Mar 3, 2010 at 9:16 PM
dotnetnoob wrote:

Hi: I'm curious if there's anyone working on the ability to tweet a post automatically in BE.NET? It would be a nice feature to have?

You mean something like submitting the post title and sending it to twitter with a shortened url?

Mar 3, 2010 at 9:18 PM

Yes, exactly!

Mar 4, 2010 at 9:11 AM
Edited Mar 5, 2010 at 9:24 AM

I have made one :)  I've published it on my site, but it won't be online for a few weeks.

However, because I'm nice, you can download it here: http://dl.dropbox.com/u/4162408/blogengineExtensions/TwitterUpdater.zip

And below - this is what I wrote about it on my site.

Hope this helps :)


Seeing as I’ve put a Twitter feed on the side of the website, I thought I may as well start using Twitter more often!  Why not have an extension that automatically updates my Twitter status whenever a new post is made on CreepinJesus.net?

Why not, indeed.  So, here we have it.  Currently at version 1.1 (after some testing), the extension is easily installed and works with only a little tweaking.  

Requirements

  • A Twitter account (obviously)
  • The Twitterizer API (included in the download)

Installation and Setup Instructions

  1. Un-zip the files to …wherever you like!
  2. Open up the Twitterizer folder and copy both files to the bin folder of your website.
  3. Copy TwitterUpdater.cs to the App_Code/Extensions folder of your website.
  4. Sign in to your site and go to the Extensions page.  This may take a while to load on the first visit.
  5. Click on Edit under the Settings column for TwitterUpdater.
  6. Enter your Twitter username and password.
  7. Also enter the text you would like to see in your Twitter status update. For example, New post on MySite.com - {0}.  The "{0}" is very important - this is where the TinyURL link to your post will be placed in the status text.  It can be anywhere in the status text, though, so as another example: Visit {0} for a new post!  Just remember that Twitter has a maximum of 140 characters, so to make sure it all fits try to keep your message below 100 characters.
  8. Click Save to save your settings.
  9. All done :)  Now whenever you publish a new post, your Twitter status will be updated.

Issues/Problems

The only issue so far is the way the extension knows whether it has updated Twitter for a given post or not.  At the moment, is is using the following code:

_post = (Post)sender;
if (_post.IsVisibleToPublic)
{
    TimeSpan ts = DateTime.Now.Subtract(_post.DateCreated);
    if (ts.TotalSeconds <= 10)
    {
        // Update Twitter
    }
}

What this is doing is checking to see whether the post is visible to the public first (no point linking people to a hidden post!), then if it was created in the last 10 seconds it is considered a new post.

This means that if you have created a post and saved it without publishing it, it will not be announced on Twitter when you change the post’s published state to Published (unless you do it within 10 seconds of first creating the post).

This is something I will be working on in the future.  I will try to use methods that are available in the standard release of BE so it will work for everyone without having to modify source code.  In the mean time, just remember that limitation.

Feb 22, 2011 at 4:19 PM

Getting 404 file not found on the download link.

 

Would like to use this code :)