PHP code example of cyzonetech / dingtalk

1. Go to this page and download the library: Download cyzonetech/dingtalk library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

cyzonetech / dingtalk example snippets


$dd = new \Everalan\DingTalk\DingTalk([
    'appKey' => 'dingxxxxx',
    'appSecret' => 'Y75DULKtrpu_xxxxx',
]);

$message = new \Everalan\DingTalk\Messages\Text('@张三 测试消息');
$dd->sendWorkNotice('024246103336342620', $message, 241709217);

$message = new \Everalan\DingTalk\Messages\ActionCard('公司春游你参加吗?', 'markdown text');
$message->addButton('参加', 'http://www.baidu.com');
$message->addButton('拒绝', 'http://www.weibo.cn');
$message->btnOrientation(1);

$dd->sendBot('c02ff0eb36f41a6ecd753xxxxxxxxxx',$message);