Laika
Description
Laika (Russian: Лайка, "barker") is a simple script to monitor an RSS or Atom feed, and post to Yammer when new articles are detected.
Installation
Laika is delivered as a RubyGem:
sudo gem install laika
Usage
There are two steps you'll need to do to authenticate your application to Yammer. First, you'll need to register your application with Yammer. Log in to Yammer as the user under whose account the messages should appear. Then go to https://www.yammer.com/client_applications/new. You will be asked to describe your application. Fill out the form and submit it. This will provide you with a client key and secret. Make note of them as you will need them for the next step.
Then, you'll need to do the OAuth exchange, which will give you an access token and secret. Open up a terminal and run:
laika-auth
This will prompt you for the client key and secret you just obtained. It will then echo a URL which you will need to visit while still logged in to Yammer as the user from the previous step. You'll be asked to authorize your application. Click the Authorize button. Yammer will give you a four-character security code. Go back to your terminal, enter that code and hit Return. The script will then get the access token and secret from Yammer, and store all four pieces of information in a file called laika.yml. Don't lose this file! It constitutes the credentials that you will need to do anything useful with Laika. It is not encrypted, so keep it secure. Once you have the laika.yml file, you will not need to do these steps again unless you de-authorize the application.
Now you're ready to start barking about feeds. You can see all Laika's options by running it with the --help option:
$ ./bin/laika --help
Options:
--feed-file, -f <s>: File to store feed data
--credential-file, -c <s>: File with Yammer credential data (from
laika-auth) (default: laika.yml)
--url, -u <s>: URL of the feed to bark about
--dont-yammer, -d: Don't post to Yammer, just echo to standard out
--announcement, -a <s>: Announcement format. See the documentation
--help, -h: Show this message
The only 100% mandatory option is --feed-file, which is a YAML file to which Laika will write the feed data and the posts it has already barked about.
When running for the first time, you will also need to specify --url for the URL of the feed. You should not specify --url on subsequent runs unless you want to reset Laika's list of posts it has already barked.
--credential-file specifies the location of the file written by laika-auth. It will default to "laika.yml" in the current directory, but if it is elsewhere, you can specify it here.
--announcement lets you change the announcement text. The default text is ENTRY_AUTHOR just posted "ENTRY_TITLE" to FEED_TITLE: ENTRY_URL
, with the uppercase strings converted to the appropriate values from the feed.
Finally, --dont-yammer is useful for testing, or for avoiding spamming Yammer. It will send announcements of new posts to standard output, rather than to Yammer.
You will probably want to run Laika periodically from cron. When doing so, providing only the --feed-file option should be sufficient (unless you also need to specify a non-default --credential-file.)
License
Copyright (C) 2008 Mark Cornick of Viget Labs (http://www.viget.com/)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.