PHP code example of repat / respond-io-client

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

    

repat / respond-io-client example snippets


$apiToken = '...'; // Get an API token from the website, one per channel
$options = []; // Guzzle Options - should probably be left empty, but just in case.
// ...
$client = new \Repat\RespondIoClient\Client($apiToken, $options);

// Get ID
$id = '...';

// Set identifying field to use for searches, creation and updates
$identifyingField = 'phone';

// If you know the ID
$client->getContactById($id);

$filter = new ContactFilter();
$filter->addFilter(
	field: 'phone',
	operator: 'isEqualTo',
	value: '+15551234567'
)
$client->getContacts($filter, $cursorId, $limit);

$fields = [
	'phone' => '+15557654321',
];

$client->updateContact($fields, $identifyingField);

$tags = ['foo', 'bar'];

$client->addTag($id, $tags);
$client->removeTag($id, $tags);

$fields = [
	'firstName' => 'John',
	'lastName' => 'Doe',
	'phone' => '+15551234567',
	'email' => '[email protected]'
	//
];

$client->createContact($fields, $identifyingField);

$client->sendMessage($id, $text);

$type = Client::TYPE_IMAGE; // 'image'

// OR:
// $type = Client::TYPE_AUDIO; // 'audio'
// $type = Client::TYPE_VIDEO; // 'video'
// $type = Client::TYPE_FILE; // 'file

$url = 'https://repat.de/Bilder/repat40x40.png';

$client->sendAttachment($id, $type, $url);