Solving a personal problem building a bot

In my last job, I had a small dilemma every day; my work was too far from my home nearly 22 kilometres, so there were many possibilities to reach there, consequently several ways, by train, subway or bus, even by each one of these alternatives there were numerous forms to combine.

My usual choice was to go by train or subway; the São Paulo rails system isn’t so complicated like Paris, New York or Madrid, I’ve been in all these cities and could check by myself its rails systems, it seems an intricate spider web of too many connections. Below you can see the São Paulo underground and train map.

Train and subway system of São Paulo, Brazil

Leaving me with two routes’ combinations:

Route A (Image from Moovit)

Route B (Image from Moovit)

So, Bruno, what is the point if you have two options available? The public transport in São Paulo sometimes can be chaotic mainly when a problem arises in the subway or train, literally the whole city stop, but it is impossible to predict when and where. I needed in somehow to be alerted when it happens and go to the plan B, whether something goes wrong with the route 1 or 2.
My former job mate Walter gave me the insight. He developed an Android App named as Waaka, which shows the condition of the transport public in São Paulo, although it was an excellent app was lacking an important feature for me, an automatic alert.

Then I’ve decided to build a Telegram Bot with the same objective; this Bot had the responsibility to check the transport condition status every 15 minutes and warn me if something was wrong as soon as possible, giving me the time necessary to pick another route.

My primary skill as you probably know is in PHP, but for this mission, NodeJS and its event loop seemed more fittable. Then my stack, as database the choice was MongoDB, Moongose for object modelling and Mocha for Unit tests; but the main Npm package for sure was node-telegram-bot-api with pretty simple samples I hadn’t difficulties to start my project, the team was complete.
To manage the process and keep the application running I used the Pm2 which has an internal load balancer; it allows to maintain the application alive forever.

The final point was to retrieve the information from the public transport; actually, this was the easiest part, because as mentioned earlier, my colleague had built an Android app, then I asked for him to share the API with me, my job here is only using the same end point for my bot. As retribution, I named the bot after his app Waaka, so the name was “WaakaBot”.


It was funny to build this telegram bot and to know more about some resources from this fantastic app which is in my humble opinion much better than its rival and market leader WhatsApp. The WaakaBot unveils to be tremendously useful for my daily routine, and I’ve decided to share it in the telegram store for everyone. However, a couple of months ago, I’ve chosen to move to another company closer to my home, which even allowed me to go by bicycle and now I hardly ever take train or subway. My new destination does not kill the bot, which remains alive and on standby just waiting for giving any help in this troubled and complicated city.


WaakaBot on Telegram store:
Waaka for Android: