     withCurrentOncall msg, (username) ->
       msg.reply "#{username} is on call"
 
+missingEnvironmentForApi = (msg) ->
+  missingAnything = false
+  unless pagerDutySubdomain?
+    msg.send "PagerDuty Subdomain is missing:  Ensure that HUBOT_PAGERDUTY_SUBDOMAIN is set."
+    missingAnything |= true
+  unless pagerDutyUsername?
+    msg.send "PagerDuty username is missing:  Ensure that HUBOT_PAGERDUTY_USERNAME is set."
+    missingAnything |= true
+  unless pagerDutyPassword?
+    msg.send "PagerDuty password is missing:  Ensure that HUBOT_PAGERDUTY_PASSWORD is set."
+    missingAnything |= true
+  missingAnything
+
+
 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)
+  if missingEnvironmentForApi(msg)
+    return
+
+  auth = 'Basic ' + new Buffer(pagerDutyUsername + ':' + pagerDutyPassword).toString('base64')
+  msg.http(pagerDutyBaseUrl + url)
     .query(query)
     .headers(Authorization: auth, Accept: 'application/json')
     .get() (err, res, body) ->

      cb json_body

pagerDutyPut = (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"

  json = JSON.stringify(data)
  auth = 'Basic ' + new Buffer(user + ':' + pass).toString('base64');
  msg.http(baseUrl + url)
    .headers(Authorization: auth, Accept: 'application/json')
    .header("content-type","application/json")
    .header("content-length",json.length)

  data = null
  switch cmd
    when "trigger"
      data = JSON.stringify { service_key: pagerDutyApiKey, event_type: "trigger", description: "#{args}"}
      pagerDutyIntergrationPost msg, data, (json) ->
        cb(json)

