Saturday, March 6, 2010

Putting Technology to Everyday Use: Twitter

I’ve already discussed Twitter on this blog and on my other other blog (Scriptzilla), but I wanted to describe a process I’ve been using to keep control over my home network even while I’m out and about.  The Twitter API provides a robust set of tools for reading, composing and managing tweets and direct messages (aka “DM’s”).  The meat of this is in their API Documentation and can be leveraged with almost any existing scripting or programming language.

I posted a few examples for how to read and send Twitter DM’s for Windows computers using VBscript.  You can just as easily do this with KiXtart or PowerShell (but not as directly), and tie your processes to events such as logons, startups or event-triggers or whatever. I use UberTwitter to manage my home network from afar by having it send me event DM’s and listening for my commands.  You can use any mobile Twitter client or web/desktop Twitter client however, even the Twitter web site itself.  How you get there is irrelevant.  A mobile client on your smartphone is the ideal way though.

For example, I can tweet (DM) my server’s Twitter account to do a “hand-in-the-face” for one of my kids when they step out of line (skip chores, skip homework, act disrespectful, letter sent home from school, etc.).  The workflow is something like the following…

tdm_flowchart 

The third block in this flowchart is actually multiple steps.  They are described more thoroughly in my other blog posts.  Basically that “block” involves a scheduled task that keeps a watch on the Twitter DM inbox, looks for specifically formatted messages, parses the message for specific phrases that indicate coded instructions (you make that up as you see fit), and executes a corresponding script action to do the work.  Then the computer deletes the DM (so that it doesn’t keep reading it every scheduled cycle), and (optionally, but recommended) the computer sends a DM confirmation back to my other Twitter account, letting me know it got the instruction and processed it.

The key to this process is careful planning, setting up, testing, testing and more testing and then making sure everything is locked down securely.  Make sure you set your computer’s Twitter account as private (locked) and it only follows your regular (human) Twitter account.  You have to follow your computer’s Twitter account also (and have it accept the request), so you can exchange DM’s.  If you use “tweets” instead of DM’s, you’ll be leaving yourself wide open to hacks and accidental catastrophes.

If you find this stuff interesting or useful, post a comment and share your thoughts.

No comments: