public_void_kee
public_void_kee

Reputation: 65

custom DevOps notification subscription via REST call

I would like to create an Azure DevOps notification subscription via REST call. The recipient email address needs to be passed in and not default to my own email address. The ultimate goal is to programmatically create subscriptions so that certain non-ADO users can be automatically alerted about the resolution of work items that are relevant to them.

Thanks!

Upvotes: 1

Views: 544

Answers (1)

Leo Liu
Leo Liu

Reputation: 76740

custom DevOps notification subscription via REST call

To create the notification subscription, you could use this REST API Subscriptions - Create:

POST https://{service}.dev.azure.com/{organization}/_apis/notification/subscriptions?api-version=6.0

Sample Request body:

{
  "description": "A new work item enters our area path",
  "filter": {
    "eventType": "ms.vss-work.workitem-changed-event",
    "criteria": {
      "clauses": [],
      "groups": [],
      "maxGroupLevel": 0
    },
    "type": "Expression"
  },
  "subscriber": {
    "id": "xxxxxxd71-c2fef2ad085f"
  },
  "channel": {
    "type": "EmailHtml",
    "address": "[email protected]",
    "useCustomAddress": true
  }
}

Just set the the recipient email address in the "address": "xxxxx".

Note: You need provide the eventType and subscriber and so on.

My test result:

enter image description here

enter image description here

Upvotes: 1

Related Questions