https://github.com/chenxi2015/dingtalkservice
钉钉的企业api封装包
https://github.com/chenxi2015/dingtalkservice
api composer dingding dingtalk dingtalk-service php service
Last synced: about 1 year ago
JSON representation
钉钉的企业api封装包
- Host: GitHub
- URL: https://github.com/chenxi2015/dingtalkservice
- Owner: chenxi2015
- License: mit
- Created: 2019-07-24T02:33:43.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-08-02T02:50:05.000Z (almost 7 years ago)
- Last Synced: 2024-11-07T07:05:55.092Z (over 1 year ago)
- Topics: api, composer, dingding, dingtalk, dingtalk-service, php, service
- Language: PHP
- Homepage:
- Size: 78.1 KB
- Stars: 4
- Watchers: 0
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# dingtalkService
钉钉的企业api封装包
[](https://packagist.org/packages/chenxi2015/dingtalk-service)
[](https://packagist.org/packages/chenxi2015/dingtalk-service)
[](https://packagist.org/packages/chenxi2015/dingtalk-service)
[](https://packagist.org/packages/chenxi2015/dingtalk-service)
## Installation
The recommended way to install dingtalk-service is through [Composer](https://getcomposer.org/).
```php
# Install Composer
curl -sS https://getcomposer.org/installer | php
```
Next, run the Composer command to install the latest stable version of dingtalk-service:
```php
php composer.phar require chenxi2015/dingtalk-service
# OR
composer require chenxi2015/dingtalk-service
```
## Help and docs
[钉钉服务端API](https://ding-doc.dingtalk.com/doc#/serverapi2/gh60vz)
## Robot API
#### sendRobotMsg
```php
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');
```