feat: backport webhook firehose
This commit is contained in:
parent
df5bc81700
commit
45a11f91f0
4 changed files with 50 additions and 0 deletions
21
lib/notifier/webhook.js
Normal file
21
lib/notifier/webhook.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
const axios = require('axios')
|
||||
const _ = require('lodash/fp')
|
||||
const uuid = require('uuid')
|
||||
|
||||
const WEBHOOK_URL = process.env.WEBHOOK_URL
|
||||
|
||||
const sendMessage = (settings, rec) => {
|
||||
if (_.isEmpty(WEBHOOK_URL)) return Promise.resolve()
|
||||
|
||||
const body = _.merge(rec.webhook, { id: uuid.v4() })
|
||||
|
||||
return axios({
|
||||
method: 'POST',
|
||||
url: WEBHOOK_URL,
|
||||
data: body
|
||||
})
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
sendMessage
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue