       callback JSON.parse(body)
 
 deploy = (options) ->
-  { appName, appData, blobRef, msg } = options
+  { appName, appData, blobRef, env, msg } = options
 
-  requestUrl = "https://kolkrabbi.herokuapp.com/apps/#{appData.staging.id}/github/push"
+  requestUrl = "https://kolkrabbi.herokuapp.com/apps/#{appData[env].id}/github/push"
 
   body = JSON.stringify
     branch: blobRef
 
   sendRequest msg, requestUrl, body, (responseBody) ->
-    msg.send "**Staging** deployment of **#{appName}** started - [Click here to watch](https://dashboard.heroku.com/apps/#{appData.staging.name}/activity/builds/#{responseBody.id})"
+    msg.send "**#{env}** deployment of **#{appName}** started - [Click here to watch](https://dashboard.heroku.com/apps/#{appData.staging.name}/activity/builds/#{responseBody.id})"
 
 promote = (options) ->
   { appName, appData, msg } = options

AUTH_HEADER = "Bearer #{process.env.HEROKU_API_TOKEN}"

module.exports = (robot) ->
  robot.respond /deploy ([a-zA-Z\d\-]+)(?:@([a-zA-Z\d\-]+))? to staging$/i, { id: "heroku.deploy" }, (msg) ->
    appName = msg.match[1]
    blobRef = msg.match[2]

    appData = VALID_APPS[appName]


    unless robot.auth.hasRole msg.envelope.user, appData.role
      return msg.send "You need the '#{appData.role}'' role to deploy #{appName}"

    if env == "production" and appData.pipelineId?
      return msg.send "This app should production deploy using pipelines only"

    deploy { appName, appData, blobRef, env, msg }

  robot.respond /promote ([a-zA-Z\d\-]+) to production$/i, { id: "heroku.promote" }, (msg) ->
    appName = msg.match[1]
