-
Notifications
You must be signed in to change notification settings - Fork 205
Setup
The Slack Orb is an "application" that executes as a part of your job on CircleCI. In order to receive notifications, we must authenticate our application.
Visit your apps on the Slack API website, and click Create New App
.
It is helpful you name your application CircleCI
or CircleCI-<modifier>
Then select which Slack workspace in which to install this app.
On the next page you may select from different features to add to your app, we will select the "Permissions" area, where we will add "scopes", which will give us the proper permissions we need for our Slack application.
The Slack orb only requires the ability to post chat messages and upload files so we supply these three Oauth Scopes:
Method | Reason |
---|---|
chat:write | Post to Slack (bot must be invited to channel) |
chat:write.public | Post to any channel |
files:write | File uploading (Not yet used, check for updates) |
Note: In order to receive slack notifications in a private channel, you will need to add your slack app to the channel.
Finally for the Slack settings, install your application into the Slack workspace and retrieve your OAuth Access Key.
A context is a storage container for a bucket of environment variables. We can attach multiple contexts to a job and restrict access to certain contexts if needed.
See: Using Contexts
Create two environment variables within your context:
Env var name | Value |
---|---|
SLACK_ACCESS_TOKEN | The OAuth token acquired through the previous steps. |
SLACK_DEFAULT_CHANNEL | If no channel ID is specified, the Slack orb will attempt to post here. |
You can easily obtain the Slack channel ID by right clicking, and copying a link to the channel. The ID will be visible at the end of the URL.