     unless status in ['failed', 'success']
       msg.send "Status can only be failed or success."
       return
-    msg.http("#{endpoint}/projects?circle-token=#{process.env.HUBOT_CIRCLECI_TOKEN}")
-      .headers("Accept": "application/json")
-      .get() handleResponse msg, (response) ->
-          msg.send "Projects where the last build's status is #{status}:"
-          for project in response
-            default_branch = project.default_branch
-            build_branch = project.branches[default_branch]
-            recent_builds = build_branch.recent_builds
-            build = recent_builds[0]
-            if build.status is status
-              msg.send "#{toDisplay(build.status)} in build https://circleci.com/gh/#{project.username}/#{project.reponame}/#{build.build_num} of #{project.vcs_url} [#{default_branch}]"
+    getProjectsByStatus(msg, endpoint, status, 'list')
 
   robot.respond /circle cancel (.*) (.*)/i, (msg) ->
     unless checkToken(msg)

  robot.respond /circle retry (.*) (.*)/i, (msg) ->
    unless checkToken(msg)
      return
    project = escape(toProject(msg.match[1]))
    build_num = escape(msg.match[2])
    if build_num is 'last'
      branch = 'master'

#   hubot circle me <user>/<repo> [branch] - Returns the build status of https://circleci.com/<user>/<repo>
#   hubot circle last <user>/<repo> [branch] - Returns the build status of the last complete build of https://circleci.com/<user>/<repo>
#   hubot circle retry <user>/<repo> <build_num> - Retries the build
#   hubot circle retry all <failed>/<success> - Retries all builds matching the provided status
#   hubot circle cancel <user>/<repo> <build_num> - Cancels the build
#   hubot circle clear <user>/<repo> - Clears the cache for the specified repo
#   hubot circle list <failed>/<success> - Lists all failed/success builds for a given project.
