PHP code example of wisembly / intercom-php

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

    

wisembly / intercom-php example snippets


use GuzzleHttp\Client as Guzzle;
use Intercom\Client\User as Intercom;

$guzzleHttp = new Guzzle;
$intercom = new Intercom('APP_ID', 'API_KEY', $guzzle);

use Intercom\Object\User;

$user = new User(1, '[email protected]'); // user_id or email
$intercom->create($user);

use Intercom\Object\User;

$user = new User(1, '[email protected]'); // user_id or email
$intercom->update($user);

use Intercom\Object\User;

$user = new User(1, '[email protected]'); // user_id or email
$intercom->delete($user);

$user = $intercom->get(1, '[email protected]'); // user_id or email

use Intercom\Request\Search\UserSearch;

// Retrieve the first ten users with tag name "premium"
$search = new UserSearch(1, 10, null, 'premium');

$users = $intercom->search($search);

use GuzzleHttp\Client as Guzzle;
use Intercom\Request\UserSearch;
use Intercom\Client\User as Intercom;

// Create the client
$guzzle = new Guzzle;
$intercom = new Intercom('APP_ID', 'API_KEY', $guzzle);

// Create a search with defaut parameters
$search = new UserSearch;

$users = [];

// Fetch all users
do {
    $response = $intercom->search($search);
    $users = array_merge($users, $response->getContent());
    $search->setPage($response->getNextPage());
} while ($response->hasPageToBeFetch());
yml
  {
    "mbly/intercom-php": "*",
    }
  }