       cb json_body
 
 pagerDutyPost = (msg, url, data, cb) ->
-  user    = process.env.HUBOT_PAGERDUTY_USERNAME
-  pass    = process.env.HUBOT_PAGERDUTY_PASSWORD
-  baseUrl = "https://#{process.env.HUBOT_PAGERDUTY_SUBDOMAIN}.pagerduty.com/api/v1"
+  if missingEnvironmentForApi(msg)
+    return
 
   json = JSON.stringify(data)
-  auth = 'Basic ' + new Buffer(user + ':' + pass).toString('base64');
-  msg.http(baseUrl + url)
+  auth = 'Basic ' + new Buffer(pagerDutyUsername + ':' + pagerDutyPassword).toString('base64')
+  msg.http(pagerDutyBaseUrl + url)
     .headers(Authorization: auth, Accept: 'application/json')
     .header("content-type","application/json")
     .header("content-length",json.length)

    withCurrentOncall msg, (username) ->
      msg.reply "#{username} is on call"

pagerDutyGet = (msg, url, query, cb) ->
  user    = process.env.HUBOT_PAGERDUTY_USERNAME
  pass    = process.env.HUBOT_PAGERDUTY_PASSWORD
  baseUrl = "https://#{process.env.HUBOT_PAGERDUTY_SUBDOMAIN}.pagerduty.com/api/v1"

  auth = 'Basic ' + new Buffer(user + ':' + pass).toString('base64');
  msg.http(baseUrl + url)
    .query(query)
    .headers(Authorization: auth, Accept: 'application/json')
    .get() (err, res, body) ->

      cb json_body

pagerDutyPut = (msg, url, data, cb) ->
  if missingEnvironmentForApi(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")
    .header("content-length",json.length)
