How to set up a hook for Jenkins build

  • Page Owner: Not Set
  • Last Reviewed: 2019-11-07

How would we set up a Slack integration for fidelity builds?


Additional Posts

Go to: https://blending.slack.com/apps/new/A0F7XDUAZ-incoming-webhooks

Choose a channel for your notification, and then copy the payload url.

Then in Jenkins, under your server/build item > Configure > Build > go to Powershell commands and add this script:

$payload = @{    
    "icon_emoji" = ":rocket:"
    "text" = "MESSAGE FOR WEBHOOK"
    "username" = "USER NAME FOR WEB HOOK"
}

Invoke-WebRequest `
    -Body (ConvertTo-Json -Compress -InputObject $payload) `
    -Method Post `
    -Uri "YOUR WEBHOOK URL HERE" | Out-Null

and then click save on Jenkins.

It might be a good idea to test the PowerShell script beforehand to make sure it works. Be sure to save your changes on the webhooks slack page too to make your post URL active.