-
Notifications
You must be signed in to change notification settings - Fork 23
Basic Windows Walkthrough to setting up your Slack Quizbot
First you need to create your Bot that will run the quizzes. Click your team name in Slack, then 'Configure Integrations'
Scroll down to bottom of the Integrations page and select Bots
Enter a name for the bot, we'll call it 'quizbot' here, then Add it.
Slack has now created the bot for you. Keep this page open as you'll need this unique API token in a minute.
Now you need to download and install Node from https://nodejs.org/en/download/. Choose the relevant download for your Operating system, here we're using Windows.
Run the download file and follow the default instructions to install Node.
Next, create a new folder on your computer, in this example I'm creating a SlackBotDemo folder inside my main Documents folder. Now right-click inside the empty folder and create a new empty text file.
Rename the newly created to quizbot.js. Then right-click on it and open it in Notepad.
Copy and paste the following text in:
var QuizBot = require('slackquizbot');
var myQuizBot = new QuizBot("_YOUR_SLACK_BOT_TOKEN_");
Replace _YOUR_SLACK_BOT_TOKEN_ with the unique API token from the Bot page. It should now look like this
You can now save and close this file. Back inside the SlackBotDemo folder, hold the SHIFT key down and right-click in the empty space. You should see an option in the menu 'Open Command Window here'
The following line will install the specific Node code and only needs to be done once. Type in the following and press Enter
npm install slackquizbot
Once that processes after a few seconds then you can start your QuizBot by typing the following and pressing Enter
node quizbot.js
Your window should look something like this
If it does then your Quizbot is running! You can confirm this by going into your #general channel and typing @quizbot list quizzes
and you should get a response telling you what quizzes are available.
To start a quiz type @quizbot start quiz general_knowledge
into the channel.
Because your Quizbot is now running locally on your computer, when you close the Command Window it will stop running. You can run your Quizbot again by opening a new Command Window open in that folder and entering node quizbot.js
again.
To have your QuizBot running permanently, you would need to install it on a remote server which is beyond the scope of this walkthrough :)
To add custom quizzes first create a new folder in the SlackBotDemo folder called data.
To create your quiz, use the Slack Quizbot Quiz Builder at http://codebyfire.github.io/slackquizbotbuilder/. Once you have completed your quiz and downloaded the JSON file, copy the JSON file into the data folder.
Restart the Quizbot and it should have your new quiz available to run, you can check with @quizbot list quizzes