{"id":15023129,"url":"https://github.com/baiyutang/dingtalk-chatbot","last_synced_at":"2025-04-09T19:52:48.860Z","repository":{"id":62491298,"uuid":"196858928","full_name":"baiyutang/dingtalk-chatbot","owner":"baiyutang","description":"The sdk for dingtalk chat robot. developed by object-oriented method. 钉钉群自定义机器人: 采用面向对象的开发方法","archived":false,"fork":false,"pushed_at":"2020-06-23T03:58:13.000Z","size":283,"stargazers_count":19,"open_issues_count":1,"forks_count":7,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-23T21:51:54.425Z","etag":null,"topics":["dingtalk","dingtalk-robot","dingtalk-sdk","php","php-library","php5","php7"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/baiyutang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-07-14T16:25:07.000Z","updated_at":"2022-02-12T06:49:41.000Z","dependencies_parsed_at":"2022-11-02T11:30:56.408Z","dependency_job_id":null,"html_url":"https://github.com/baiyutang/dingtalk-chatbot","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baiyutang%2Fdingtalk-chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baiyutang%2Fdingtalk-chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baiyutang%2Fdingtalk-chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/baiyutang%2Fdingtalk-chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/baiyutang","download_url":"https://codeload.github.com/baiyutang/dingtalk-chatbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248103915,"owners_count":21048244,"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","dingtalk-sdk","php","php-library","php5","php7"],"created_at":"2024-09-24T19:58:45.505Z","updated_at":"2025-04-09T19:52:48.839Z","avatar_url":"https://github.com/baiyutang.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DingtalkChatBot 钉钉群自定义机器人\n\n采用面向对象的开发方法\n\n## 功能列表\n- [x] 实现原始 text / markdown / link / action card 类型消息发送\n- [x] 消息设置可支持链式调用\n- [x] 单独设置 @ 的数据，亦可链式调用设置多个 @ 的手机号。注意：设置 @ 所有人时，@ 单独手机号会失效\n- [x] 发送群可指根据配置随意指定\n- [x] 机器人token均可配置\n\n## 用法\n\u003e 1. `git clone git@github.com:baiyutang/dingtalk-robot.git` 或 `composer require baiyutang/dingtalk-robot`\n\u003e 2. `src/config.php` 文件中 `$groups` 数组中，修改钉钉群机器人为推送的目标群 token\n\u003e 3. 参照示例组装代码\n\n## 配置钉钉群的两种方式\n* 修改 `Config.php` 文件中数组，配置 `array('group_name'=\u003e'...your token...')`，然后 `$client = new ChatBot('group_name')`;\n* 支持直接指定token，当 `$client = new ChatBot('param')`，当构造函数接收到的参数不在 `Config.php` 的 `$groups` 数组的键中，会被认定是一个 token\n\n## 示例\n```php\n// text 类型\nuse DingTalkRobot\\At;\nuse DingTalkRobot\\GroupChat;\nuse DingTalkRobot\\Messages\\TextMessage;\nuse DingTalkRobot\\ChatBot;\n\n// 链式调用设置 @ 多个手机号\n$at = new At();\n$at-\u003esetMobile('181****3753')\n    -\u003esetMobile('181****3751');\n\n// 链式调用设置消息内容\n$message = new TextMessage();\n$message-\u003esetContent('我就是我, 是不一样的烟火')\n    -\u003esetAt($at);\n\n$client = new ChatBot();\n// 可以指定群，若不设置则发送默认的群\n$client-\u003esend($message, new GroupChat('other'));\n```\n---\n```php\n// markdown 类型\nuse DingTalkRobot\\GroupChat;\nuse DingTalkRobot\\Messages\\MarkdownMessage;\nuse DingTalkRobot\\ChatBot;\n\n$markdown = new MarkdownMessage();\n$markdown-\u003esetTitle('杭州天气')\n    -\u003esetText(\"#### 杭州天气\\n\" .\n        \"\u003e 9度，西北风1级，空气良89，相对温度73%\\n\" .\n        \"\u003e ![screenshot](http://tinyurl.com/y4lbucte)\\n\" .\n        \"\u003e 10点20分发布 [天气](http://www.thinkpage.cn/)\");\n\n$client = new ChatBot();\n\n$client-\u003esend($markdown, new GroupChat());\n```\n## 相关\n* [钉钉开发文档：自定义机器人](https://open-doc.dingtalk.com/microapp/serverapi2/qf2nxq#-9)\n\n## License\n[MIT license](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaiyutang%2Fdingtalk-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbaiyutang%2Fdingtalk-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbaiyutang%2Fdingtalk-chatbot/lists"}