September 29, 2009

Automatically tweet about new posts in Expression Engine using AutoTweet plugin

written by Marek Foss

There are stuff machines should do for you, and one of them is tweeting about your latest blog post – because it’s important to spread the word. Today I will show you my Expression Engine (EE) plugin called AutoTweet that does just that. It’s simple and elegant and doesn’t require anything above typing in your Twitter credentials. So next time you see an auto-tweet about my post, please retweet it :)

I was looking for a solution to auto-tweeting for a bit when I stumbled upon Jensa’s Send Tweet plugin. It would have worked fine, but I didn’t like that it used a local file to store the last tweeted message. It’s all in the timeline anyway, isn’t it? So I decided to write my own plugin that would use the Twitter database instead.

What my AutoTweet basically does is, when called, checks your timeline for the given message and if it doesn’t exist – it tweets it. AutoTweet is also immune to URL changes, as they are stripped while performing a regular expression match against the timeline – this way there are no problems if the URL somehow gets shortened differently along the way.

Finally, for the heavy twitterers, this solutions ensures your precious blog post will be always visible in your recent timeline and won’t be lost in all your babbling about coffee ;) AutoTweet will retweet the announcement if you tweet so much that the blog post message is pushed back in the timeline.

How to use it?

Usage is fairly simple. First of all download the plugin:

(zip) Download the AutoTweet Plugin 1.0 for Expression Engine

Upload it to your EE plugin directory. You can access the usage description by going to Admin - Utilities - Plugin Manager - AutoTweet. Or you can go on reading :)

The idea is similar to Jensa, you insert text betweet the {exp:autotweet} tags in a template, and when a page with that template is called, the inserted text will be tweeted, but only if it wasn’t in the timeline before. To setup it for auto-tweeting blog posts, you should insert the title and permalink of the latest post, like this:

{exp:autotweet}
{exp:weblog:entries weblog="{master_weblog_name}" limit="1" rdf="off" dynamic_start="on" disable="member_data|trackbacks"}
{title} {title_permalink="article"}
{/exp:weblog:entries}
{/exp:autotweet}

But you still have to open a page with the above template code in a browser of some kind to make it work. One of the solutions is to setup a cron job on your server that will periodically visit it.

Another solution, for you FeedBurner users out there, is to add this AutoTweet code to the top of your feed template. When FeedBurner pings your site to check for updates, it will also call the AutoTweet script, and if you have recently posted anything new, the title and link to your post will automagically appear in your timeline.

AFTERNOTE: This is how the auto-tweeted post looks like, and if you like all of it, be sure to retweet it :)

 


If you liked the article, please spread the word and share it!

  • Share

Comments



Leave a comment: (comments may not appear immediately due to page caching)

Name: Email: (not disclosed)

WWW: Remember my details

Notify me of follow-up comments

Feed me:

to feed
  • Subscribe and get the new articles every now and then directly in your reader — I recommend using Google Reader

Facebook:

Connect:

 by Google
Google FriendConnect appears to be down at the moment. Sorry for inconvenience.
Related Posts with Thumbnails