PHP code example of payprocessing / chat2desk

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

    

payprocessing / chat2desk example snippets


use Platron\Chat2desk\services\messages\MessagesPostServiceRequest;
use Platron\Chat2desk\services\messages\MessagesPostServiceResponse;
use Platron\Chat2desk\services\BaseServiceRequest;

$service = new MessagesPostServiceRequest();
$service->setClientId(1);
$service->setText('Test');
$service->setTransport(BaseServiceRequest::TRANSPORT_WHATSAPP);
$response = new MessagesPostService(Response$service->sendRequest('token'));

use Platron\Chat2desk\services\clients\ClientsGetServiceRequest;
use Platron\Chat2desk\services\clients\ClientsGetServiceResponse;

$service = new ClientsGetServiceRequest();
$service->setPhone($this->phoneTo);
$response = new MessagesPostServiceResponse($service->sendRequest('token'));

use Platron\Chat2desk\services\clients\ClientsPostServiceRequest;
use Platron\Chat2desk\services\clients\ClientsPostServiceResponse;
use Platron\Chat2desk\services\BaseServiceRequest;

$service = new ClientsPostServiceRequest();
$service->setPhone('79050000000');
$service->setTransport(BaseServiceRequest::TRANSPORT_WHATSAPP);
$response = new ClientsPostServiceResponse($service->sendRequest($this->authString));