 moment = require('moment')
 
 pagerDutyUsers = {}
-pagerDutyUsername    = process.env.HUBOT_PAGERDUTY_USERNAME
-pagerDutyPassword    = process.env.HUBOT_PAGERDUTY_PASSWORD
-pagerDutySubdomain   = process.env.HUBOT_PAGERDUTY_SUBDOMAIN
-pagerDutyBaseUrl     = "https://#{pagerDutySubdomain}.pagerduty.com/api/v1"
-pagerDutyApiKey      = process.env.HUBOT_PAGERDUTY_APIKEY
-pagerDutyScheduleId  = process.env.HUBOT_PAGERDUTY_SCHEDULE_ID
+pagerDutyApiKey        = process.env.HUBOT_PAGERDUTY_API_KEY
+pagerDutySubdomain     = process.env.HUBOT_PAGERDUTY_SUBDOMAIN
+pagerDutyBaseUrl       = "https://#{pagerDutySubdomain}.pagerduty.com/api/v1"
+pagerDutyServiceApiKey = process.env.HUBOT_PAGERDUTY_SERVICE_API_KEY
+pagerDutyScheduleId    = process.env.HUBOT_PAGERDUTY_SCHEDULE_ID
 
 module.exports = (robot) ->
   robot.respond /pager( me)?$/i, (msg) ->

      return
  
    json = JSON.stringify(data)
    auth = 'Basic ' + new Buffer(pagerDutyUsername + ':' + pagerDutyPassword).toString('base64')
    msg.http(pagerDutyBaseUrl + url)
      .headers(Authorization: auth, Accept: 'application/json')
      .header("content-type","application/json")

    unless pagerDutySubdomain?
      msg.send "PagerDuty Subdomain is missing:  Ensure that HUBOT_PAGERDUTY_SUBDOMAIN is set."
      missingAnything |= true
    unless pagerDutyApiKey?
      msg.send "PagerDuty API Key is missing:  Ensure that HUBOT_PAGERDUTY_API_KEY is set."
      missingAnything |= true
    unless pagerDutyScheduleId?
      msg.send "PagerDuty Schedule ID is missing:  Ensure that HUBOT_PAGERDUTY_SCHEDULE_ID is set."
      missingAnything |= true
    missingAnything

