Oni Apollo 0.9.2 with Twitter Anywhere support

September 30, 2010 by Oni Labs

We're pleased to announce the release of Oni Apollo 0.9.2. For the full list of changes please consult the commit history in our github repository.

The main new item in this release is the binding to the Twitter @Anywhere API, which allows you to access Twitter through OAuth without any intermediary server. E.g. to access your home timeline, you would write something like this:

UPDATE: Please note that as of version 0.10.0, Apollo's default modules have been externalized into the Apollo Standard Library. As a consequence, if you wish to include one of the standard modules (like 'twitter', below), you now need to prefix it with 'apollo:', e.g.: require('apollo:twitter');

UPDATE 2: As of early 2013 Twitter have shut down the @Anywhere API. This means that the code below will not work any longer.

<html>
  <head>
    <script src="http://code.onilabs.com/0.9.2/oni-apollo.js"></script>
    <script type="text/sjs">

      var T = require("twitter").initAnywhere({id:YOUR_API_KEY_HERE});

      T("body").connectButton();
      if (!T.isConnected())
        T.waitforEvent("authComplete");

      var tweets = T.call("statuses/home_timeline");
      console.log(tweets);
      // ...
    </script>
  </head>
  <body>
    ...
  </body>
</html>

For more info see the twitter module api docs. Also, @tomg has been working on a more complete twitter app scaffold which he'll unleash onto the world soon. Stay tuned :-)