Answers: <p>The plugin you found doesn't have a 1:1 ratio between Heroku instance with build jobs since it takes the job name as parameter, so you should be able to run any number of jobs from a single Heroku instance.</p>
  
  <p>As for passing a space in a job parameter, the <a href="https://github.com/joshdholtz/jenkins-slack-command/blob/master/web.rb#L21" rel="noreferrer">word split is made on spaces</a> so quoting won't change anything. You could possibly try to use the HTML spacing character <code>%20</code> and see if it works?</p>
  
  <p>Personally I would try to use the plugin to run the correct job with the associated parameters directly instead of going through filtering jobs.</p>
  
Answers: CC BY-SA 3.0
Answers: 2017-05-04T19:30:43.063Z
Answers: To be exact,  the split on spaces is made a few lines above your link,  I didn't dig enough to confirm or not it will split on all spaces,  but it sounds like it wilk
Answers: Tensibai
Answers: CC BY-SA 3.0
Answers: 2017-05-04T19:35:22.623Z
Answers: You are correct, it's split on spaces by this line https://github.com/joshdholtz/jenkins-slack-command/blob/master/web.rb#L21 so it won't matter if there are quotes or not around the parameters
Answers: Michael Pereira
Answers: CC BY-SA 3.0
Answers: 2017-05-04T21:09:08.670Z
Answers: Yep parameters are looped over and split again on = this will break if a value contain spaces, using %20 may work when posted to slack,  but it has to be tested because I've no idea how Jenkins or slack may parse or keep them
Answers: Tensibai
Answers: CC BY-SA 3.0
Answers: 2017-05-04T19:17:36.293Z
Answers: 2017-05-04T19:34:56.367Z
Answers: 2017-05-04T19:34:56.367Z
Answers: Michael Pereira
Body: <p>In an ideal world our less tech-knowledgeable employees could just use a Slack command to run a job and get the results slacked back to them, negating the use of the Jenkins GUI. I found <a href="https://github.com/joshdholtz/jenkins-slack-command" rel="nofollow noreferrer">Start a build in Jenkins using a Slack Command</a> on GitHub, but it's got a few limitations including that it seems to require a 1:1 ratio Heroku instance to Jenkins job, which isn't great for our purposes. </p>
  
  <p>My thought is to have people use a singular command like <code>/jenkins</code>, and use parameters after it that will be parsed by one job, and used to kick off others downstream. That keeps us to one slack command / one instance, but still gives us all the flexibility we need.</p>
  
  <p>The issue falls in getting the parameters to Jenkins. I'm picturing something like the following workflow;</p>
  
  <ol>
  <li><p>User types <code>/Jenkins job2 param1 param2</code> in Slack. This is calling an umbrella job that will parse the parameters to find out what to run. </p></li>
  <li><p>Command is somehow sent to the umbrella jenkins job. Heroku instance, direct integration, w/e.</p></li>
  <li><p>Umbrella job receives <code>job2 param1 param2</code> as a string. (Perhaps as the value of a single parameter, perhaps pre-split into multiple fields)</p></li>
  <li><p>Umbrella job splits the string if it hasn't already been done, and figures out that the user wants <code>job2</code> run, using parameters <code>param1</code> and <code>param2</code>. </p></li>
  <li><p>Umbrella job does a buildjob to run the downstream job as called, which will Slack back to the user their results. </p></li>
  </ol>
  
  <p>It's steps 2-3 that are tripping me up. <strong>How can I pass a string (with spaces!) from Slack to my Jenkins job?</strong></p>
  
  <p>If my entire premise is wrong I'm also open to having my frame challenged.</p>
  
Tags: <jenkins><slack>
Title: Pass string to Jenkins job from Slack
UserDisplayName: Alex
ThreadText: # Pass string to Jenkins job from Slack
  
  (Asked by: username_0 on 2017-05-04)
  
  In an ideal world our less tech-knowledgeable employees could just use a Slack command to run a job and get the results slacked back to them, negating the use of the Jenkins GUI. I found [Start a build in Jenkins using a Slack Command](https://github.com/joshdholtz/jenkins-slack-command) on GitHub, but it's got a few limitations including that it seems to require a 1:1 ratio Heroku instance to Jenkins job, which isn't great for our purposes.
  
  My thought is to have people use a singular command like `/jenkins`, and use parameters after it that will be parsed by one job, and used to kick off others downstream. That keeps us to one slack command / one instance, but still gives us all the flexibility we need.
  
  The issue falls in getting the parameters to Jenkins. I'm picturing something like the following workflow;
  
  1. User types `/Jenkins job2 param1 param2` in Slack. This is calling an umbrella job that will parse the parameters to find out what to run.
  2. Command is somehow sent to the umbrella jenkins job. Heroku instance, direct integration, w/e.
  3. Umbrella job receives `job2 param1 param2` as a string. (Perhaps as the value of a single parameter, perhaps pre-split into multiple fields)
  4. Umbrella job splits the string if it hasn't already been done, and figures out that the user wants `job2` run, using parameters `param1` and `param2`.
  5. Umbrella job does a buildjob to run the downstream job as called, which will Slack back to the user their results.
  
  It's steps 2-3 that are tripping me up. **How can I pass a string (with spaces!) from Slack to my Jenkins job?**
  
  If my entire premise is wrong I'm also open to having my frame challenged.
  
  **Tags:** jenkins, slack
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2017-05-04. Score: 5
  
  The plugin you found doesn't have a 1:1 ratio between Heroku instance with build jobs since it takes the job name as parameter, so you should be able to run any number of jobs from a single Heroku instance.
  
  As for passing a space in a job parameter, the [word split is made on spaces](https://github.com/joshdholtz/jenkins-slack-command/blob/master/web.rb#L21) so quoting won't change anything. You could possibly try to use the HTML spacing character `%20` and see if it works?
  
  Personally I would try to use the plugin to run the correct job with the associated parameters directly instead of going through filtering jobs.
  
  > **Comments:**
  > **username_2**: To be exact,  the split on spaces is made a few lines above your link,  I didn't dig enough to confirm or not it will split on all spaces,  but it sounds like it wilk  
  > **username_1**: You are correct, it's split on spaces by this line https://github.com/joshdholtz/jenkins-slack-command/blob/master/web.rb#L21 so it won't matter if there are quotes or not around the parameters  
  > **username_2**: Yep parameters are looped over and split again on = this will break if a value contain spaces, using %20 may work when posted to slack,  but it has to be tested because I've no idea how Jenkins or slack may parse or keep them  
  
  ---
  
  