Skip to content

Commit

Permalink
Add webhook api
Browse files Browse the repository at this point in the history
  • Loading branch information
yulii committed Aug 16, 2017
1 parent cac176f commit 28fafb5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
2 changes: 1 addition & 1 deletion external-scripts.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["hubot-heroku-keepalive"]
[]
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"cron": "^1.2.1",
"david": "^7.0.0",
"hubot": ">= 2.16.0 < 3.0.0",
"hubot-heroku-keepalive": "^1.0.2",
"hubot-scripts": ">= 2.16.0 < 3.0.0",
"hubot-slack": ">= 3.3.0 < 4.0.0"
},
Expand Down
23 changes: 23 additions & 0 deletions scripts/webhook.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Description:
# A simple interaction with the built in HTTP Daemon
#
# Dependencies:
# None
#
# Configuration:
# None
#
# Commands:
# None
#
# URLS:
# /webhook

module.exports = (robot) ->

robot.router.post '/webhook', (req, res) ->
switch true
when /wake(\s+#{robot.name})?\s+up!/.test(req.body.text)
res.end("<!#{req.body.user_name}> Waking <!#{robot.name}> up now. Wait a second.")
else
res.end()

0 comments on commit 28fafb5

Please sign in to comment.