 
 get_notifs = (options, onComplete, onError) ->
   connect (t) ->
+    console.info('retrieving notifications...')
     t.get "/1/members/me/notifications", options, (err, data) ->
       if data.length
+        console.info('set last_notif_id=' + data[0].id)
         last_notif_id = data[0].id
-      notifs = (filter_actions[notif.type](notif) for notif in data)
-      onComplete(notifs)
+      raw_notifs = (filter_actions[notif.type](notif) for notif in data)
+      onComplete(notif for notif in raw_notifs when notif isnt undefined)
   , onError
+
+init_checker = (robot) ->
+  console.info "set interval check to #{check_interval_ms}"
+  checker = setInterval ->
+    console.info "checking for new notifications..."
+    options =
+      filter: Object.keys(filter_actions)
+      read_filter: 'unread'
+      limit: 10
+      since: last_notif_id
+    get_notifs options, (notifs) ->
+      console.info "#{notifs.length} new notifications received"
+      for notif in notifs
+        robot.messageRoom("", notif)
+    , (err) ->
+      msg.send "Error: #{err}"
+  , check_interval_ms
 
 module.exports = (robot) ->
   robot.respond /trello ping/i, (msg) ->

Trello = require 'node-trello'

check_interval_ms = process.env.HUBOT_TRELLO_INTERVAL ? 1000 * 60 * 5

trello_key = process.env.HUBOT_TRELLO_KEY
trello_token = process.env.HUBOT_TRELLO_TOKEN
trello_board_id = process.env.HUBOT_TRELLO_BOARD_ID

      limit: 10
      since: last_notif_id
    get_notifs options, (notifs) ->
      for notif in notifs
        msg.send(notif)
    , (err) ->
      msg.send "Error: #{err}"

  init_checker(robot)
