How I’m learning about APIs by building a Slackbot
Tags: beginners, python, wecoded, slackbot
Published: 2020-09-21 05:35:14

# Project Context
I have an HR background and with my experiences as an HR Partner in tech and banking industry, I see so much potential to improve the HR field with technology. Some areas to start with: communication, data management, data analytics, paperless process, automation workflow, knowledge management system and smart decision making using AI.

There have been so many great products to transform HR such as CultureAmp, Workday, Zendesk, Trello but I’ll say **“We can do more!”**.

I chose to build a **Slackbot** because a smart virtual assistant helps to improve productivity for both employees and HR team. For example, an employee is going to have a secondment wants to know about their journey (host-country’s culture, law, tax, company benefits, project details…). Traditionally, HR prepares lots of materials and training. But when employees want to check on certain things, either they have to read the materials again or ask HR again…and again. Both ways waste time and repeat communications.

Also, I finished my first project Eatthefrog, and it is a client-side web app. It runs on users’ browser and uses local storage to store tasks made by them, so it doesn’t “talk” to any server. With this Slackbot project (the bot’s name is **heybot** :), I will know how to answer those questions. Because I will:
1. Be a SERVER receiving/responding requests from a user (via heybot on Slack) aka CLIENT.
2. Be a CLIENT sending requests and receiving responses from a SERVER (BambooHR in this case).
3. Practice working with APIs

**So, what is heybot?**
heybot is a Slackbot that integrates with BambooHR, and it assists employees (1) to know information about their time off, (2) to request time off on BambooHR from Slack and get request update.

[Github repo](https://github.com/TotoroSyd/heybot)

# The Roadmap
This project is more complicated, so I broke it down to multiple versions. For each version (milestone), I have separated post to give you more insights about that version’s development story.
##### [>> Part 1: Hello World version](https://dev.to/totorosyd/how-i-m-learning-about-apis-by-building-a-slackbot-part-1-2hmf)
##### >> Part 2: Hello Galaxy version (coming up next)
##### >> Part 3: Final version (coming up next)

Here is the bird’ s-eye view of the project.
![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9f4erdy7kgp5t8z5mkij.jpg)

# Technology Choices
#### Python or Nodejs
While choosing Nodejs is a rational choice because I don’t have to face “environment change” issue and not to mention Slack API’s well-supported libraries and tools, I chose Python.

Inspired by Alexa, I want heybot to have conversations as natural as possible with a user, and it can “understand” the user’s intention/ request without fixed commands. Therefore, Python is a better choice. It has several popular and commonly used (Natural Language Processing) NLP libraries.

#### Flask vs Django
These are two popular frameworks for Python. According to some references [#1](https://medium.com/@SteelKiwiDev/flask-vs-django-how-to-understand-whether-you-need-a-hammer-or-a-toolbox-39b8b3a2e4a5), [#2](http://www.mindfiresolutions.com/blog/2018/05/flask-vs-django/#:~:text=Django%20is%20a%20full%2Dstack%20web%20framework%2C%20whereas%20Flask%20is,by%20providing%20the%20required%20functionality.), [#3](https://hackr.io/blog/flask-vs-django), and the fact that I don’t need to build a web interface for heybot, Flask is a suitable framework. It provides enough functionalities for me to run heybot. Also, [slackclient](https://slack.dev/python-slackclient/) — Slack Developer Kit uses Flask.

Thanks for reading!
Phoebe