Twitter API: Picking the Right Source

I’m sure you noticed that a few weeks ago Twitter changed the source that came unsigned via the API from web to API which could basically reveal any robot that is trying to act human, right? Well if you look at the statuses/update method in the Twitter API documentation they don’t say anything about the source parameter. Strange, right?

Well I read something about it on some forums and the Twitter API development talk Google Group had a discussion about this I believe, but most people still think that it’s the X-Twitter- headers that determine the source, but it’s not. It’s way too simple and it took me a few hours to figure it out using an HTTP sniffer on TweetDeck, Seesmic Desktop and the others.

Turns out it’s the source parameter that is passed via POST together with the status text during the statuses/update call. So usually you would do something like:

$postargs = array("status" => "I'm tweeting via API!");
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);

Now, how about Seesmic Desktop?

$postargs = array(
    "status" => "I'm tweeting via Seesmic Desktop!",
    "source" => "seesmicdesktop"
);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);

Or TweetDeck perhaps?

$postargs = array(
    "status" => "I'm tweeting via TweetDeck!",
    "source" => "tweetdeck"
);
curl_setopt ($ch, CURLOPT_POSTFIELDS, $postargs);

Pretty cool, huh? Here’s a brief list of sources to pick from:

And I do believe that it’s the same way for all the other clients. Lowercase and no spaces. It is funny though watching a robot tweet 10 tweets per minute via TwitterFon ;)