Keep Canada Working Twitter bot

Auto-responding Twitter bot

All development

  • web
  • back-end
  • Twitter API
  • ES6
  • Node.js
  • Heroku
  • Tribal

The idea behind this bot is that it tweets about the amount of money Keep Canada Working thinks Canada has lost in opportunity cost since work on the Trans Mountain pipeline was halted. It automatically tweets hourly with an update on the running total, and daily with the number of days since work halted. Additionally it tweets three times a day with a related message. All of these tweets are scheduled with Heroku’s scheduler addon.

The more interesting part is that it uses Twitter’s streaming API to constantly listen for its own username. When someone mentions the bot, it immediately replies to that user with an updated total.

This was very simple to do, and I finished the bulk of it in around half a day. It then took another day or two fine-tuning and accommodating change requests. By far the longest part of the process was waiting for developer account approval from Twitter!

The bot isn’t yet public; I’ll add a link once it is.