Skip to content

andreffs18/santosbot

Repository files navigation

Slack Bot that spits out quotes from Gustavo Santos whenever a *Trigger Word* is written.

Built with ❤︎ by André Silva

Installation

To run this locally you just need to have docker installed.

Make sure you export your SLACK_API_TOKEN. More on that can be found on the /bot README file.

$ export SLACK_API_TOKEN=xoxb-*****

Usage

This project is divided into 3 parts:

  • Backend API: Python ASGI web server that exposes an web API for getting quotes.
  • Frontend App: VueJS app that helps to showcase bot functionality.
  • Slack Bot: Actual slack bot that you can run to interact with.

By running with $ docker-compose up you instantiate all 3 services, which then can be accessed on a browser (http://localhost:8080).

If you configured the SLACK_API_TOKEN then you should also be able to use the bot on your Slack team account, out of the box! 📦

Instructions on how to run each service separately can be found in each service folder.

Deployment

This project is hosted on Heroku, on just one dyno!. Yup, 3 apps, different languages, one dyno. You can check it on https://santosbot.herokuapp.com.

The structure is pretty simple:

  • There is an nginx app, working as reverse proxy, that redirects all requests to the frontend app;
  • All "/api" request are proxied to the backend server;
  • The actual bot is just running on a different process, and connects to my slack account using slack RTM library (yup, I have this live, working, just for the sake of it)
  • Every process was started by honcho (foreman port to python) to bypass the number of dynos restriction on heroku.

There is actually a blogpost explaining how I achieved that, so you might just check that out 😄.

If your curious commit 462b27a added all necessary files to make the app public, via heroku.