Flight Bot: A chat bot to avoid a minor annoyance
Tags: chatbot, azure, programming, showdev
Published: 2021-11-10 15:52:53

If you learned something new feel free to connect with me on [linkedin](https://www.linkedin.com/in/albert-bennett/) or follow me on dev.to :)<br/>
Hi there and welcome to another one of my blogs.
This time I'd like to talk about a project that I had built for a Hackathon that was being hosted at work. The theme of the Hackathon was open, I mean there was a few category's to choose from to get some inspiration but.. . I decided to go my own way with it via the open category.<br/>
**The Projects Backstory**
The tldr version is that I had tried to book flights a couple of years ago to go to visit Bran's Castle in Romania for Halloween and had gotten frustrated with how many sperate flight finding websites that I needed to search to book a flight. Up to that point I hadn't ever booked a flight and had gotten overwhelmed with the amount of choice, in the end I decided not to go.<br/>
**Project Demo**
Here is the flight finding bot in action (links to demo video)!
[![flight bot demo video](https://img.youtube.com/vi/mP-Vg0ME1so/0.jpg)](https://www.youtube.com/watch?v=mP-Vg0ME1so)

And the github links for the curious:
Project repo:- https://github.com/Albert-Bennett/flightbot
API repo:- https://github.com/Albert-Bennett/FlightBot.DatabaseSeeding
<br/>
**Project Tech Stack**
Here is a list of what I had used to get the project working:
- The Microsoft Bot Framework (used to build the bot and conversation model)
- luis.ai (used to extract data from the users free text, although given the use case for luis in the project was limited it was still better that trying to parse the string manually)
- geonames API (used to search for a airports close to the users location and used to confirm search results. Alternates to this was the google maps api but, anyone could register as an airport on it so... I didn't use it)
- Amadeus API (the API that was used to find the flights, originally I had planned to use the skyscanner API but, they wouldn't let me access it)
- Azure SQL (used to map IATA codes. IATA codes are surprisingly hard to get a hold of and seeing as how I needed to use the geonames API to search for airports it didn't make much sense to not create a DB to hold those mappings. Also, there was a lot of APIs about there for searching for IATA codes but, a lot of them didn't have a free trial period)
- Azure Functions (used to create an API to update the IATA DB and also to search for IATA codes based on geoname id, name, location or IATA code (just in case someone wanted to search for a location based on IATA code))

**Challenges**
The main challenge of this project was that part way through it my partner showed me an app for booking flights and how easy it was to use. It was a flight comparison website using the Amadeus API as well. It made me rethink the design of the chat bot, as well as a target audience for something like this. I think as programmers it is easy for us to take for granted how much of an advantage being tech savvy is, a previous role of mine training people to use computers at an employment center really made me appreciate how much more accessible the world is to us. Take someone like my mum for a moment, she is 65 years old, she has a phone and all she can use it for is making calls, taking pictures and on occasion accidently hang up on someone before getting frustrated by the amount of options that she has been presented with and struggling to figure out what had happened. 
I'm not trying to put her down here. She tries her best but, it is not what she is use to. As such I thought the advantage of using the format of a chat bot over an application is in its simplicity, it's straightforwardness so to speak. In my opinion a chat bot can be made much more accessible to the less tech literate by directing them toward a singular goal, presenting them with very straight forward questions and acting on their fallibility with follow-ups to the inputs and re-affirmations such that they don't get lost in the process. Although accommodating for something like this was much more work then what I had originally planned. State management was a particular pain point given how the flow of a more conversation heavy application needs to be able to remember certain parts of information and yet be able to go back to a previous state of the conversation.<br/>
Let me know what you guys think below I'd like to hear about what opinions that you have around the topics of chat bots and accessibility.
Thanks for reading my blog post.