Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Azure DevOps Services | Azure DevOps Server 2022 - Azure DevOps Server 2019
With service hooks, you can notify third-party systems about events that occur in your project. You can use a custom consumer to send an HTTP message to the endpoint that’s defined in the extension's manifest.
This article walks through developing an extension that implements a sample consumer service, which includes the following events and actions.
Note
In this article, we refer to the home directory for your project as "home".
For more information, see the Extension example GitHub repo. For a list of all supported events you can use as triggers for your custom consumer extension, see List of event types.
Tip
Check out our newest documentation on extension development using the Azure DevOps Extension SDK.
Service hook publishers define a set of events. Subscriptions listen and wait for the events and define actions for when the event is triggered.
This is a general description of how all our service hook implementations work. For our case, we specify our consumer defined by an extension, as well as the specified action for when an event occurs.
Add the specific contribution for custom consumer implementation to your basic manifest file. See the following example of how your manifest should look after you add the contribution.
{
"manifestVersion": 1,
"id": "samples-service-hooks-consumer",
"version": "0.1.2",
"name": "Service Hooks Sample",
"description": "A simple extension that demonstrates how to contribute a consumer service into service hooks.",
"publisher": "fabrikam",
"public": false,
"icons": {
"default": "images/logo.png"
},
"scopes": [],
"files": [
{
"path": "images",
"addressable": true
}
],
"content": {
"details": {
"path": "readme.md"
}
},
"categories": [
"Developer samples"
],
"targets": [
{
"id": "Microsoft.VisualStudio.Services"
}
],
"contributions": [
{
"id": "consumer",
"type": "ms.vss-servicehooks.consumer",
"targets": [
"ms.vss-servicehooks.consumers"
],
"properties": {
"id": "consumer",
"name": "Sample Consumer",
"description": "Sample consumer service",
"informationUrl": "https://aka.ms/vsoextensions",
"inputDescriptors": [
{
"id": "url",
"isRequired": true,
"name": "URL",
"description": "URL to post event payload to",
"inputMode": "textbox"
}
],
"actions": [
{
"id": "performAction",
"name": "Perform action",
"description": "Posts a standard event payload",
"supportedEventTypes": [
"git.push",
"git.pullrequest.created",
"git.pullrequest.updated"
],
"publishEvent": {
"url": "{{{url}}}",
"resourceDetailsToSend": "all",
"messagesToSend": "all",
"detailedMessagesToSend": "all"
}
}
]
}
}
]
}
Note
Remember to update the publisher
property.
For each contribution in your extension, the manifest defines the following items.
Consumers have the following properties.
Property | Description |
---|---|
id | Unique ID for your consumer service. |
name | Name of the custom consumer, which is visible during service hook subscription creation. |
description | Describes your consumer service. |
informationUrl | Find more info about your extension. |
inputDescriptors | Inputs to be used by users that are creating subscriptions with the consumer service. |
actions | Describes the actions to take and which events trigger those actions. |
Actions for your consumer have the following properties:
Property | Description |
---|---|
id | ID for your action service. |
name | Name of the action. |
description | Detailed description of the action. |
supportedEventTypes | Array of trigger types for which this action can be used. For more information, see List of event types. |
publishEvent.url | URL where HTTP message gets sent to. It can be templated by values provided by inputDescriptors. Their actual values get defined by the user when the subscription gets created. |
Events
17 Mar, 9 pm - 21 Mar, 10 am
Join the meetup series to build scalable AI solutions based on real-world use cases with fellow developers and experts.
Register nowTraining
Module
Learn how to build Microsoft 365 Copilot message extension plugins to connect it to external data sources and extend its capabilities.
Certification
Microsoft Certified: Azure Developer Associate - Certifications
Build end-to-end solutions in Microsoft Azure to create Azure Functions, implement and manage web apps, develop solutions utilizing Azure storage, and more.
Documentation
Data and Setting Storage - Azure DevOps
DevOps extensions can store user preferences and complex data structures just like other project data. Use REST APIs or a Microsoft client service to do so.
Working with URLs in extensions - Azure DevOps
Learn about best practices for working with URLs in Azure DevOps extensions and integrations.
Develop a web extension - Azure DevOps
Learn how to develop your first web extension for Azure DevOps.
Add an action for your extension that extends Azure DevOps.