Skip to content

Slack Bot with NLP

Overview

This is a very basic slack bot that can be used as a building block to develop more complex bots. It uses the NLP package for message understanding. It's in its alpha phase but can currently be used as a template to train it yourself.

Deep Dive

Layout

|-- features
    |-- dialogs
        |-- something-dialog.js
        |-- unknown-dialog.js
        |-- welcome-dialog.js
    |-- direct_message.js
    |-- slash_commands.js
|-- nlp
    |-- categories
        |-- greeting
    |-- test.js
    |-- train.js
|-- bot.js

The features folder contains main logic for the bot. The files directly under it handle the functions they are named after. For example, direct_messages.js contains the logic for the direct message event. The dialog folder contains the dialogs that are started from the direct message event.

The nlp folder contains the bot natural language understanding. The files directly under this folder are used for creating and testing the model that is generated. The categories folder contains files to train the model on. The files are named after the classifications you want the bot to know. For example greetings contains basic words and phrases that correlate to the greetings classification.

How To Use

Development

  1. npm install
  2. copy the .env.example file to a new file named .env and add your slack bot credentials. More info on creating a bot
  3. npm run dev

Publishing:

  1. npm install
  2. copy the .env.example file to a new file named .env and add your slack bot credentials. More info on creating a bot
  3. npm start

More Info

For more info, please reference the GitHub repo!. It will contain the most up to date information on the application.


Last update: November 26, 2020