1. Go to this page and download the library: Download bigperson/kontur-talk-sdk 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/ */
bigperson / kontur-talk-sdk example snippets
use Kontur\Talk\TalkClient;
// Создание клиента API
$client = new TalkClient('company', 'your-api-key');
// Получение информации о комнате
$room = $client->rooms->get('room-key');
// Создание или обновление комнаты (тело — как в TalkRoomParams спецификации)
$room = $client->rooms->createOrUpdate('room-key', [
'title' => 'Демо для клиента',
'description' => 'Обсуждение условий',
'moderatorKeys' => ['user-key-1', 'user-key-2'],
'allowAnonymous' => true,
'anonymousAccessExpirationDate' => '2026-12-31T23:59:59Z',
'enableLobby' => true,
'audioPolicy' => 'none',
'videoPolicy' => 'none',
'screenSharePolicy' => 'none',
]);
// Установка PIN-кода
$client->rooms->setPinCode('room-key', '123456');
// Снятие PIN-кода
$client->rooms->setPinCode('room-key', null);
// Принудительное завершение конференции для всех участников
$client->rooms->endConference('room-key');
// Создание встречи в календаре организатора
$event = $client->calendar->createEvent('[email protected]', [
'start' => '2026-09-01T10:00:00Z',
'end' => '2026-09-01T11:00:00Z',
'subject' => 'Демо для клиента',
'roomName' => 'room-key',
'enableAutoRecording' => true,
''], [
'start' => '2026-09-01T10:30:00Z',
'end' => '2026-09-01T11:30:00Z',
'subject' => 'Демо для клиента',
'roomName' => 'room-key',
]);
// Изменение состава участников
$client->calendar->updateAttendees('[email protected]', $event['id'], [
'
// Батчевый опрос комнат за период (до 50 комнат за вызов)
$history = $client->conferencesHistory->list(
fromDate: '2026-09-01T00:00:00Z',
roomNames: ['room-key-1', 'room-key-2']
);
// Конференция по ключу
$conference = $client->conferencesHistory->get('conference-key');
// Конференция с артефактами: записи, заметки, опросы, доски
$enriched = $client->conferencesHistory->getArtifacts('conference-key');
foreach ($enriched['artifacts']['recordings'] as $recording) {
echo $recording['id'], ' ', $recording['status'], PHP_EOL;
}
use Kontur\Talk\Enum\SummaryType;
// Список записей пространства
$page = $client->recordings->listDomain(['top' => 20, 'orderMode' => 'byTimeNewFirst']);
// Запись по ключу
$recording = $client->recordings->getDomain('recording-key');
// Транскрипт
$transcript = $client->recordings->transcript('recording-key');
// Саммари (краткое содержание или протокол)
$summary = $client->recordings->summary('recording-key', SummaryType::ShortSummary->value);
// Транскрипт + оба саммари одним вызовом
$composite = $client->recordings->composite('recording-key');
// Права доступа к записи
$access = $client->recordings->getAccess('recording-key');
$client->recordings->patchAccess(
'recording-key',
userAccesses: [['userKey' => 'user-key', 'roleId' => 'viewer']],
linkScope: 'domain'
);
// Адрес файла, без скачивания (запрос идёт без автоследования за редиректом)
$url = $client->downloadUrl('recording-key', '900p');
// Тело файла потоком
$stream = $client->download('recording-key', '900p');
file_put_contents('recording.mp4', $stream);
// Постраничный перебор всех пользователей пространства
$page = $client->users->scan(top: 100);
// Поиск по фильтрам (email — повторяющийся параметр)
$found = $client->users->search([
'email' => ['[email protected]', '[email protected]'],
]);
// Пользователь по ключу
$user = $client->users->getByKey('user-key');
use Kontur\Talk\Enum\WebhookEventType;
// Список активных вебхуков пространства
$webhooks = $client->webhooks->getList();
// Создание вебхука
$webhook = $client->webhooks->create([
'title' => 'Записи в CRM',
'url' => 'https://example.com/talk/webhook',
'events' => [
WebhookEventType::RecordingCompleted->value,
WebhookEventType::ConferencesFinished->value,
],
'customHeaders' => [
['name' => 'X-Project-Token', 'value' => 'secret'],
],
]);
echo $webhook['webhookKey'];
var_dump($webhook['activated']); // false — ждём ключ активации на своём URL
// Активация ключом, пришедшим на URL вебхука
$client->webhooks->activate($webhook['webhookKey'], ['activationKey' => $activationKey]);
// Удаление
$client->webhooks->delete($webhook['webhookKey']);
// Отчёт по комнате за период (to необязателен — по умолчанию по текущее время)
$report = $client->roomReport->statisticsReport(
'room-key',
'2026-09-01T00:00:00Z',
'2026-09-30T00:00:00Z'
);
echo $report['participantCount'];
foreach ($report['roomParticipants'] as $participant) {
// exitTime приходит пустым, если участник ещё в комнате
echo $participant['participantName'], ' ',
$participant['entryTime'], ' — ', $participant['exitTime'] ?? '…', PHP_EOL;
}
use Kontur\Talk\Exception\TalkApiException;
use Kontur\Talk\Exception\TalkClientException;
use Kontur\Talk\Exception\TalkRateLimitException;
use Kontur\Talk\Exception\TalkNotFoundException;
try {
$room = $client->rooms->get('room-key');
} catch (TalkNotFoundException $e) {
// Ресурс не найден
echo "Ресурс не найден: " . $e->getMessage();
} catch (TalkRateLimitException $e) {
// Превышены ограничения по количеству запросов
echo "Превышен лимит запросов к API: " . $e->getMessage();
} catch (TalkApiException $e) {
// Ошибка API (400-499)
echo "Ошибка API: " . $e->getMessage();
} catch (TalkClientException $e) {
// Общая ошибка клиента
echo "Ошибка клиента: " . $e->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.