I'm on a Mac, so I tend to write stand-alone shell/ruby scripts, and then just call them from TextExpander.
Now you've piqued my interest. Gonna have to play with this a little bit when I have time. I'll let you know what I find. :)
That's my issue at the moment, I did not manage to use XMLHttpRequest yet. I will also try to solve this and will keep you posted :)