Creating a ChatBot with BotMan
Last month I was interested in all this chatbot thing, specially in the features Google Allo has. In that messaging app, you can set a reminder to get notifications about the weather daily in the morning, or to receive jokes / fun facts at specific times.
I had a problem every day with my city bike system. The nearest station from home is used by a lot of people, and some morning there are no free bikes when I arrive there, so I need to walk to the next station (and reach late at work because I'm a lazy person and I always leave home at the last possible moment
So I thought:
What about a bot that tells you every morning the number of free bikes at a preferred station?
I checked the website of the city bike's company but it’s difficult to use from the smartphone. I needed a better way to know the information of the station every day.
I follow Marcel Pociot on Twitter for almost two years, so I decided to check what BotMan is about since I saw a lot of tweets mentioning it. It is a PHP framework to create bots in an easy way, and also installable in a Laravel app, it was the perfect solution for what I wanted to do!
A month later, I have a chatbot currently running in production and telling me each morning the number of free bikes my station has, telling me the same information about the station near work from monday to friday. I went a bit further and added a bunch of cool features:
- You can share your location and the bot will show you the 3 nearest stations with a link to Google Maps to get directions (don’t worry I’m not storing that information and selling it to local companies).
- You can create aliases for a station so that it is easier to ask for information. There are 19 stations right now and it’s difficult to remember all the names, so you can create aliases like
hometo ask for information about a specific station.
- I added some travel information. For example
from gym to homeand it will show you the availability of the two stations and the distance between them (just in a straight line, sorry guys I’m not Google
- You can define a station as a preferred one, so every time you say
hellothe bot will show you the information of that station. It can’t be quicker in my opinion
Reminders are customizable for specific days of the week or timings, and you can choose between getting information about free bikes or free parkings. They are sent using Laravel Task Scheduling feature. It’s amazing how simple it was to have it running.
This is my most enjoyable hobby project. I’m still adding features to it and planning to talk about it with other bike users. My girlfriend is already using it and has some great ideas to add as future improvements.
If you’re curious about building a chatbot or how they work, don’t hesitate to check BotMan’s website or send me a tweet, I'll help you as much as I can.
I also want to mention Matt Stauffer for his great talk at Laracon Online 2018 about side projects and enjoying what you do (You can get access to this year’s videos for just $25 (20€). I saw it live and I totally recommend watching it.
You may also like: