แชร์ผ่าน


Integrate with service hooks

TFS 2018

Service hooks let you run tasks on other services when events happen in your project in Azure DevOps.

For example, you can create a card in Trello when a work item gets created or send a push notification to your team's mobile devices when a build fails. You can also use service hooks in custom apps and services as a more efficient way to drive activities when events happen in your projects.

How do service hooks work?

Service hook publishers define a set of events that you can subscribe to. Subscriptions listen for these events and define actions to take based on the event.

Subscriptions also target consumers, which are external services that can run their own actions when events occur.

Diagram of service hooks.

Available services

The following services are available as the target of service hooks. For more information about other apps and services that integrate with Azure DevOps, go to the Visual Studio Marketplace.

Service Supported events Supported actions
App Center Work item updated Send notification
AppVeyor Code pushed Trigger an AppVeyor build
Azuqua All Post event to FLO
Azure App Service Code pushed Deploy web app
Azure Service Bus All Send a message to a Notification Hub, Service Bus Queue, or Service Bus Topic
Azure Storage All Insert a message in a Storage Queue
Bamboo Build completed, Code pushed Queue a build
Campfire All Post a message to a room
Datadog All Post an event in Datadog
Grafana Release deployment completed Add annotation to Grafana database
HipChat (No longer supported)
HockeyApp Work item updated Send notification
Jenkins Build completed, code pushed, PR merge attempted, release deployment completed Trigger generic or Git build
Microsoft Teams All Post a message to a channel
MyGet Build completed, code pushed Publish NuGet package to MyGet, trigger a MyGet build
Office 365 All Post a message to a group
Slack All Post a message to a channel
Trello All Create a card or list
UserVoice Work item created or updated Send linked work item event
Web Hooks All Post via HTTP
Workplace Message Apps All Send notifications
Zapier All Send notification
Zendesk Work item commented on Create a private comment in a ticket

Create a subscription

When you integrate one of these services with Azure DevOps, you must create a new subscription. In many cases, you need to do some work in the other service, too. For specific details, check out the information on the service that you're interested in.

  1. Open the admin page for a project in web access.

    Screenshot of the admin page.

  2. Create a subscription by running the wizard.

    Screenshot of highlighted box, Create subscription, to select to run the subscription wizard.

  3. Select the service you want to integrate with.

    Screenshot showing services selection to integrate.

  4. Select the event to trigger on and any filters (if applicable).

    Screenshot showing selection of the event to trigger on.

  5. Select an action to run on the target service.

    Note

    The list of available actions may be limited based on the event type you selected.

    Screenshot showing selected action to perform on the target service.

  6. To confirm the settings are correct, test the subscription and then finish the wizard.

    Screenshot showing test notification 1.

    Screenshot showing test notification 2.

FAQs

Q: What permissions do I need to set up a subscription?

A: Edit subscriptions and View subscriptions. By default, only project administrators have these permissions. To grant them to other users directly, you can use the command line tool or the Security REST API.

Q: What are the security implications of granting Edit subscriptions and View subscriptions permissions?

A: The user with these permissions can see all subscriptions created in the project and the notification history for those subscriptions. That user can then create any type of service hook subscription in that project. If the user sets up a subscription for a resource that they don't otherwise have permission to access, the subscription won't get triggered.

For example: If you don't have access to work items in area path XYZ, and you set up a subscription to the work item update events, you don't get notifications for updates to work items in area path XYZ. But, if another user, who does have access to the work items in area path XYZ, receives those "work item update" events, then you could see the notification history of the other user's events, which includes work item data that you don't otherwise have access to.

Q: Can I create service hook subscriptions for a project programmatically?

A: Yes. For more information, see Create a service hooks subscription.

Q: Can I remove an app's access to my organization after I've authorized it?

A: Yes. You can revoke authorizations from your profile.

  1. Go to your profile page from https://visualstudio.microsoft.com/.

    Make sure you start from the Visual Studio site (https://visualstudio.microsoft.com/) instead of your organization (https://dev.azure.com/{orgName}) because your profile accessed from your organization takes you to the wrong implementation of the authorizations management feature.

  2. Manage your authorizations.

    Screenshot showing highlighted Manage applications button.

  3. Revoke any authorizations you no longer want to allow.

    Screenshot showing Revoke option for authorizations.

Q: Why can't we set up service hooks for HipChat anymore?

A: Atlassian officially dropped support for HipChat. See more on that announcement here.