The team-info bot is a hook.io Javascript microservice that scrapes data from The Blue Alliance and posts it into slack channels.
Here's an example of the data returned by the bot:
team-info BOT [3:49 PM]
@pchild, here's your info:
Team 401 - Copperhead Robotics
Overall, team 401 was 38-22-0 in 2016.
http://www.thebluealliance.com/team/401
All code for the bot is available in the team-info file, and the rest of this README will cover setting up the bot on your own slack team.
- Go to hook.io
- Create an account
- Create a new hook
- From your hook main page, click 'Create Hook'
- Name your hook
- Make sure the selected language is set to JavaScript
- Paste in the text of the team-info, or use the provided Gist.
- Click 'Create new Hook'
- Scroll to the 'Service URL' section, and copy the 'Home' URL for use in slack
- Custom Integration Setup
- Go to https://slack.com/apps/build
- Click 'Make a Custom Integration'
- Click 'Slash Commands'
- Set your desired command (we use /team)
- Click 'Add Slash Command Integration'
- Slash Command Settings
- Set the URL for the slash command to the Home URL copied from hook.io
- Make sure the slash command Method is set to 'POST'
- Copy the Token for use in hook.io
- Customize the name, icon, help text, and label of the command.
- Click 'Save Integration'.
- Custom Integration Setup
- Go to https://slack.com/apps/build
- Click 'Make a Custom Integration'
- Click 'Incoming WebHooks'
- Default Channel
- Select a default channel for the bot (overriden as needed)
- Click 'Add Incoming WebHooks integration'
- Setting up the bot
- Copy the WebHook URL for use in hook.io
- Set up the label, name, and icon for the bot
- Click 'Save Settings'.
- Go to https://hook.io/env to setup your environment variables.
- Click 'Add new Key'
- Name your new key 'team_url'
- Set the value as the WebHook incoming URL you copied from slack.
- Click 'Add new Key' again
- Name the second new key 'team_token'
- Set the value as the slash command token value you copied from slack.
- Click 'Save Hook Environment Variables'
You should now be able to invoke the slash command /team #### in any message or channel on slack and have the bot report the team name, record, and a link to their page on TBA!