Did you know that you can navigate the posts by swiping left and right?
Here is an example of Jenkinsfile that implements slack notifications, junit results, and other goodies.
This is what I wanted to achieve:
While trying to achieve this, I discovered that there was already an example to send slack notifications in Jenkins workflow plugin GitHub repo. I adapted this code by adding colors for the different statuses.
import groovy.json.JsonOutput
// Add whichever params you think you'd most want to have
// replace the slackURL below with the hook url provided by
// slack when you configure the webhook
def notifySlack(text, channel) {
def slackURL = 'https://hooks.slack.com/services/xxxxxxx/yyyyyyyy/zzzzzzzzzz'
def payload = JsonOutput.toJson([text : text,
channel : channel,
username : "jenkins",
icon_emoji: ":jenkins:"])
sh "curl -X POST --data-urlencode \'payload=${payload}\' ${slackURL}"
}
NOTE: if you want to copy paste this, click use the raw version.