{"id":20738710,"url":"https://github.com/wyyxdgm/gitlab-dingtalk","last_synced_at":"2026-04-08T23:33:25.906Z","repository":{"id":217150096,"uuid":"743016121","full_name":"wyyxdgm/gitlab-dingtalk","owner":"wyyxdgm","description":"Using the Webhook method to push GitLab messages to DingTalk, supporting one-click deployment with Docker, and supporting message templates.","archived":false,"fork":false,"pushed_at":"2024-01-24T02:27:35.000Z","size":28,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-12-13T18:34:07.105Z","etag":null,"topics":["ding","dingtalk","docker","docker-compose","express","gitlab","gitlab-events","message-template"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wyyxdgm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-14T03:42:08.000Z","updated_at":"2025-04-27T08:32:21.000Z","dependencies_parsed_at":"2024-11-17T06:20:04.110Z","dependency_job_id":"d1a4ec7a-cb50-4dff-9912-39be11c0a4f4","html_url":"https://github.com/wyyxdgm/gitlab-dingtalk","commit_stats":null,"previous_names":["wyyxdgm/gitlab-dingtalk"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wyyxdgm/gitlab-dingtalk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyyxdgm%2Fgitlab-dingtalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyyxdgm%2Fgitlab-dingtalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyyxdgm%2Fgitlab-dingtalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyyxdgm%2Fgitlab-dingtalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wyyxdgm","download_url":"https://codeload.github.com/wyyxdgm/gitlab-dingtalk/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wyyxdgm%2Fgitlab-dingtalk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31579055,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-08T14:31:17.711Z","status":"ssl_error","status_checked_at":"2026-04-08T14:31:17.202Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ding","dingtalk","docker","docker-compose","express","gitlab","gitlab-events","message-template"],"created_at":"2024-11-17T06:19:59.610Z","updated_at":"2026-04-08T23:33:25.889Z","avatar_url":"https://github.com/wyyxdgm.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gitlab-dingtalk\n\n[中文](./README_zh_CN.md)\n\nDue to the inconsistent message formats between GitLab event notifications and DingTalk, a direct push is not feasible. This project serves as an intermediary service for message translation, which enables the push of GitLab events to DingTalk.\n\n## Quick Start\n\n### Preparation\n\n1. Create a new robot and obtain `access_token`. Refer to this [document](https://open.dingtalk.com/document/robots/custom-robot-access)\n2. Insert this link into GitLab's `webhook`: `http://${yourhost}:6688/webhook?access_token=${access_token}`\n\nNote: This project supports both single robot and multiple robots mode. The default robot can be set by the environment variable `ACCESS_TOKEN`. For multiple robots, you only need to add the `access_token` parameter to the link for distinction. The links are as follows:\n\n```bash\nhttp://${yourhost}:6688/webhook # default robot\nhttp://${yourhost}:6688/webhook?access_token=${access_token1} # robot with access_token1\nhttp://${yourhost}:6688/webhook?access_token=${access_token2} # robot with access_token2\n```\n\nIf the `ACCESS_TOKEN` environment variable does not exist and no parameter is passed, an error will be reported.\n\n### Node\n\n```bash\nnpm install -g pm2\ngit clone git@github.com:wyyxdgm/gitlab-dingtalk.git\ncd gitlab-dingtalk \u0026\u0026 npm install\nACCESS_TOKEN=${access_token} \u0026\u0026 \\\nTEMPLATE=default \u0026\u0026 PORT=6688 \u0026\u0026 \\\nnpm start\n```\n\n### Docker\n\nReplace the `access_token` in the following code with the robot's `access_token`.\n\n```bash\ndocker run -e ACCESS_TOKEN=${access_token} -e TEMPLATE=default -e PORT=6688 -p 6688:6688 -d wyyxdgm/gitlab-dingtalk\n```\n\n### Docker Compose\n\nCreate docker-compose.yml as follows:Replace `${access_token}` with the robot's `access_token`.\n\n```yml\nversion: \"3\"\nservices:\n  app:\n    image: \"wyyxdgm/gitlab-dingtalk\"\n    restart: always\n    container_name: gitlab-dingtalk\n    ports:\n      - \"6688:6688\"\n    environment:\n      - ACCESS_TOKEN=${access_token}\n      - PORT=6688\n      - TEMPLATE=default\n    command: [\"npm\", \"start\"]\n```\n\nExecute\n\n```bash\n# Start up\ndocker compose -f docker-compose.yml up -d\n# Shut down\ndocker compose -f docker-compose.yml down\n```\n\n## Message Templates\n\n### Default Template\n\nThe default template file is at `src/templates/default/index.js`, you can directly modify it according to the [Template Standard](./src/templates/README.md). The code is as follows:\n\n```js\n/**\n * text type\n * text String Required Text content\n * isAtAll Optional Whether copying everyone or not\n */\nfunction text(text = \"\", isAtAll = false) {\n  return {\n    msgtype: \"text\",\n    text: {\n      content: text,\n    },\n    at: {\n      isAtAll: isAtAll,\n    },\n  };\n}\n\n/**\n * link type\n * text String Required Text content\n * title String Required Message title\n * picUrl String Required Display picture\n * messageUrl String Required URL to be redirected after clicking the message\n */\nfunction link(linkObject) {\n  return {\n    msgtype: \"link\",\n    link: linkObject,\n  };\n}\nmodule.exports = {\n  _: (_) =\u003e text(`gitlab event[${_.object_kind}]`), // default\n  push: (_) =\u003e\n    link({\n      text: _.commits.map((c) =\u003e c.message).join(\"\\n\"),\n      title: `gitlab event[${_.object_kind}] by ${_.user_name}`,\n      picUrl: `${_.user_avatar}`,\n      messageUrl: `${_.repository.homepage}/commit/${_.checkout_sha}`,\n    }), // Push event\n  tag: () =\u003e\n    link({\n      text: `tag:${_.ref}`,\n      title: `gitlab event[${_.object_kind}] by ${_.user_name}`,\n      picUrl: `${_.user_avatar}`,\n      messageUrl: `${_.repository.homepage}/tags/${_.ref.replace(\"refs/tags/\", \"\")}`,\n    }), // Tag event\n  issues: () =\u003e null, // Issues event\n  coc: () =\u003e null, // Applying default, comment on commit event\n  comr: () =\u003e null, // Applying default, comment on MR event\n  coi: () =\u003e null, // Applying default, comment on issue event\n  cocs: () =\u003e null, // Applying default, comment on code snippet event\n};\n```\n\n### Local Custom Template\n\n1. Choose a local directory as the template directory, for example `./default`\n2. Copy a version of [src/templates/default/index.js](src/templates/default/index.js) to `./default/index.js`.\n3. Refer to [src/templates/README.md](./src/templates/README.md) to adjust the content of `./default/index.js`\n\n4. Start it up using the following method:\n\n- Docker\n\nReplace `./default` with the path of the local template folder and `${access_token}`, then execute\n\n```bash\ndocker run --privileged -e ACCESS_TOKEN=${access_token} \\\n-e TEMPLATE=default -e PORT=6688 -p 6688:6688 \\\n-v ./default:/opt/app/src/templates/default \\\n-d wyyxdgm/gitlab-dingtalk\n```\n\n- Docker Compose\n\nCreate a new file `docker-compose.yml`, the content is as follows:\n\n```yml\nversion: \"3\"\nservices:\n  app:\n    image: \"wyyxdgm/gitlab-dingtalk\"\n    restart: always\n    container_name: gitlab-dingtalk\n    ports:\n      - \"6688:6688\"\n    environment:\n      - ACCESS_TOKEN=${access_token}\n      - PORT=6688\n      - TEMPLATE=default\n    volumes:\n      - ./default:/opt/app/src/templates/default\n    privileged: true\n    command: [\"npm\", \"start\"]\n```\n\nReplace `./default` with your local template folder path and `${access_token}`, then execute.\n\n```bash\n# Start up\ndocker compose -f docker-compose.yml up -d\n```\n\n### Multiple Local Templates\n\nCreate a new `templates` folder, for storing multiple template folders as follows:\n\n```bash\n./templates\n├── default\n│   └── index.js\n├── template1\n│   └── index.js\n└── template2\n    └── index.js\n```\n\n- Docker\n\nReplace `${template_name}` with the name of the local template subfolder, and `${access_token}`, then execute.\n\n```bash\ndocker run --privileged -e ACCESS_TOKEN=${access_token} \\\n-e TEMPLATE=${template_name} -e PORT=6688 -p 6688:6688 \\\n-v ./tempaltes:/opt/app/src/templates \\\n-d wyyxdgm/gitlab-dingtalk\n```\n\n- Docker Compose\n\nThe content of `docker-compose.yml` is as follows:\n\n```yml\nversion: \"3\"\nservices:\n  app:\n    image: \"wyyxdgm/gitlab-dingtalk\"\n    restart: always\n    container_name: gitlab-dingtalk\n    ports:\n      - \"6688:6688\"\n    environment:\n      - ACCESS_TOKEN=${access_token}\n      - PORT=6688\n      - TEMPLATE=${template_name}\n    volumes:\n      - ./tempaltes:/opt/app/src/templates\n    privileged: true\n    command: [\"npm\", \"start\"]\n```\n\nReplace `./templates` with your local templates folder path, replace the template name `${template_name}`, and `${access_token}`, then execute.\n\n```bash\n# Start up\ndocker compose -f docker-compose.yml up -d\n```\n\n## Event List\n\nRefer to local gitlab `${host}/help/web_hooks/web_hooks`, For more detail events data, please refer to[EVENT.md](./src/templates/EVENT.md)\n\n- [Push events](#push-events)\n- [Tag events](#tag-events)\n- [Issues events](#issues-events)\n- [Comment on commit](#comment-on-commit)\n- [Comment on merge request](#comment-on-merge-request)\n- [Comment on issue](#comment-on-issue)\n- [Comment on code snippet](#comment-on-code-snippet)\n- [Merge request events](#merge-request-events)\n\n#### Push events\n\n- header: `X-Gitlab-Event: Push Hook`\n- default template: Link\n\n#### Tag events\n\n- header: `X-Gitlab-Event: Tag Push Hook`\n- default template: Link\n\n#### Issues events\n\n- header: `X-Gitlab-Event: Issue Hook`\n- default template: Text\n\n#### Comment on commit\n\n- header: `X-Gitlab-Event: Note Hook`\n- default template: Text\n\n#### Comment on merge request\n\n- header: `X-Gitlab-Event: Note Hook`\n- default template: Text\n\n#### Comment on issue\n\n- header: `X-Gitlab-Event: Note Hook`\n- default template: Text\n\n#### Comment on code snippet\n\n- header: `X-Gitlab-Event: Merge Request Hook`\n- default template: Text\n\n#### Merge request events\n\n- header: `X-Gitlab-Event: Merge Request Hook`\n- default template: Link\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyyxdgm%2Fgitlab-dingtalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwyyxdgm%2Fgitlab-dingtalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwyyxdgm%2Fgitlab-dingtalk/lists"}