钉钉的企业api封装包
The recommended way to install dingtalk-service is through Composer.
# Install Composer
curl -sS https://getcomposer.org/installer | phpNext, run the Composer command to install the latest stable version of dingtalk-service:
php composer.phar require chenxi2015/dingtalk-service
# OR
composer require chenxi2015/dingtalk-service use Gxheart\Http\Robot;
$robot = new Robot();
// text
echo $robot->sendRobotMsg('access_token', [
'content' => '这是内容',
'atMobiles' => [],
'isAtAll' => true
]);
// link
echo $robot->sendRobotMsg('access_token', [
'text' => '这是内容',
'title' => '这是标题',
'messageUrl' => '',
'picUrl' => ''
], 'link');
// markdown
echo $robot->sendRobotMsg('access_token', [
'text' => '这是内容',
'title' => '这是标题',
'atMobiles' => [],
'isAtAll' => true
], 'markdown');
// actionCard1
echo $robot->sendRobotMsg('access_token', [
'title' => '白白管家官网',
'text' => '
这是用户中心系统的钉钉服务层 author by cx',
'singleTitle' => '阅读全文',
'singleURL' => 'http://www.baibaiguanjia.com',
'btnOrientation' => 0,
'hideAvatar' => 0
], 'actionCard');
// actionCard2
echo $robot->sendRobotMsg('access_token', [
'title' => '白白管家官网',
'text' => '
这是用户中心系统的钉钉服务层 author by cx',
'btns' => [
[
"title" => "内容不错",
"actionURL" => "http://www.baibaiguanjia.com/"
],
[
"title" => "不感兴趣",
"actionURL" => "http://www.baibaiguanjia.com/"
]
],
'btnOrientation' => 0,
'hideAvatar' => 0
], 'actionCard');
// feedCard
echo $robot->sendRobotMsg('access_token', [
'links' => [
[
"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://www.dingtalk.com/"
],
[
"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://www.dingtalk.com/"
]
],
], 'feedCard');