DEV Community

Miko 👾
Miko 👾

Posted on

My First Chatbot - A random dog & hobby generator for quarantined boredom

What I Built

Category Submission: Interesting Integrations

A lot of people are really bored during quarantine and are running ideas of what to do! Therefore I came up with the idea of creating an SMS chatbot that people could text and get a random hobby idea back. It was hard to google the wording for such an API, so I did some digging online and found a txt file containing over 600 random hobbies.

I also added a random dog generator using the dog API given the tutorial I was following generated random photos of cats, but lately photos of dogs have been helping me during this time so I thought they'd be nice for someone else too!

Demo Link: https://gph.is/g/E0nDyPy

Link to Code: https://github.com/KDJ1221/Twilio-Hobby-Bot

How I built it (what's the stack? did I run into issues or discover something new along the way?)

I've recently just began my new journey of using web frameworks and APIs and have had an interest in how to build a chatbot, so I followed Miguel Grinberg's Twilio API tutorial and set up a base project that I soon "remixed".

I used Python, the Flask framework, Twilio's SMS API and helper library for Python, and ngrok to connect the Flask app and Twilio.

I ran into some issues during the initial setup of the app, such as terminal errors with Flask and ngrok when in the virtual environment given a lot of dependencies were not installed yet (I'm also new to using virtual environments, they're actually really useful!)

Additional Info

Although it is my first chatbot, there is definitely room for improvement for the future. For instance, if I had used an API for hobby generation I would have been better able to filter out what hobbies should be sent. With my implementation anyone can get otherworldly hobbies they can't do right now such as alpine skiing or backpacking, etc.

Something else I intend on investigating is finding a replacement for ngrok. Sessions only last 8 hours, which isn't really enough time to have a lasting app for others to test! Would definitely appreciate any advice on this!

Top comments (0)