Jaa


Create a service hook for Azure DevOps with Slack

TFS 2018

In this article, learn how to post messages to Slack in response to events in your Azure DevOps organization, such as completed builds, code changes, pull requests, releases, work items changes, and more.

Prerequisites

Refer to the Slack documentation, Sending messages using Incoming Webhooks to understand the process of using Web Hooks to push information to a Slack channel.

Create a custom app in Slack

  1. Create a new Slack app Create slack app

  2. Activate incoming Web Hook and add a new Web Hook to the desired workspace Screenshot of incoming Web Hook.

    Screenshot of Toggle Web Hook.

  3. Select the channel for which Web Hook must be created.

    Screenshot of Create Web Hook.

  4. Copy the Web Hook URL and go to Azure DevOps.

Create a service hook subscription in your organization

  1. Go to your project Service Hooks page.

    https://dev.azure.com/{orgName}/{project_name}/_apps/hub/ms.vss-servicehooks-web.manageServiceHooks-project

    Screenshot of the Project administration page.

    Select Create Subscription.

  2. Choose the types of events you want to appear in your Slack channel.

    You can filter each of the triggers in specific ways. For example, filter the pull request created trigger on the repository in which the pull request occurs, the target branch it applies to, and the team members required or invited to review the request.

  3. Paste the Web Hook URL from the Slack integration that you created and select Finish.

    Screenshot of the Action dialog box with the Web Hook URL.

  4. When the event occurs in your project, a notification appears in your team's Slack channel.

    Screenshot that shows a notification in a Slack channel.

FAQs

Q: Why don't I have the pull request events as an option when I configure my trigger?

A: Pull requests are only available with projects that use Git. If your project uses TFVC, pull event triggers aren't available, and your code event is called "Code checked in" instead of "Code pushed."

Q: How can I get multiple events to show up in my Slack channel?

A: Create a new subscription for each type of event you want. For example, if you want to see build failures and new work items in your Slack channel, create two more subscriptions.