The Quartz newsroom. Image courtesy of Quartz
Before the launch of business news site Quartz in September 2012, a blog post explained that anyone mentioning the site on Twitter would light up the newsroom.
Back in August 2012, Quartz senior editor Zach Seward shared the news of the Twitter bulb. He also explained that the Quartz newsroom light would flash when the Facebook stock price fell below $20 and, as it was during the Olympics, it was also set to toggle on and off each time China won a medal at London 2012.
This is an example of 'the internet of things' in practice, and involves a wifi-connected plug socket and IFTTT, a free tool for connecting the web.
Inspired by the Quarz light bulb, I decided to do the same and set up a red light that flashed each time someone mentioned the word 'mozfest' on Twitter. It was a busy hashtag during the Mozilla Festival last weekend.
You will need a WeMo, a wifi-connected switch made by Belkin costing around £34.99, an IFTTT account, and to create a RSS feed from a Twitter keyword.
Setting up an RSS feed is possible but not as straight forward as it was as Twitter switched off the API for RSS back in May. Having figured out how to do this, I'm sharing my solution.
1. Buy a wifi-connected switch
You will need a wifi-connected WeMo switch. (I use it so that my kettle comes on automatically at 7am, and so I can use my iPhone to switch on the kettle from another room.)
2. Sign up / login to IFTTT
You will need an IFTTT (if this then that) account. This allows you to connect elements of the web so you can, for example, save any photo tagged #mozfest on Instagram to a Google Spreadsheet, or receive an email or SMS every time an earthquake above 3.5 on the Richter Scale strikes California.
There is a WeMo channel, so you can create recipes such as to toggle a switch every time you receive an email, for example, or to do other pointless things such as to switch on the toaster when someone tags you in a photo on Facebook.
And as the New York Times has an IFTTT channel, it too can be connected. You could flash a light each time Obamacare is mentioned in a NY Times article, or turn on the coffee machine when there is a new vote in the US senate,
The Twitter channel only powers another IFTTT channel, such as a WeMo switch, when you tweet or carry out an action on Twitter. If you want your WeMo switch to toggle and therefore to flash a light when someone else does something, like mention of a hashtag or @handle, you need to use the Twitter API to create an RSS feed.
This is the slightly more challenging phase but hopefully this should help you.
3. Create an RSS feed using the Twitter API.
I found this video (below), by WorkWithNeilBall, particularly helpful. I strongly recommend that you use the video along with the following instructions to guide you through.
A. Create a Twitter app
You first need to go to dev.twitter.com
- Sign in with your Twitter account
- Go to 'my applications'
- 'Create new application'
- I called my 'SM RSS test'
- In the 'callback URL' field you need to write or copy and paste: https://spreadsheets.google.com/macros/
- Agree to the terms and enter the captcha code and 'create your Twitter application'
- You will need your 'consumer key' and your 'consumer secret'
- Click 'create my access token'
You will need a Google account
- Login and go to: https://script.google.com
- Click 'script as web app'
- Highlight and clear all code
- Now go to the code that powers my Twitter lightbulb and copy it over
- Rename the document
- You need to go back to your Twitter app and copy and paste your own 'consumer key' and your own 'consumer secret' into the relevant fields
You now need to work out whether you want to create an RSS feed of a keyword, hashtag or mention. Neil Bell's script is here, and you can see that he has an RSS for his own timeline, favourites, lists and a search for his name. You might want to take parts of this code, amending them with your own details.
My code tracks the keyword 'mozfest'. If you want to track a keyword, simply change the term.
Once you are happy with your keyword or account that you are tracking:
- Go to 'save'
- 'Publish' - 'deploy as web app...'
- Change 'who has access to the app' dropdown to 'anyone, even anonymous'
- Click 'save new version'
- Click 'deploy'
- The pop-up then provides the URL of your RSS feed
- Go to 'run' and 'start'
- Click 'accept', authorize', 'authorize app'
- Click 'run' then 'start'
- Now go to your Gmail and you will see a new email. Click the script link and you will see your RSS feed. I like to use Firefox for this
4. Add the RSS feed to IFTTT
Once you have your working RSS feed, it is now time to go to IFTTT.
Here is my recipe but it is probably easiest if you create your own.
- Go to 'this' and select 'feed'. Paste in your RSS feed copied from the email you received after creating the Google script
- Go to 'that' and select 'WeMo' and set it to toggle on and off
Now watch the light bulb flash. There will be a delay as the script only calls the API at intervals.
Do let us know in the comments section or by email if you set up a Twitter light bulb or another news-related alert using a WeMo switch in your newsroom.