Blog

Search This Blog

Loading...

Tuesday, June 14, 2011

Post Twitter Updates to HipChat using SimpleWorker - No Server Required

We use HipChat for internal communications at SimpleWorker and one of the great things about it is that it has a nice API allowing you to do some cool things like post messages to a chat room programmatically. One thing I wanted to be notified about was when someone mentioned SimpleWorker on Twitter and what better way to do that then to schedule a worker to check Twitter every day (or hour) and post results to our HipChat room.

So 20 minutes later, I was done and running in the cloud. The beauty of this is how easy it was to write the worker to do what I wanted and then schedule it to run every day using SimpleWorker's built in scheduling.



Then to schedule it to run every day, I simply call:

tw.schedule(:start_at=>1.days.from_now.change(:hour=>3), :run_every=>24*60*60) # to have it recur every day

You can get the full source code here. Just clone it, change the config.yml and run enqueue_worker.rb to run it for yourself.

So simple. So elegant. No servers required. And did I mention how simple it is?