ritaswc / dingtalk-robot
轻松发送钉钉机器人消息
1.0.4
2020-11-23 11:58 UTC
Requires
- ext-curl: *
- ext-json: *
README
无需其他PHP库即可轻松发送钉钉机器人消息
用法
composer require ritaswc/dingtalk-robot
发送消息
$accessToken = '2d1bf0b300...'; $secret = 'SEC7a90caf...'; $isAtAll = false; $atMobiles = ['130****6666', '188****8888']; $robot = new \Ritaswc\DingtalkRobot\DingtalkRobot($accessToken, $secret); $robot->sendText('PHP is the best language in the world!', $isAtAll, $atMobiles); $robot->sendLink('Charles的小星球', '基于wordpress...', 'https://blog.yinghualuo.cn', ''); $robot->sendMarkdown( '杭州天气', '#### 杭州天气 @150XXXXXXXX \n> 9度,西北风1级,空气良89,相对温度73%\n> \n> ###### 10点20分发布 [天气](https://blog.yinghualuo.cn) \n', $isAtAll, $atMobiles ); $robot->sendSingleActionCard( '乔布斯 20 年前想打造一间苹果咖啡厅,而它正是 Apple Store 的前身', ' ### 乔布斯 20 年前想打造的苹果咖啡厅 Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划', '阅读全文', 'https://blog.yinghualuo.cn', '0' ); $robot->sendMultiActionCard( '乔布斯 20 年前想打造一间苹果咖啡厅,而它正是 Apple Store 的前身', ' ### 乔布斯 20 年前想打造的苹果咖啡厅 Apple Store 的设计正从原来满满的科技感走向生活化,而其生活化的走向其实可以追溯到 20 年前苹果一个建立咖啡馆的计划', '0', [[ 'title' => '内容不错', 'actionURL' => 'https://blog.yinghualuo.cn' ], [ 'title' => '不感兴趣', 'actionURL' => 'https://www.dingtalk.com' ]] ); $robot->sendFeedCard([ [ 'title' => '时代的火车向前开', 'messageURL' => 'https://www.dingtalk.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI', 'picURL' => 'https://gw.alicdn.com/tfs/TB1ayl9mpYqK1RjSZLeXXbXppXa-170-62.png', ], [ 'title' => '时代的火车向前开2', 'messageURL' => 'https://www.dingtalk.com/s?__biz=MzA4NjMwMTA2Ng==&mid=2650316842&idx=1&sn=60da3ea2b29f1dcc43a7c8e4a7c97a16&scene=2&srcid=09189AnRJEdIiWVaKltFzNTw&from=timeline&isappinstalled=0&key=&ascene=2&uin=&devicetype=android-23&version=26031933&nettype=WIFI', 'picURL' => 'https://gw.alicdn.com/tfs/TB1ayl9mpYqK1RjSZLeXXbXppXa-170-62.png', ] ]);
作者博客
钉钉文档
许可协议
MIT