infobot / apiv2
Infobot API
0.2.2
2018-11-20 15:20 UTC
Requires
- php: >=7.0
- ext-curl: *
This package is auto-updated.
Last update: 2024-09-21 04:50:41 UTC
README
安装
composer require infobot/apiv2
使用示例
$client = new \Infobot\Api\Client($token);
发送调用
调用类型:静态
$message = new \Infobot\Api\Messages\StaticMessage([ "to" => "79876543210", "text" => "Сообщение", "tts_voice" => "", "tts_speed" => "", ]); $response = $client->postMessages([ "body" => $message->toArray(), ]);
调用类型:动态
$message = new \Infobot\Api\Messages\DynamicMessage([ "to" => "79876543210", "scenary" => 10, ]); $response = $client->postMessages([ "body" => $message->toArray(), ]);
调用类型:音频
$message = new \Infobot\Api\Messages\AudioMessage([ "to" => "79876543210", "audio" => "http://examle.site.com/audio.mp3", ]); $response = $client->postMessages([ "body" => $message->toArray() ]);
获取用户(账号)信息
$response = $client->getUsers();
获取脚本列表
$response = $client->getScenaries();
按页面
$response = $client->getScenaries([ "query" => ["page" => 1] ]);
获取脚本信息
$response = $client->getScenaries([ "query" => [":id" => 1] ]);
从通话中获取变量值
按通话ID
$response = $client->getStatisticsVariables([ "query" => ["message" => 1] ]);
按custom_id
$response = $client->getStatisticsVariables([ "query" => ["user" => 1] ]);
按电话号码
$response = $client->getStatisticsVariables([ "query" => ["phone" => 79876543210] ]);
按电话号码分页
$response = $client->getStatisticsVariables([ "query" => [ "phone" => 79876543210, "page" => 1, ] ]);
获取通话统计信息
$response = $client->getMessages();
分页
$response = $client->getMessages([ "query" => ["page" => 1] ]);
按ID获取具体通话信息
$response = $client->getMessages([ "query" => [":id" => 1] ]);
从队列中删除(取消)通话
$response = $client->deleteMessages([ "query" => [":id" => 1] ]);
创建和编辑活动
创建
$campaing = new Infobot\Api\Campaigns\BaseCampaigns("Рога и Копыта"); $response = $client->postCampaigns([ "body" => $campaing->toArray(), ]);
重命名
$campaing = new Infobot\Api\Campaigns\BaseCampaigns("Рога и Копыта 2.0"); $response = $client->patchCampaigns([ "query" => [":id" => 1], "body" => $campaing->toArray(), ]);
获取活动信息
获取用户活动列表
$response = $client->getCampaigns();
按ID获取活动信息
$response = $client->getCampaigns([ "query" => [":id" => 1] ]);
获取财务统计信息
$response = $client->getStatisticsFinance([ "query" => [ "overall", ":from" => гггг-мм-дд, ":to" => гггг-мм-дд, ":campaign_id" => 10 ] ]);
激活“我的联系”服务(以使用自己的SIP电话服务)
$response = $client->postTrunks([ "query" => [ "activate" ], "body" => [], ]);
创建和管理事务
获取事务列表
$response = $client->getTrunks();
按ID获取事务信息
$response = $client->getTrunks([ "query" => [":id" => 1] ]);
创建事务
$param = [ "channels" => "10", "host" => "test.unknowntrunk.net", "login" => "admin", "password" => "qwerty", "title" => "Тестовый транк", ]; $trunk = new \Infobot\Api\Trunks\BaseTrunk($param); $response = $client->postTrunks([ "body" => $trunk->toArray(), ]);
删除事务
$response = $client->deleteTrunks([ "query" => [":id" => 1] ]);
更新事务
$param = [ "channels" => "10", "host" => "test.unknowntrunk.net", "login" => "admin", "password" => "qwerty", "title" => "Тестовый транк", ]; $trunk = new \Infobot\Api\Trunks\BaseTrunk($param); $response = $client->patchTrunks([ "query" => [":id" => 1], "body" => $trunk->toArray(), ]);
管理邮件列表
邮件列表列表
$response = $client->getDeliveries();
按页面
$response = $client->getDeliveries([ "query" => ["page" => 1] ]);
邮件列表信息
$response = $client->getDeliveries([ "query" => [":id" => 1] ]);
启动邮件列表
$response = $client->postDeliveries([ "query" => [":id" => 1], "body" => [], ]);
暂停邮件列表
$response = $client->postDeliveries([ "query" => [":id" => 1], "body" => [], ]);
创建邮件列表
$params = [ "aon" => 79876543210, "campaign_id" => 1, "client_timezone" => true, "d_type" => static, "detect_voicemail" => false, "group_id" => 1, "message" => "static text", "messages_per_packet" => 2, "name" => "Моя рассылка", "pause_between_packet" => 10, "scenary_id" => '', "speed" => 10, "time_to_send_start" => "10:00", "time_to_send_end" => "20:00", "trunk" => 12, "try_count" => 2, "try_timeout" => 10, "tts_speed" => 10, "voice" => "male", "file" => '' ]; $response = $client->postDeliveries([ "body" => $params, ]);
修改邮件列表
$params = [ "aon" => 79876543210, "campaign_id" => 1, "client_timezone" => true, "d_type" => static, "detect_voicemail" => false, "group_id" => 1, "message" => "static text", "messages_per_packet" => 2, "name" => "Моя рассылка", "pause_between_packet" => 10, "scenary_id" => '', "speed" => 10, "time_to_send_start" => "10:00", "time_to_send_end" => "20:00", "trunk" => 12, "try_count" => 2, "try_timeout" => 10, "tts_speed" => 10, "voice" => "male", "file" => '' ]; $response = $client->patchDeliveries([ "query" => [":id" => 1], "body" => $params, ]);
管理组
组列表
$response = $client->getGroups();
按页面
$response = $client->getGroups([ "query" => ["page" => 1] ]);
组信息
$response = $client->getGroups([ "query" => [":id" => 1] ]);
创建组
$params = [ "name" => "Имя группы" ]; $response = $client->postGroups([ "body" => $params, ]);
更新组
$params = [ "name" => "Имя группы" ]; $response = $client->patchGroups([ "query" => [":id" => 1], "body" => $params, ]);
管理联系人
联系人列表
$response = $client->getContacts();
按页面
$response = $client->getContacts([ "query" => ["page" => 1] ]);
联系人信息
$response = $client->getContacts([ "query" => [":id" => 1] ]);
按组获取联系人列表
$response = $client->getContacts([ "query" => [ "group", ":group_id" => 1 ] ]);
按页面
$response = $client->getContacts([ "query" => [ "group", ":group_id" => 1, "page" => 1 ] ]);
创建联系人
$params = [ "sex" => "male", "group_ids" => [1,2,3], "email" => "email@email.email", "fname" => "Фамилия", "lname" => "Имя", "mname" => "Отчество", "phone" => "79876543210", "var_1" => "var", "var_2" => "var", "var_3" => "var", "var_4" => "var", "var_5" => "var", ]; $response = $client->postContacts([ "body" => $params, ]);
更新联系人
$params = [ "sex" => "male", "group_ids" => [1,3], "email" => "email@email.email", "fname" => "Фамилия", "lname" => "Имя", "mname" => "Отчество", "phone" => "79876543210", "var_1" => "var", "var_2" => "var", "var_3" => "var", "var_4" => "var", "var_5" => "var", ]; $response = $client->patchContacts([ "query" => [":id" => 1], "body" => $params, ]);