Slash Commands allow users to invoke your app by typing a string into the message composer box.
Pre-requisites:
- Jenkins is setup
- Make sure you have already created a channel in Slack.
Steps in Jenkins:
Create a Token for the build job you want to trigger from Slack
Go to Jenkins --> Click on the Job you would like to trigger from Slack --> Configure
Go to build triggers section.
We will be using the following URL to trigger builds from Slack
http://jenkins_dns_name/job/jobName/build?token=myToken
Allow anonymous read only access
Go to Manage Jenkins --> Configure Global security, click on Allow anonymous read only access.
Apply, Save.
Steps in Slack:
Enter a command - single word something like /build (it should be one word no spaces or characters)
Click on Add Slash command integration
Enter Jenkins URL, like mentioned below:
http://jenkins_dns_name/job/jobName/build?token=myToken
Method as GET
and scroll down click on the check box like below
And click Save integration
Go to channel, enter the command as shown below:
/build
and press enter
Now your build job should run instantly in Jenkins.
You can watch the steps in my YouTube channel as well:




















