Skip to content
Kyle T edited this page Feb 8, 2021 · 5 revisions

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.

1. Create a Slack App

Visit your apps on the Slack API website, and click Create New App.

Create a new slack app

It is helpful you name your application CircleCI or CircleCI-<modifier>

Then select which Slack workspace in which to install this app.

2. Permissions

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)

Create a new slack app

Note: In order to receive slack notifications in a private channel, you will need to add your slack app to the channel.

3. Install and Receive Token

Finally for the Slack settings, install your application into the Slack workspace and retrieve your OAuth Access Key.

Slack OAuth Tokens

Slack OAuth Access Token

4. Create a Context on CircleCI

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

Slack Context environment variables on CircleCI

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.