Code Challenge 43 – Build a Chatbot Using Python

By on 9 November 2017

It’s not that I’m so smart, it’s just that I stay with problems longer. – A. Einstein

Hi Pythonistas, it’s incredible to think how quickly bots have grown in popularity. They’re everywhere these days and will play an important role how we work and communicate in the near future! It’s about time we go our bot on as well!

We even happily buy a book on chatbots for the Pythonista with the most original submission (and no, bots won’t vote for it, PyBites humans will!)

The Challenge

It’s simple. Create your very own bot!

The bot can do whatever you want. The aim here is to have a functioning bot written in Python. Stretch yourself, wow your colleagues and friends, this is a cool skill to add to your toolkit.

Here are some ideas to get you started:

  • Create a Slack bot that automates a boring task: help scheduling your team lunch, or meetings like Amy does (although we really hope you are on a maker’s schedule). You can build an interface to have a bot respond to commands, or even learn from conversations. The possibilities are endless. We built a karmabot and when it goes offline we get anxious 🙂

  • Make a Facebook Messenger bot that responds to specific customer/user requests. Or have it auto-post new items of your blog feed to a group or page, watching for reactions or comments. Need inspiration? See Mike Yusko’s Bot-Chucky which interacts with various other services.

  • A monitoring bot that reports changes in the weather or stock/share prices and posts them to say TwitterTwitter bots are pretty easy to build.

  • Think about making a bot for your favorite messenger service: Whatsapp, Telegram, Signal etc. How can you add value to these platforms? Business best practice: doing 5 minute callbacks whenever you get a new lead. source – there’s your bot!

  • Those are a few examples, as with any programming task, think about opportunities to automate boring stuff, pain points, where businesses fail and start designing a solution.

Bonus

If you’ve conquered bots already, consider adding further functionality to your bot. How about a bot that takes a command and uses another API? Eg: A specific event or command will tell your bot to tweet something.

Can you leverage AI (artificial intelligence), NLP (natural language processing) and/or ML (machine learning) technologies? Watch out though 😉

Penalty

On that note you will lose points if you create Skynet. Unless of course you also create a T-800 Model Terminator, then it’s okay… sort of.

Win a copy of “Designing Bots”!

We are really excited about this one. Not convinced yet? OK, we will personally send a copy of Designing Bots: Creating Conversational Experiences to the coolest PR (voting to be done by us and our Slack community).

3 conditions need to be met though:

  1. There must be at least 5 PRs submitted for this challenge (excluding Bob/Julian), otherwise it is not a competition. – update: nah … bots are cool, specially in Python + PR’d to PyBites, the more the merrier, but the best submission gets the book, regardless the number of PRs 🙂

  2. It must be your own code which you developed during this challenge, be cool, no shortcuts.

  3. The solution must be original and working Python code, so please include install instructions so we can easily test it out.

Submission deadline: 1st of December 23:59:59 CET.

Resources

A few (Slack biased – we just love their API) resources to help you get started if you’re really stuck!

PyBites Slack

You like these challenges? We have published quite a few and we’re not planning to stop anytime soon.

You really like them and plan on PR’ing more in the future? Then consider joining our private Slack channel sending us an email. This way you get the unique opportunity to learn from other passionate Pythonistas and share some of your experience.

Credit

You can PR your work to our Community branch of our Challenges repo. We will include it in our review post. Our PR template also lets you reflect a bit on your learning and provide some feedback how we can keep our challenges interesting. See detailed instructions here.

About

Our goal is to learn and teach you Python through practical exercises. Learning a programming language is way more fun as a community!

For any feedback, issues or ideas use GH Issues, tweet us or drop us an email.


Keep Calm and Code in Python!

— PyBites

Want a career as a Python Developer but not sure where to start?