Demo of a Slack bot app with "Add to Slack" button, using Botkit, Express and MongoDB
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
app correct mongodb uri Jun 3, 2016
config first commit Feb 8, 2016
node_modules bump botkit Sep 11, 2016
public/images first commit Feb 8, 2016
views first commit Feb 8, 2016
.env-example add .env-example Feb 16, 2016
.gitignore first commit Feb 8, 2016
README.md add .env-example Feb 16, 2016
package.json bump botkit Sep 11, 2016
server.js first commit Feb 8, 2016

README.md

Botkit demo using Express and Mongo

The folks at Botkit have done an amazing job at building a framework for (Slack) bots applications. They have included an example of creating a Slack app that can be installed with just an "Add to Slack" button, as well as an adapter allowing to use MongoDB for storage.

However, the example used Botkit's webserver to manage requests such as authentication, but also serving webpages. Instead, I wanted to use Express.

Features

  • Serves webpages through standard express routes app/routes/routes.js

  • Uses Monk as MongoDB driver

  • Includes by default the three Botkit collections : Teams, Users, and Channels

Configuration

First, create a Slack app. You'll get your app ID and Secret, and you'll be able to enter authentication redirect URL. To be able to use the app both on a local machine and in cloud hosting, enter two URLs:

http://localhost:5000/
http://yourwebsite.com/

Then, you need to set up several environment variables before using this app.

  • For local deployment

Create a .env file at the root of the project with the following infos (you can modify and rename the existing .env-example file:

SLACK_ID=your.id
SLACK_SECRET=yourslacksecret
SLACK_REDIRECT=http://localhost:5000/
PORT=5000
  • For Heroku deployment

You need to add from the Heroku dashboard the SLACK_ID, SLACK_SECRET and SLACK_REDIRECT (set it to your website root).

You can use MongoLab add-on to add Mongo storage, they have a free tier.

Author

Matthieu Varagnat

Licence

Shared under MIT licence