{"id":16019509,"url":"https://github.com/fjc0k/notify-dingtalk","last_synced_at":"2025-03-18T03:31:24.970Z","repository":{"id":96343037,"uuid":"320486798","full_name":"fjc0k/notify-dingtalk","owner":"fjc0k","description":"钉钉群 Markdown 消息通知。","archived":false,"fork":false,"pushed_at":"2020-12-28T06:29:42.000Z","size":156,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-10T15:06:31.791Z","etag":null,"topics":["dingtalk","dingtalk-robot"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fjc0k.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","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":"2020-12-11T06:26:14.000Z","updated_at":"2021-11-09T07:05:46.000Z","dependencies_parsed_at":"2023-05-29T06:15:48.805Z","dependency_job_id":null,"html_url":"https://github.com/fjc0k/notify-dingtalk","commit_stats":{"total_commits":10,"total_committers":1,"mean_commits":10.0,"dds":0.0,"last_synced_commit":"b8b55b9c2e7e22ca7ff6a5c7c297964fda2d53fc"},"previous_names":[],"tags_count":5,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjc0k%2Fnotify-dingtalk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjc0k%2Fnotify-dingtalk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjc0k%2Fnotify-dingtalk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fjc0k%2Fnotify-dingtalk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fjc0k","download_url":"https://codeload.github.com/fjc0k/notify-dingtalk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243896636,"owners_count":20365407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["dingtalk","dingtalk-robot"],"created_at":"2024-10-08T17:04:37.966Z","updated_at":"2025-03-18T03:31:24.652Z","avatar_url":"https://github.com/fjc0k.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# notify-dingtalk\n\n钉钉群 Markdown 消息通知。\n\n## 安装\n\n```bash\nnpm i notify-dingtalk -D\n```\n\n国内推荐使用 [tbify](https://github.com/fjc0k/tbify) 加速。\n\n## 使用\n\n在项目根目录创建配置文件 `notify-dingtalk.config.js`，然后导出配置即可：\n\n```javascript\nconst { defineConfig } = require('notify-dingtalk')\n\nmodule.exports = defineConfig({\n  accessToken: 'xxx',\n  secret: 'xxx',\n  title: '发布通知',\n  content: '**优化**: 添加属性',\n})\n```\n\n如果要通知到多个群，导出一个数组即可：\n\n```javascript\nconst { defineConfig } = require('notify-dingtalk')\n\nmodule.exports = [\n  defineConfig({\n    accessToken: 'xxx',\n    secret: 'xxx',\n    title: '发布通知',\n    content: '**优化**: 添加属性',\n  }),\n  defineConfig({\n    accessToken: 'xxx2',\n    secret: 'xxx2',\n    title: '发布通知',\n    content: '**优化**: 添加属性',\n  }),\n]\n```\n\n其中 `accessToken`、`secret` 也可以不用显式指定，而是分别通过环境变量 `D_ACCESS_TOKEN`、`D_SECRET` 设置。\n\n最后，执行以下命令发送通知到钉钉群：\n\n```bash\nnpx notify-dingtalk\n```\n\n效果如下：\n\n\u003cimg src=\"https://raw.githubusercontent.com/fjc0k/notify-dingtalk/master/preview.png\" width=\"400\" /\u003e\n\n### 一个更符合实际项目的示例\n\n如果你的更新日志是采用 [conventional-changelog](https://github.com/conventional-changelog/conventional-changelog) 生成的，可使用包提供的 `getLatestConventionalChangelog` 方法获取最新的更新日志。\n\n```javascript\nconst {\n  defineConfig,\n  getLatestConventionalChangelog,\n} = require('notify-dingtalk')\nconst { dedent } = require('vtils')\n\nmodule.exports = defineConfig({\n  accessToken: '******',\n  secret: '******',\n  title: '发布公告',\n  content: dedent`\n    # 发布公告\n\n    ---\n\n    ${getLatestConventionalChangelog('./CHANGELOG.md')}\n\n    ---\n\n    [进入主页→](https://github.com/fjc0k/notify-dingtalk)\n  `,\n})\n```\n\n## 许可\n\nMIT (c) Jay Fong\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjc0k%2Fnotify-dingtalk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffjc0k%2Fnotify-dingtalk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffjc0k%2Fnotify-dingtalk/lists"}