A Slackbot that searches genius.com.
This Slackbot that receives input through a slash command and sends a request to an API.
A detailed tutorial about how I built this is on Medium: https://goo.gl/wDyayI
Clone the repo and then install dependencies:
git clone [email protected]:mager/slack-genius.git
cd slack-genius
npm i
Setup the server (I used Heroku):
heroku create my-slackbot
Set Heroku environment variable for Genius access token:
heroku config:add GENIUS_ACCESS=[your Genius access token]
git push heroku master
Setup Slack slash command:
- Goto
http://[your-slack-team].slack.com/apps/manage/custom-integrations
and add a slash command. - Fill in the fields:
- Command: the name of your slash command (ex:
/genius
) - URL: The URL to request when the slash command is run (ex:
https://my-slackbot.herokuapp.com/post
) - Method: POST
- Customize Name: The name of your Slackbot
- Customize Icon: A custom icon or an emoji
- Autocomplete help text: Helps users when they start typing
/
- Descriptive Label: Provides extra context
- Command: the name of your slash command (ex:
In Slack, send slash commands to /genius:
/genius Kendrick Lamar Poetic Justice
The MIT License (MIT) Copyright (c) 2016 Andrew Mager
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.