How to Build a Slack Chatbot in 10 minutes with MongoDB Stitch
An Example MongoDB Stitch Slack Chatbot - Slash Command to Store URLs in MongoDB
Slack is not only the fastest growing startup in history, it’s app by the same name is one of those popular communication tools in use today. We use it extensively at MongoDB to foster efficient communications between teams and across the company. We’re not alone. It seems like every developer I encounter uses it in their company as well.
One incredibly cool thing about Slack (and there are many) is its extensibility. Writing a slash command, or a standalone bot app is incredibly easy but when you combine the power of MongoDB, and specifically MongoDB Stitch’s backend as a service, the combination enables you to build an incredibly powerful chatbot in minutes. Let’s create a Slack App that stores and retrieves interesting URLs. We’ll call this app URL Stash.
In this repository, we'll provide the source code for a MongoDB Stitch service function that handles integration with a MongoDB Database from a Slack slash command. For this simple example, we'll accept URLs from a slash command and store them in a MongoDB Database using a MongoDB Stitch service.
To read the associated blog article, visit this link.
Check out this video walk-through that may help you.
Importing the Sample Application
MongoDB Stitch enables you to export/import a pre-existing app. To do this, install the stitch-cli and create a .env file as follows:
export STITCH_API_KEY=<API_KEY> export STITCH_USERNAME=<CLOUD_USERNAME> export STITCH_APPID=<APPID>
Next, make the scripts executable:
> chmod +x deploy > chmod +x export