Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hmsk/f2ec6bcc14f030041cea0e4be9357136 to your computer and use it in GitHub Desktop.
Save hmsk/f2ec6bcc14f030041cea0e4be9357136 to your computer and use it in GitHub Desktop.
robot.router.post '/hubot/an-endpoint', (req, res) ->
payload = req.body || { recipient: null }
unless payload.recipient == 'my-mailgun@email-address'
res.writeHead(403)
res.end()
return
res.writeHead(204)
res.end()
att =
color: '#dedede'
fields: []
fallback: 'Email received'
thumb_url: null
title: payload.subject
title_link: null
pretext: ':inbox_tray: メールを受信したよ'
text: payload['body-plain']
author_name: payload.from
author_link: null
author_icon: null
ts: payload.timestamp
robot.messageRoom '#sandbox', attachments: [att]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment