Slack Integration

Updated 5 days ago by Michael Katz

With the Slack integration described here, your authorized Harness users can approve or reject Workflow steps and Pipeline stages directly from Slack. This topic outlines both Slack and Harness setup, in the following sections:

To configure Harness notifications to Slack without enabling deployment approvals from Slack, see Add Collaboration Providers: Slack.

Intended Audience

  • Account Administrators
  • Developers

Create Slack App

To begin, you must create and configure an app in your Slack developer account at https://api.slack.com. For details on these steps, see Slack's Incoming Webhooks documentation:

  1. Name your app, assign it to a Workspace, and select Create App.
  2. Select Incoming Webhooks.
  3. Enable the Activate Incoming Webhooks slider:
  4. Click Add New Webhook to Workspace.
  5. At the Confirm your identity challenge, select the Slack channel in your organization that should receive approval notifications. (To select an appropriate channel, see Configure Harness User Notifications below.)
  6. Click Install (or Authorize) to confirm this setup.

Configure Harness API Endpoint in Slack

Next, configure the API endpoint from Harness for interactivity, as follows. (For details, see Slack's Making Messages Interactive documentation.)

  1. Select Interactive Components.
  2. Enable the Interactivity slider:
  3. Enter the Request URL, as either http or https. The Request URL is independent of the approval channel that we'll configure below.

    Harness SaaS users should enter a URL of the form shown above:
    https://app.harness.io/gateway/api/slack/approval?accountId=<accountID>

    On-prem users will instead have a URL of the form:
    https://<your-domain-name>.harness.io/gateway/api/slack/approval?accountId=<accountID>
  4. Click Save.
  5. Return to the Slack app's Incoming Webhooks tab.
  6. From the resulting app settings, copy the Webhook URL to your clipboard.

You've now configured API endpoints in both your Slack app and Harness. Now, you're ready to set up notifications for the Harness User Group, and the Slack channel, where you want to enable approvals.

Configure Harness User Notifications for Slack

Enabling Slack notifications in Harness is straightforward, but there are some important considerations:

  • Select a Harness User Group that has appropriate permissions. (These permissions must include Application: execute permissions on all relevant Applications.)
  • You must create a Slack channel that has the same members as the User Group.
  • You must manually keep the Slack channel's membership synchronized with the User Group's membership.
  • You should normally configure this as a private Slack channel.

Any member of the Slack channel that you configure will be able to approve or reject deployments. This is why Harness emphasizes the importance of using a private channel, and of manually maintaining synchronization between your Harness User Group's membership and the Slack channel's membership.

Once you have selected the appropriate User Group and Slack channel to use:

  1. Open the User Group's notification settings. (See Notification Settings for User Groups.)
  2. In the Notification Settings dialog, specify the Slack Channel Name.
  3. Paste in the Slack Webhook URL you copied above in Configure Harness API Endpoint.

Approve ​Workflows via Slack

Once you've configured the URLs and channel notification settings above, members of the configured channel can approve (or reject) Workflow and Pipeline deployments directly from that channel.

To set up Slack approval within a Workflow:

  1. Within a Workflow step, select Add Command.
  2. In this resulting dialog, select Other > Approval:
  3. In this resulting Approval dialog, accept the default setting Ticketing SystemHarness UI.
  4. In the User Groups drop-down, select the group you enabled above in Configure Harness User Notifications:
  5. When your dialog looks something like this, you're ready to click SUBMIT:

To see how approval of this step works in practice, see Slack-based Approvals.

Approve Pipelines via Slack

To set up Slack approval within a Workflow Pipeline:

  1. Add a stage to the Pipeline:
  2. In the resulting dialog, accept the default Harness UI ticketing system:
  3. Select the User Group you've configured for approvals:
  4. Set a reasonable Timeout and (optionally) name the stage:
  5. Click SUBMIT to save the stage.

To see how approval of this stage works in practice, see Slack-based Approvals.


How did we do?