Use ColdFusion's CFFeed to Display Your Twitter Tweets (and more!) on Your Blog in 30 Seconds

As Twitter's popularity continues to increase, users and consumers of the information being broadcast are looking for quick and easy ways to integrate some of the information into their own content. So I whipped up this short, but sweet, example of how easy it is to repurpose content from Twitter using just a dash of ColdFusion.

First things first though, what makes consuming information from Twitter so easy is their search functionality. Check it out at By following the instructions there, you will see that anything you search for can be "burned" via RSS. After your search, following the link "Feed for this query" and viola! Instant RSS feed you can now consume. How sweet it is.

What's really cool is that if you search for let's say "stevewithington" you can see not only my posts, but also any responses too. If you only want to see tweets "from" me for example, then you simply put "from:" in front of your search criteria such as "from:stevewithington."

For sake of simplicity, I'm going to just follow the "Feed for this query" link and continue on.

If you're using ColdFusion 8, then all you have to do is use CFFeed to consume the feed. Here's a sample line of code:

<cfset feedurl="" />
    query="feeditems" />

If you're curious as to what the feed contains, you can always use CFDump to find out:

<cfdump var="#feeditems#" label="feedItems" />

Using the above line of code, you should see something similar to the following:

As you'll see, CFFeed creates a very nice query object containing quite a bit of information for you. One field of interest at this point is the "CONTENT" field which contains HTML-formatted code for each tweet. If you prefer a "text-only" version of the tweet, then simply use the "TITLE" field. So, to show how easy this is, let's just loop over the feed items and output the "CONTENT."

<cfoutput query="feeditems">

Running the above line of code, you should see something like this:

I know, I know, you're probably thinking, "there's got to be more to it, right?" Well, there is if you want there to be! Using CFDump, you saw all kinds of information you can repurpose to your heart's desire. Think up new ways to use Twitter and with ColdFusion's CFFeed you can create new ways to consume it's easy-to-integrate-and-embed information.


CFFEED makes this so easy and its the exact method I used for my Flex twitter pod. A friend did the same in php and it was at least 10x the amount of code.
# Posted By Paul Kukiel | 3/4/09 1:14 PM

Good to know, thanks for sharing!
# Posted By Stephen Withington | 3/4/09 1:53 PM
oo nice find
# Posted By Bradley Moore | 3/4/09 2:24 PM
Nice one!
# Posted By Nev | 3/6/09 3:55 PM
Your output seems to highlight the links in the #content# field automagically while I just get plain text(i.e. the links are not clickable) Is there a trick to this?
# Posted By Bill | 4/19/09 10:45 PM

The links will only show up if there are links in the Tweets. Here's another completed sample you can try:

<cfset feedurl="; />

   query="feeditems" />

<cfoutput><ul style="text-align:left;"></cfoutput>
<cfoutput query="feeditems" maxrows="4">
   <li align="left">#content#</li>
# Posted By Stephen Withington | 4/20/09 4:12 PM
Hey Steve. Thanks for the demo. I will be using this in my new site design.

Question: Any idea how to format that date that is returned? or better yet a east way to display it as "posted X minutes/hours/days ago"?

Thanks in advance for any feedback!

Keep up the good work.
# Posted By Shaun Webster | 6/3/09 7:07 PM
UPDATE to previous question...

Figured out the time stamp coming in (PUBLISHEDDATE) from the feed is in ISO 8601 format.


This is what I did to format it (warning it ain't pretty):

<cfset pDate = Mid(PUBLISHEDDATE, 1, Find("T", PUBLISHEDDATE)-1)>
<cfset pTime = Mid(PUBLISHEDDATE, Find("T", PUBLISHEDDATE)+1, 8)>
<cfset pDateTime = "#pDate# #pTime#">
<cfset published = DateConvert("utc2Local",pDateTime)>

#DateFormat(published, 'm/d/yyyy')# at #TimeFormat(published, 'short')#

Let me know if you know of a better way or you see an issue to using the above method.

# Posted By Shaun Webster | 6/3/09 8:42 PM
Used the Relative Time Script UDF from Ray Camden at and looks great.
# Posted By Shaun Webster | 6/3/09 9:00 PM

Thanks for posting the solution to your original question. Ray's script looks like a winner!

Thanks again.
# Posted By Stephen Withington | 6/4/09 8:06 PM
A little late into this discussion - which BTW seriously helped me out. Just wanted to post this link for anyone looking for the solution to the ISO 8601 date time conversion Shaun Webster posted...

Thanks all.
# Posted By Scott Underwood | 10/9/09 11:49 AM
@Scott, thanks for the feedback and the link!
# Posted By Stephen Withington | 10/9/09 12:31 PM
So simple with CFFeed. Happy that you shared this tip. You have a new follower.
Bob L.
# Posted By Buffalo Office | 3/8/10 8:18 PM
thanks Bob.
# Posted By Stephen Withington | 3/9/10 8:41 AM
This is such a clever idea! I'm surprised I'd not found your blog before but look forward to following it now.
# Posted By Theora | 5/27/10 8:16 AM
how many entries does it return on default
# Posted By mugs | 3/8/11 10:27 PM
I was using this on my site and it was working and now it has stopped. I even went to the direct search URL: and it is not returning any of my feed. What am I doing wrong?
# Posted By Alison | 4/20/11 11:48 AM

That's interesting... the only thing I could suggest is to check twitter's search to make sure the feed works. I would assume it has something to do with Twitter.

Check here:

Oddly though, when I enter IR_training in the 'From this person' field, and then click search, I get nothing. However, if I enter my name 'stevewithington' I do get results.
# Posted By Steve Withington | 4/20/11 1:23 PM
I checked w/ other twitter accounts and it looks like it only outputs tweets from the last 2 days, nothing older.
# Posted By Alison | 4/20/11 1:50 PM
hmm, i just check mine and it has them to three days back. but still, this would all be dependent on twitter's search api
# Posted By Steve Withington | 4/20/11 2:13 PM
Thanks, I think it makes sense now. I'll have to ask my social media person to start tweeting more since our last tweet was 5+ days ago.
# Posted By Alison | 4/20/11 8:03 PM
How can I restrict CFFeed to display only first n entries?
# Posted By Smita | 10/4/11 8:02 AM
<cfoutput query="feeditems" maxrows="X">
# Posted By Steve Withington | 10/4/11 8:34 AM
Can you help me in adding previous and next buttons for navigating between tweets?
# Posted By Uday | 4/3/12 11:30 AM

© 2024, Stephen J. Withington, Jr.  |  Hosted by

Creative Commons License   |   This work is licensed under a Creative Commons Attribution 3.0 Unported License.