PHP code example of dbatten5 / textline-php

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

    

dbatten5 / textline-php example snippets



$apiKey = "ZZZZZZZZ"; // Your account api key
$email = "[email protected]"; // Email address of the agent
$password = "XXXXXX"; // Password associated with the email address above
$token = 'YYYYYYYY'; // Can be left null

$client = new Textline\Client($email, $password, $apiKey, $token);

$client->conversations()
       ->get();

$query = [
    'page' => 1,
    'page_size' => 20,
    'query' => 'foo',
];

$client->conversations()
       ->get($query);

$number = '0781234567';
$body = [
    'comment' => [
        'body' => 'foo'
    ]
];

$client->conversations()
       ->messageByPhone($number, $body);

$number = '07812345678';
$timestamp = 1551528788; # unix timestamp
$body = 'foo';
$params = [
    'group_uuid' => '123' # optional extra params
];

$client->conversations()
       ->scheduleByPhone($number, $timestamp, $body, $params);

$uuid = 'abc-123';

$client->conversation($uuid)
       ->retrieve();

$uuid = 'abc-123';
$body = [
    'comment' => [
        'body' => 'foo',
    ],
    'whisper' => [
        'body' => 'bar',
    ]
];

$client->conversation($uuid)
       ->message($body);

$uuid = 'abc-123';
$timestamp = 1551528788; # unix timestamp
$body = 'foo';

$client->conversation($uuid)
       ->scheduleMessage($timestamp, $body);

$uuid = 'abd-123';

$client->conversation($uuid)
       ->resolve();

$uuid = 'abd-123';

$client->conversation($uuid)
       ->transfer();

$client->customers()
       ->get();

$query = [
    'page' => 1,
    'page_size' => 20,
    'query' => 'foo',
];

$client->customers()
       ->get($query);

$number = '07812345678';
$attrs = [
    'email' => '[email protected]',
    'name' => 'John Mail',
];

$client->customers()
       ->create($number, $attrs);

$uuid = 'abc-123';

$client->customer($uuid)
       ->retrieve();

$uuid = 'abc-123';
$attrs = [
    'name' => 'John Smith',
    'email' => '[email protected]',
];

$client->customer($uuid)
       ->update($attrs);

$query = [
    'gnization()
       ->get($query);
bash
composer