PHP code example of dingq / byrobot

1. Go to this page and download the library: Download dingq/byrobot 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/ */

    

dingq / byrobot example snippets




use BYRobot\Core\Company;

$config = [
    'app_key'=> 'xxxxxxx',
    'app_secret' => 'xxxxxxxxxxxxxxxxxxxxx',
];

$companyLib = new Company($config);

// 获取公司列表
$companyLib->getCompanys();

// 获取公司的主叫电话列表接口
$companyLib->getPhones('公司ID');

// 获取公司的机器人话术列表接口
$companyLib->getRobots('公司ID', '0:所有话术,1:已上线话术,默认0');



use BYRobot\Core\Task;

$config = [
    'app_key'=> 'xxxxxxx',
    'app_secret' => 'xxxxxxxxxxxxxxxxxxxxx',
];


$taskLib = new Task($config);

// 创建任务
$taskData = []; // 详见文档
$taskLib->createTask($taskData);

// 编辑任务
$taskId = 8888; // 详见文档
$editData = []; // 详见文档
$taskLib->createTask($taskId, $editData);


// 设置任务开始
$taskLib->start('任务ID');

// 暂停任务接口
$taskLib->pause('任务ID');

// 删除任务
$taskLib->delete('任务ID');


// 向任务中导入客户接口
$phones = [
    [
        'name'=> 'DQ',
        'phone'=> 'xxxxxxx',    
    ],
    [
        'name'=> 'DQ1',
        'phone'=> 'xxxxxxxxxxx',    
    ],
];
$taskLib->importTaskCustomer('任务ID', '公司ID', $phones);




use BYRobot\Core\Query;

$config = [
    'app_key'=> 'xxxxxxx',
    'app_secret' => 'xxxxxxxxxxxxxxxxxxxxx',
];

$taskLib = new Query($config);

// 获取任务详情接口
$taskLib->getTaskDetail('公司ID', '任务ID');