The dingtalk callback powered by AWS lambda, Dynamodb.
The program provides a HTTP API endpoint to receive kinds of dingtalk callback events and persist them in AWS DynamoDB, including BPM events
, Organization events
and so on.
It is written by Kotlin and leverages below AWS services,
DD_TOKEN
, DD_AES_TOKEN
and DD_CORPID
(from step 1) in Systems Manager
my-deploy-bucket
) for deployment
# build the source
./gradlew build
# package the lambda functions
sam package --output-template-file packaged.yaml \
--s3-bucket my-deploy-bucket --template-file template-sam.yaml
# deploy the lambda function, api gateway, dybnamodb
sam deploy --template-file ./packaged.yaml \
--stack-name my-dingtalk-callback --capabilities CAPABILITY_IAM
sls deploy
codepipeline.json
codepipeline.json
codepipeline.json
if necessary, such as app name, repo name and branch name
aws cloudformation create-stack --stack-name dingtalk-mycorp --template-body file://codepipeline.yml --parameters file://codepipeline.json --capabilities CAPABILITY_NAMED_IAM
id of api gateway of AWS
created by above deploymentFor example,
curl -X POST \
'https://oapi.dingtalk.com/call_back/update_call_back?access_token=<your token>' \
-H 'Content-Type: application/json' \
-d '{
"call_back_tag": [
"bpms_task_change",
"bpms_instance_change"
],
"token": "<token created in prerequisites step 2>",
"aes_key": "<aes token created in prerequisites step 2>",
"url": "https://<id of api gateway created by above deployment>.execute-api.<your region>.amazonaws.com/v1/dingtalk"
}'
I also port this lambda function to use Spring Cloud Function as lambda framework, you can checkout this branch if your’re interested.