Sunday, January 10, 2010

Importing Twitter Friend Timeline into FileMaker

In the following article, I would like to demonstrate how you can use the twitter api to import your friends' timeline into FileMaker. We will come up with something like this:


We're going to use XML importing for this.
The fields we need in the database:

id
screen_name
text
profile_image_url (just for fun)


If you're not familiar with twitter api, and the xml it gives back please check this page first:

So, we can get the timeline xml with the following url:

http://username:password@twitter.com/statuses/friends_timeline.xml


(where of cource username is your twitter username and the password is your twitter password)

You can set other parameters as well (for example count: http://username:password@twitter.com/statuses/friends_timeline.xml?count=50 if you want the last 50 tweets)

But FileMaker cannot handle this xml yet.

We need an XSL file to convert it to a format that FileMaker can understant. It's a quite simple XSL I came up with. You can download it from here. (Be sure to download the file, not open it (right click- Save as - twitter2fmp.xsl)

We need to save this file somewhere, or upload it to a webserver. I chose the second method.

Now we can do the import script. It's quite simple as well, just one script step:

Import Records [No Dialog; http://username:password@twitter.com/statuses/friends_timeline.xml?count=50;http://website.com/twitter2fmp.xsl; Update matching; Mac Roman]

That's all.
The update matching is to ensure that no duplicate tweet is put into the tweets table.

Now you can create a simple list layout, or create a portal if you wish to display the the results.

I attached a sample file, which you can download here.
Please check it, and use this technique it if you like it.

Don't forget to fill your username and password!



Please visit our site, http://crm.fm which has our main FileMaker product, and support us by buying it. Thanks!

The material on this document is offered as is. There is no representation or warranty, expressed or implied, nor does any other contributor to this post. Consequential and incidental damages are expressly excluded. FileMaker Pro is the registered trademark of FileMaker Inc.