Skip to content

Instantly share code, notes, and snippets.

@a5ync
Created December 31, 2019 01:09
Show Gist options
  • Select an option

  • Save a5ync/6fb75c72177df73794b5026e6e48b9e8 to your computer and use it in GitHub Desktop.

Select an option

Save a5ync/6fb75c72177df73794b5026e6e48b9e8 to your computer and use it in GitHub Desktop.
Send notification from Devops to Teams
$teamsNotification = @{
'@type' = 'MessageCard'
'@context'= 'http://schema.org/extensions'
'themeColor' = '0076D7'
'summary' = 'Successful build notification'
'sections' = @(
@{
'activityTitle' = "$(Build.DefinitionName)"
'activitySubtitle' = "image tag $(Build.BuildNumber) deployed to registry"
})
}
$json = $teamsNotification | ConvertTo-Json
$params = @{
Uri = 'https://outlook.office.com/webhook/your_webhook_magic_link'
Method = 'POST'
Body = $json
ContentType = 'application/json'
}
Invoke-RestMethod @params
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment