Sync to Slack
Variable History can notify people of variable commits by sending messages to a Slack channel. Follow the steps to enable this feature:
Set up Slack
We need to first create a Slack App and grant it permissions to upload files and send messages:
1. Create a Slack App
- Visit https://api.slack.com/apps (opens in a new tab), Click "Create an App" to generate a new Slack App.
- Select "From scratch", give your app a name (e.g. "Variable Bot") and pick a workspace you have admin access to.
- Click "Create App" and the browser will navigate to the app's settings page.
2. Configure permissions and get a bot token
- Click OAuth & Permissions on the left sidebar.
- Go to Scopes > Bot Token Scopes and add the following scopes:
files:write
files:read
chat:write
- Go to OAuth Tokens and click Install to {Your workspace}.
- Allow installation and you will get a Bot User OAuth token.
3. Add the app to a channel
- Go back to your Slack workspace and the app should already be in the Apps list.
- Right click the app, click View app details to open the detail dialog.
- Click Add this app to a channel and select a channel to send messages to.
Set up Variable History
- Go to Settings > Synchronization and click Add Sync Task.
- Select Slack to add a new Slack sync task.
- Fill in the channel ID, bot token and a file name. Save the sync task. (To get a channel ID, right click a channel, select View channel details can scroll down to the bottom of the detail modal.)
You're all set! When you commit changes, the plugin will send commit information and a compiled CSS file to the Slack channel.