     pagerDutyGet msg, "/users", {}, (json) ->
       pagerDutyUsers['loaded'] = true
       for user in json.users
-        pagerDutyUsers[user.id]   = user
+        pagerDutyUsers[user.id] = user
+        pagerDutyUsers[user.email] = user
         pagerDutyUsers[user.name] = user
       cb(pagerDutyUsers)
   else

module.exports = (robot) ->
  robot.respond /pager( me)?$/i, (msg) ->

    cmds = robot.helpCommands()
    cmds = (cmd for cmd in cmds when cmd.match(/(pager me |who's on call)/))
    msg.send cmds.join("\n")

  # Assumes your Campfire usernames and PagerDuty names are identical
  robot.respond /pager( me)? (\d+)/i, (msg) ->
    withPagerDutyUsers msg, (users) ->
      username  = msg.message.user.name
      if username == "Shell"
        username = process.env.USER
      userId    = users[username].id
      now       = new Date()
      start     = now.toISOString()
      minutes   = parseInt msg.match[2]
      end       = now.addMinutes(minutes).toISOString()
      override  = {
        'start':     start,
        'end':       end,

#   hubot pager me problems - return all open inicidents
#   hubot pager me ack 24 - ack incident #24
#   hubot pager me resolve 24 - resolve incident #24
#
# Dependencies:
#  "moment": "1.6.2"
# 
# Configuration:
#
#   HUBOT_PAGERDUTY_USERNAME
#   HUBOT_PAGERDUTY_PASSWORD
#   HUBOT_PAGERDUTY_SUBDOMAIN
#   HUBOT_PAGERDUTY_APIKEY     Service API Key from a 'General API Service'
#   HUBOT_PAGERDUTY_SCHEDULE_ID

inspect = require('util').inspect

moment = require('moment')

pagerDutyUsers = {}
pagerDutyUsername    = process.env.HUBOT_PAGERDUTY_USERNAME
