Sign Up and Get Started Today

Sample Code

  1. Tactile API PHP Class

If you'd like to share with us any libraries you've written, in any language, or would just like to chat about the API in general, please contact us at support@tactilecrm.com.

Tactile API PHP Class

Download as a .zip or as a .tar.gz file. Packaged with PHPDoc documentation and the required components of the Zend Framework.

Fetching Organisations

require_once 'Tactile/Api.php';

$api = new Tactile_Api('site_address', 'api_token');

$query = array('limit' => 5);
$orgs = $api->getOrganisations($query);
print_r($orgs);

The above code should output:

stdClass Object
(
    [status] => success
    [organisations] => Array
        (
            [0] => stdClass Object
                (
                    [name] => Example Company
                    ...
                )
            ...
            [4] => stdClass Object
                (
                    [name] => Yet Another Example Company
                    ...
                )
        )
    [cur_page] => 1
    [num_pages] => 78
    [per_page] => 5
    [total] => 390
)

Saving a Note Against a Person

require_once 'Tactile/Api.php';
require_once 'Tactile/Api/Note.php';

$api = new Tactile_Api('site_address', 'api_token');

$note = new Tactile_Api_Note();
$note->person_id = 2;
$note->title = 'Bob Rang';
$note->note = 'He wanted to talk about the servers.'; 

$result = $api->saveNote($note);
print_r($result);

The above code should output:

stdClass Object
(
    [status] => success
    [id] => 1234
)