 
     job = CONFIG[environment].job
     role = CONFIG[environment].role
-    paramName = CONFIG[environment].param ||= "BRANCH"
-    params = "#{paramName}=#{branch}"
+    paramKeys = CONFIG[environment].params ||= "BRANCH"
+    paramKeys = paramKeys.split(',')
 
     if not userHasRole(user, role)
        msg.send "Access denied."
        msg.send "You must have this role to use this command: #{role}"
        return
+
+    if paramKeys.length isnt paramValues.length
+      msg.send 'Invalid parameters.'
+      msg.send "Valid parameters are: #{(key for key of paramKeys)}"
+
+    count = paramKeys.length - 1
+    params = ''
+    for i in [0..count]
+      params += "#{paramKeys[i]}=#{paramValues[i]}"
+      if i isnt count
+        params += ','
 
     # monkeypatch the msg.match object
     msg.match[1] = job

# Author:
#   danriti

querystring = require 'querystring'

module.exports = (robot) ->

  if process.env.HUBOT_DEPLOY_CONFIG?
    CONFIG = JSON.parse process.env.HUBOT_DEPLOY_CONFIG
  else
    robot.logger.warning 'The HUBOT_DEPLOY_CONFIG environment variable is not set'
    CONFIG = {}

  userHasRole = (user, role) ->

      msg.send "Error: jenkins plugin not installed."
      return

    environment = msg.match[2]
    paramValues = msg.match[3].split(',')
    user = msg.envelope.user

    if environment not of CONFIG
