Slack chatbot integrations for the SOCless framework. Visit the SOCless framework tutorial on Slack integrations to get started https://twilio-labs.github.io/socless/tutorial-interacting-with-humans-via-slack/
- A Slack instance
- Permissions to create a Slack bot
- Socless Automation Framework deployed in an AWS Account
Setting up a Slack bot
This integration requires a Slack bot setup and configured. To setup a Slack bot:
- In a web browser, log into the Slack instance you want your bot to exist in
- Navigate to api.slack.com/apps and hit "Create New App"
- Enter a name for your application. The tutorial will use
- Select your development workspace. It should be the workspace you want your bot to be in
- Hit "Create App"
- On the "Basic Information" page for your app, click "Bots"
- Click "Add Bot User"
- Set a display name of your choice for your bot e.g.
- Set a default username for your bot e.g
- Set "Always Show My Bot as Online" to "On"
- Click "Add Bot User" again to save the changes
- In the left sidebar, select "Oauth & Permissions"
- Click "Install App to Workspace". Click "Authorize" to add the bot to your Slack Workspace
- Once authorization is complete, you will be redirected back to the "Oauth & Permissions" page, which will now display a "Bot User OAuth Access Token". Note this token down. Our integration will need this token
Tip: Consider configuring one Slack bot for each Socless environment you have. Doing so will simplify playbook testing
Configure Parameters in AWS SSM Parameter Store
Configure the below parameters in AWS Systems Manager (SSM) Parameter Store in the region(s) you plan to deploy your Socless Slack integrations
|Key||Value description||Parameter Type|
|/socless/slack/bot_token||Bot User OAuth Access Token from your installed bot||SecureString|
|/socless/slack/bot_token_user||A regular User OAuth Access Token for a Slack service user so that SOCless can run advanced tasks such as creating private channels||SecureString|
|/socless/slack/slash_command||The name you'll give the slash command for your bot e.g /socless-bot||String|
|/socless/slack/signing_secret||The signing secret for your bot found on the "App Credentials" section of the "Basic Information" page for your app||SecureString|
|/socless/slack_endpoint/help_text||Help text that your Socless Slack endpoints will respond with in case of failure e.g. "socless-bot experienced an error. Please contact the security team for assistance"||SecureString|
To configure the parameters,
- Log into your AWS Account in the regions(s) you're deploying socless-slack to
- In the left sidebar of the Systems Manager page, select "Parameters Store" (you may need to scroll down to see it)
- On the Parameter Store page, click "Create Parameter"
- Enter the name of your parameter
- Add a description for the parameter.
Type, select the appropriate type for the parameter being configured
- Under KMS Key ID, select
- Under value, paste the appropriate value
- Click "Create Parameter"
Repeat the process for all parameters that need to be configured.
Clone this repository to your projects folder using the command below
git clone firstname.lastname@example.org:twilio-labs/socless-slack.git
Change into the
socless-slack repository and setup deployment dependencies by running the commands below
npm install virtualenv venv . venv/bin/activate
(Optional) Ensure Your Dev/Prod environment matches your Socless Dev/Prod regions
Open the package.json and ensure your
scripts match what you have configured for your Socless deployment
Deploy to Dev and Prod
Deploy your application to dev and prod by running the commands below. To dev:
npm run dev
npm run prod
Feel free to deploy to any other Socless environment you have configured
If your Socless deployment is successful, you will see a URL that ends in
/slack in your
endpoints section. This is your
Slack Endpoint URL. Copy this URL. You will need it in the next section
Configure Interactive Components
- Return to the "Basic Information" page for your Slackbot on api.slack.com
- Under "Add Features & Functionality", click "Interactive Components"
- Turn on "Interactive Components" and turn on "Interactivity"
- In the "Request URL" section, paste your
Slack Endpoint URLand click "Save Changes"
Configure Slash Commands
- On the "Basic Information" page, click "Slash Commands"
- In the
Commandsection, type the name of the slash command for your bot. It should match what you configured in your SSM Parameter Store
- In the
Request URLsection, paste your
Slack Endpoint URL
- Fill out the
Usage Hintsections as desired
- Click save
Your Slack Bot is now completely configured for use within Socless
Slack App Permission Scopes
Bot Token Scopes
Scopes that govern what your app can access.
User Token Scopes
Scopes that access user data and act on behalf of users that authorize them.