bitbucket-ding-transform
v1.1.10
Published
> Bitbucket Webhook data transformation > for [DingTalk Bot](https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.karFPe&treeId=257&articleId=105735&docType=1)
Downloads
14
Readme
Bitbucket Webhook -> DingTalk Bot
Bitbucket Webhook data transformation
for DingTalk Bot
Feature
- support
push
hook - support
pullrequest
hook- created
- comment
- updated
- merged
- declined
Usage
npm i bitbucket-ding-transform
Quick Start
AWS Lambda Example
const request = require('request')
const { transform } = require('bitbucket-ding-transform')
const { CALLBACK_URL } = process.env
module.exports.handler = function handler(event, context, callback) {
console.log("request: " + JSON.stringify(event));
if (event.body === null || event.body === undefined) return callback(new Error('Body required!!'))
const body = JSON.parse(event.body)
const dingBody = transform(body)
console.log('ding body: ' + JSON.stringify(dingBody))
request({ method: 'POST', url: CALLBACK_URL, json: true, body: dingBody }, function (error, response, body) {
if (error) return callback(error)
const resp = {
statusCode: 200,
body: JSON.stringify(body)
}
console.log("response: " + JSON.stringify(resp))
callback(null, resp);
})
}