jtrw/voiptime-cleint

Client for Voiptime service

1.0.1 2022-02-08 16:20 UTC

This package is auto-updated.

Last update: 2024-10-29 06:25:28 UTC


README

Install

composer require jtrw/voiptime-cleint

Documentations

api.voiptime.net

Implemented

Implemented methods

  1. /clients/exec.do - createClients
  2. /tacs/campaigns/{$campaignID}/exec.do - addClientToTacsByCampaignId

Use

require 'vendor/autoload.php';

use GuzzleHttp\Client;
use Jtrw\Voiptime\Voiptime;
use Jtrw\Voiptime\VoipClient;
use Jtrw\Voiptime\Client\VoipClientFields;
use Jtrw\Voiptime\Client\VoipClientPhone;

$voip = new Voiptime(
    new Client(['http_errors' => false]),
    $login,
    $password
);

$result = $voip->createClients(
    true,
    new VoipClient(
        1,
        'SIMPLE',
        'Europe/Kiev',
        new VoipClientFields([
            "id"        => 0,
            "firstname" => "test",
            "lastname"  => "Test",
        ]),
        [new VoipClientPhone('380991117978', VoipClientPhone::PHONE_TYPE_MOBILE, true)]
    )
);

$clients = [
    [
        'clientIdentifiers' => [
            'id' => $result['createResult'][0]['createdClientId'] ?? 0
        ],
    ]
];
$result = $voip->addClientToTacsByCampaignId(
    108,
    10,
    false,
    $clients
);