Integrate with service hooks

Last Update: 3/6/2017

Service hooks enable you to perform tasks on other services when events happen in your Visual Studio Online projects. For example, create a card in Trello when a work item is created or send a push notification to your team's mobile devices when a build fails. Service hooks can also be used in custom apps and services as a more efficient way to drive activities when events happen in your projects.

Available services

These services are available as the target of service hooks. To learn about others apps and services that integrate with Visual Studio Team Services, visit the Visual Studio Marketplace

Build and release Collaborate Customer support Plan and track Integrate
AppVeyor Campfire UserVoice Trello Azure Service Bus
Bamboo Flowdock Zendesk Azure Storage
Jenkins HipChat Web Hooks
MyGet Hubot Zapier
Slack

Create a subscription

When you integrate one of these services with Visual Studio Team Services, you have to create a new subscription, something like this. In many cases, you have to do some work in the other service, too. For specific details, look at the information on the service that you're interested in.

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

    Open the admin page

  2. Create a subscription by running the wizard.

    Click the link to run the subscription wizard

  3. Select the service you want to integrate with.

    Select the service to integrate

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

    Select the event to trigger on and any filters

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

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

    Select an action to perform on the target service

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

    Test notification 1

    Test notification 2

Q & A

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, use tfssecurity.exe from the command line. For example:

tfssecurity /a+ /collection:https://fabrikam.visualstudio.com/DefaultCollection ServiceHooks PublisherSecurity/abcdef00-abcd-0000-0000-abcdef000000 ViewSubscriptions n:fabrikamfiber4@hotmail.com ALLOW

and

tfssecurity /a+ /collection:https://fabrikam.visualstudio.com/DefaultCollection ServiceHooks PublisherSecurity/abcdef00-abcd-0000-0000-abcdef000000 EditSubscriptions n:fabrikamfiber4@hotmail.com ALLOW

The GUID is the ID of the team project. You can get it using the Projects 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 team project project and the notification history for those subscriptions. That user will be able to create any type of service hook subscription in that project. If the user sets up a subscription for a resource that he does not otherwise have permission to access, the subscription will not get triggered.

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

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

A: Yes. Go here for more details.

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

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

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

    Make sure you start from the Visual Studio site (http://visualstudio.com) instead of your account (https://{account}.visualstudio.com) because, right now, your profile accessed from your account will take you to the wrong implementation of the authorizations management feature.

  2. Manage your authorizations.

    Click Manage applications to manage authorizations

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

    Click Revoke to revoke authorizations