PHP code example of semivan / bothelp-api-client

1. Go to this page and download the library: Download semivan/bothelp-api-client 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/ */

    

semivan / bothelp-api-client example snippets


$client = new \Bothelp\BothelpClient($clientId, $clientSecret);

// Получить всех подписчиков
$subscribers = $client->subscribers()->getAll();

// Добавить подписчику теги
$client->subscribers()->addTags($subscriberId, ['tag1', 'tag2', 'tag3']);

// Удалить у подписчика теги
$client->subscribers()->removeTags($subscriberId, ['tag1', 'tag2']);

// Изменить полное имя подписчика
$client->subscribers()->replaceName($subscriberId, 'name');

// Изменить имя подписчика
$client->subscribers()->replaceFirstName($subscriberId, 'firstname');

// Изменить фамилию подписчика
$client->subscribers()->replaceLastName($subscriberId, 'lastname');

// Изменить номер телефона подписчика
$client->subscribers()->replacePhone($subscriberId, '+71234567890');

// Изменить email подписчика
$client->subscribers()->replaceEmail($subscriberId, '[email protected]');

// Изменить заметку подписчика
$client->subscribers()->replaceNote($subscriberId, 'note');

// Изменить пользовательское поле подписчика
$client->subscribers()->replaceCustomField($subscriberId, 'custom field value');

// Отправить подписчику сообщение
$client->subscribers()->sendMessage($subscriberId, 'message text');