The Trainline app introduced a new feature a while ago where it asks you whether there are any free seats on the train that you're on. I thought it would be an interesting idea to do something similar for ticket barriers at stations.

What it does

It's a Telegram (similar to WhatsApp) bot which checks whether ticket barriers are open at stations based on user data. Go and chat to it to find out the commands.

How I built it

Started out wanting it to be a Messenger bot, but ended up using Telegram instead. It's written in Node.js and stores all its data in Redis. I found the data for all the station codes online - somebody managed to get access to the National Rail API and just dumped all the data.

Challenges I ran into

Messenger bots are required to be approved. There's no way they'd approve this! So I switched to Telegram.

Accomplishments that I'm proud of

I keep learning new cool things about Redis! Most people only use it as a cache of some sort, but I'm loving it as my primary data store. I quite enjoy working around its limitations.

What I learned

Messenger platform, for all the hype surrounding it, is actually a bit rubbish.

What's next for Gatesopen

I'd really like to incorporate some kind of ML to learn which stations usually have their barriers open at a specific time of day. I think it would also be cool to work in some natural language processing so that conversations with the bot become a bit more human.

Share this project: