Slack Approvals in Workflows and Pipelines
Harness users can approve or reject Workflows and Pipelines directly from Slack.
In this topic:
- Step 1: Create Slack App
- Step 2: Configure Harness API Endpoint in Slack
- Step 3: Configure Harness User Notifications for Slack
- Option: Approve Workflows via Slack
- Option: Approve Pipelines via Slack
- See Also
Step 1: Create Slack App
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.
When you create the app, do the following:
- Name your app, assign it to a Workspace, and select Create App.
- Select Incoming Webhooks.
- Enable the Activate Incoming Webhooks slider:
- Click Add New Webhook to Workspace.
- At the Confirm your identity challenge, select the Slack channel to receive approval notifications. (To select an appropriate channel, see Configure Harness User Notifications below.)
- Click Install (or Authorize) to confirm this setup.
Step 2: Configure Harness API Endpoint in Slack
Configure the API endpoint from Harness for interactivity.
- In Slack, select Interactive Components.
- Enable the Interactivity slider:
- Enter the Request URL, as either
http
orhttps
. 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>
- Click Save.
- Return to the Slack app's Incoming Webhooks tab.
- From the resulting app settings, copy the Webhook URL to your clipboard.
You've 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.
Step 3: 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 Workflow and Execute Pipeline permissions for all relevant Applications.
See Application Permissions in Managing Users and Groups (RBAC). - 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.
Once you have selected the appropriate User Group and Slack channel to use:
- Open the User Group's notification settings. See Add Notification Settings for User Groups.
- In Notification Settings, specify the Slack Channel Name.
- Paste in the Slack Webhook URL you copied above in Step 2: Configure Harness API Endpoint in Slack.
Option: 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:
- Within a Workflow section, select Add Step.
- Click Approval.
- In Ticketing System, select Harness UI.
- In the User Groups drop-down, select the group you enabled above in Step 3: Configure Harness User Notifications for Slack.
- Click Submit.
To see how approval of this step works in practice, see Harness UI Approvals.
Option: Approve Pipelines via Slack
To set up Slack approval within a Pipeline:
- Add a stage to the Pipeline.
- Click Approval Step.
- In Ticketing System, select Harness UI.
- Select the User Group you enabled above in Step 3: Configure Harness User Notifications for Slack
- Set a Timeout and click Submit.
To see how approval of this step works in practice, see Harness UI Approvals.