1.1.10 • Published 6 years ago

bitbucket-ding-transform v1.1.10

Weekly downloads
12
License
ISC
Repository
-
Last release
6 years ago

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);
    })
}
1.1.10

6 years ago

1.1.9

6 years ago

1.1.8

6 years ago

1.1.7

6 years ago

1.1.6

6 years ago

1.1.5

6 years ago

1.1.4

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago