Skip to content

Instantly share code, notes, and snippets.

@riston
Last active August 29, 2015 13:56
Show Gist options
  • Save riston/c0a2871e0d8309f470d5 to your computer and use it in GitHub Desktop.
Save riston/c0a2871e0d8309f470d5 to your computer and use it in GitHub Desktop.
Get last event from public calendar
module.exports = (robot) ->
id = 'fr51k59qr9innjdkbikm53qobo@group.calendar.google.com'
url = "http://www.google.com/calendar/feeds/#{id}/public/full?alt=json&orderby=starttime&max-results=15&singleevents=true&sortorder=ascending&futureevents=true"
robot.respond /school$/i, (msg) ->
# msg.send "Hello from school"
# msg.send "School called#{res}"
getCalendar url, (err) ->
console.log "Reached here"
msg.send "Alo reached here"
getCalendar = (url, cb) ->
robot.http(url)
.get (err, res, body) ->
# return cb err if err
# data = null
# try
# data = JSON.parse(body)
# catch error
# return cb Error("Ran into an error parsing JSON :(")
cb JSON.parse body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment