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 gym or home to ask for information about a specific station.
  • I added some travel information. For example from gym to home and 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 hello the bot will show you the information of that station. It can’t be quicker in my opinion 🙂.

Example of the bot

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:

Found a typo? Edit this post.
Special thanks to Dieter for the amazing code of this blog.

Got any hints?
No, I'm afraid not.
However if you search within yourself, then...
Cut it out, ok?
I asked for a hint not the crazy philosophies of a Father Christmas look-a-like.
Heed my words, bold adventurer, and your path will lead to wisdom and..
There's just no reasoning with him...
I'm totally stuck as what to do.
I really wish I could help you but I'm just a clueless old fool.
Never a truer word was spoken.
Still clueless?
I'm afraid so.
Still look like a Father Christmas?
I'm afraid so.
Good.
Calypso from Fleur de Lys Simon The Sorcerer