PHPackages                             arquivei/intercom-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. arquivei/intercom-php

AbandonedArchivedLibrary[HTTP &amp; Networking](/categories/http)

arquivei/intercom-php
=====================

Intercom API client built on top of Guzzle 6

v3.2.1(7y ago)01.5kApache Version 2PHPPHP &gt;= 5.6

Since Sep 5Pushed 7y agoCompare

[ Source](https://github.com/arquivei/intercom-php)[ Packagist](https://packagist.org/packages/arquivei/intercom-php)[ RSS](/packages/arquivei-intercom-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (3)Versions (59)Used By (0)

[![Code Climate](https://camo.githubusercontent.com/783c5adbefb9ad22dff88d2ba5e6b405a9cc93a533d8544a931d80702b700896/68747470733a2f2f636f6465636c696d6174652e636f6d2f7265706f732f3533376461346137653330626130363262313031626539632f6261646765732f32616132356434373336663039663430323832652f6770612e737667)](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/feed) [![Build Status](https://camo.githubusercontent.com/b020a5dc24056fd5d73e801d80b52c76099450dfe5d2714ce78ac21ff68ea990/68747470733a2f2f7472617669732d63692e6f72672f696e746572636f6d2f696e746572636f6d2d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/intercom/intercom-php)

intercom-php
------------

[](#intercom-php)

> Official PHP bindings to the Intercom API

Installation
------------

[](#installation)

Requires PHP 5.6.

The recommended way to install intercom-php is through [Composer](https://getcomposer.org):

First, install Composer:

```
$ curl -sS https://getcomposer.org/installer | php

```

Next, install the latest intercom-php:

```
$ php composer.phar require intercom/intercom-php

```

Finally, you need to require the library in your PHP application:

```
require "vendor/autoload.php";
```

Clients
-------

[](#clients)

For OAuth or Access Tokens use:

```
use Intercom\IntercomClient;

$client = new IntercomClient(, null);
```

> If you already have an access token you can find it [here](https://app.intercom.com/developers/_). If you want to create or learn more about access tokens then you can find more info [here](https://developers.intercom.io/docs/personal-access-tokens).

> If you are building a third party application you can get your OAuth token by [setting-up-oauth](https://developers.intercom.io/page/setting-up-oauth) for Intercom.

Users
-----

[](#users)

```
/** Create a user */
$client->users->create([
  "email" => "test@example.com",
  "custom_attributes" => ['foo' => 'bar']
]);

/**
 * Update a user (Note: This method is an alias to the create method. In practice you
 * can use create to update users if you wish)
 */
$client->users->update([
  "email" => "test@example.com",
  "custom_attributes" => ['foo' => 'bar']
]);

/** Delete a user by ID */
$client->users->deleteUser("570680a8a1bcbca8a90001b9");

/** Get a user by ID */
$client->users->getUser("570680a8a1bcbca8a90001b9");

/** Add companies to a user */
$client->users->create([
  "email" => "test@example.com",
  "companies" => [
    [
      "company_id" => "3"
    ]
  ]
]);

/** Remove companies from a user */
$client->users->create([
  "email" => "test@example.com",
  "companies" => [
    [
      "company_id" => "3",
      "remove" => true
    ]
  ]
]);

/** Find a single user by email */
$client->users->getUsers(["email" => "bob@example.com"]);

/** List all users up to 10k records */
$client->users->getUsers([]);

/**
 * List all users (even above 10k records)
 * The result object contains an array of your user objects and a scroll_param which you can then
 * use to request the next 100 users. Note that the scroll parameter will time out after one minute
 * and you will need to make a new request
 */
$client->users->scrollUsers();
```

See [here](https://github.com/intercom/intercom-php#scroll) for more info on using the scroll parameter

Leads
-----

[](#leads)

```
/**
 * Create a lead
 * See more options here: https://developers.intercom.io/reference#create-lead
 */
$client->leads->create([
  "email" => "test@example.com",
  "custom_attributes" => ['foo' => 'bar']
]);

/**
 * Update a lead (Note: This method is an alias to the create method.
 * In practice you can use create to update leads if you wish)
 */
$client->leads->update([
  "email" => "test@example.com",
  "custom_attributes" => ['foo' => 'bar']
]);

/**
 * List leads
 * See more options here: https://developers.intercom.io/reference#list-leads
 */
$client->leads->getLeads([]);

/** Find a lead by ID */
$client->leads->getLead("570680a8a1bcbca8a90000a9");

/** Delete a lead by ID */
$client->leads->deleteLead("570680a8a1bcbca8a90000a9");

/** Convert a Lead to a User */
$client->leads->convertLead([
  "contact" => [
    "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
  ],
  "user" => [
    "email" => "winstonsmith@truth.org"
  ]
]);

/**
 * List all leads (even above 10k records)
 * The result object contains an array of your contacts objects and a scroll_param which you can then
 * use to request the next 100 leads. Note that the scroll parameter will time out after one minute
 * and you will need to make a new request
 */
$client->leads->scrollLeads();
```

See [here](https://github.com/intercom/intercom-php#scroll) for more info on using the scroll parameter

Visitors
--------

[](#visitors)

Retrieve `user_id` of a visitor via [the JavaScript API](https://developers.intercom.com/docs/intercom-javascript#section-intercomgetvisitorid)

```
/** Update a visitor */
$client->visitors->update([
  "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c",
  "custom_attributes" => ['foo' => 'bar']
]);

/** Find a visitor by ID */
$client->visitors->getVisitor("570680a8a1bcbca8a90000a9");

/** Find a visitor by User ID */
$client->visitors->getVisitor("", ["user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"]);

/** Delete a visitor by ID */
$client->visitors->deleteVisitor("570680a8a1bcbca8a90000a9");

/** Convert a Visitor to a Lead */
$client->visitors->convertVisitor([
  "visitor" => [
    "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
  ],
  "type" => "lead"
]);

/** Convert a Visitor to a User */
$client->visitors->convertVisitor([
  "visitor" => [
    "user_id" => "8a88a590-e1c3-41e2-a502-e0649dbf721c"
  ],
  "user" => [
    "email" => "winstonsmith@truth.org"
  ],
  "type" => "user"
]);
```

Tags
----

[](#tags)

```
/** List tags */
$client->tags->getTags();

/**
 * Tag users
 * See more options here: https://developers.intercom.io/reference#tag-or-untag-users-companies-leads-contacts
 */
$client->tags->tag([
  "name" => "Test",
  "users" => [
    ["id" => "1234"]
  ]
]);
```

Segments
--------

[](#segments)

```
/** List Segments */
$client->segments->getSegments();

/** View a segment */
$client->segments->getSegment("58a707924f6651b07b94376c");

/** View a segment with count */
$client->segments->getSegment("59c124f770e00fd819b9ce81", ["include_count"=>"true"]);
```

Events
------

[](#events)

```
/** Create an event */
$client->events->create([
  "event_name" => "testing",
  "created_at" => 1391691571,
  "email" => "test@example.com"
]);

/** View events for a user */
$client->events->getEvents(["email" => "bob@example.com"]);
```

Companies
---------

[](#companies)

```
/** Create a company */
$client->companies->create([
  "name" => "foocorp", "company_id" => "3"
]);

/**
 * Update a company (Note: This method is an alias to the create method.
 * In practice you can use create to update companies if you wish)
 */
$client->companies->update([
  "name" => "foocorp", "id" => "3"
]);

/** Creating or Update a company with custom attributes. */
$client->companies->update([
  "name" => "foocorp",
  "id" => "3",
  "custom_attributes" => [
    "foo" => "bar",
    "baz" => "qux"
  ]
]);

/** List Companies */
$client->companies->getCompanies([]);
```

Admins
------

[](#admins)

```
/** List admins */
$client->admins->getAdmins();
```

Messages
--------

[](#messages)

```
/**
 * Send a message from an admin to a user
 * See more options here: https://developers.intercom.io/reference#conversations
 */
$client->messages->create([
  "message_type" => "inapp",
  "subject" => "Hey",
  "body" => "Ponies, cute small horses or something more sinister?",
  "from" => [
    "type" => "admin",
    "id" => "1234"
  ],
  "to" => [
    "type" => "user",
    "email" => "bob@example.com"
  ]
]);
```

Conversations
-------------

[](#conversations)

```
/**
 * List conversations for an admin
 * See more options here: https://developers.intercom.io/reference#list-conversations
 */
$client->conversations->getConversations([
  "type" => "admin",
  "admin_id" => "25610"
]);

/** Get a single conversation */
$client->conversations->getConversation("1234")

/** Get a single conversation with plaintext comments */
$client->conversations->getConversation("1234", [
  "display_as" => "plaintext"
])

/**
 * Reply to a conversation
 * See more options here: https://developers.intercom.io/reference#replying-to-a-conversation
 */
$client->conversations->replyToConversation("5678", [
  "email" => "test@example.com",
  "body" => "Thanks :)",
  "type" => "user",
  "message_type" => "comment"
]);

/**
 * Reply to a user's last conversation
 * See more options here: https://developers.intercom.com/reference#replying-to-users-last-conversation
 */
$client->conversations->replyToLastConversation([
  "email" => "test@example.com",
  "body" => "Thanks :)",
  "type" => "user",
  "message_type" => "comment"
]);

/**
 * Mark a conversation as read
 * See API documentation here: https://developers.intercom.io/reference#marking-a-conversation-as-read
 */
$client->conversations->markConversationAsRead("7890");
```

Counts
------

[](#counts)

```
/**
 * List counts
 * See more options here: https://developers.intercom.io/reference#getting-counts
 */
$client->counts->getCounts([])
```

Notes
-----

[](#notes)

```
/** Create a note */
$client->notes->create([
  "admin_id" => "21",
  "body" => "Text for my note",
  "user" => [
    "id" => "5310d8e8598c9a0b24000005"
  ]
]);

/** List notes for a user */
$client->notes->getNotes([
  "user_id" => "25"
]);

/** Get a single Note by id */
$client->notes->getNote("42");
```

Rate Limits
-----------

[](#rate-limits)

Rate limit info is passed via the rate limit headers. You can access this information as follows:

```
$rate_limit = $intercom->getRateLimitDetails();
print("{$rate_limit['remaining']} {$rate_limit['limit']} \n");
print_r($rate_limit['reset_at']->format(DateTime::ISO8601));

```

For more info on rate limits and these headers please see the [API reference docs](https://developers.intercom.com/reference#rate-limiting)

Pagination
----------

[](#pagination)

When listing, the Intercom API may return a pagination object:

```
{
  "pages": {
    "next": "..."
  }
}
```

You can grab the next page of results using the client:

```
$client->nextPage($response->pages);
```

Scroll
------

[](#scroll)

The first time you use the scroll API you can just send a simple GET request. This will return up to 100 records. If you have more than 100 you will need to make another call. To do this you need to use to scroll\_parameter returned in the original response. Use this for subsequent responses until you get an empty array of records. This means there are no records and the scroll timer will be reset. For more information on scroll please see the [API reference](https://developers.intercom.com/reference#iterating-over-all-users)Here is an example of a simple way to use the scroll for multiple calls:

```

```

Exceptions
----------

[](#exceptions)

Exceptions are handled by [Guzzle](https://github.com/guzzle/guzzle). The Intercom API may return an unsuccessful HTTP response, for example when a resource is not found (404). If you want to catch errors you can wrap your API call into a try/catch:

```
use GuzzleHttp\Exception\ClientException;

try {
  $user = $client->users->getUser("570680a8a1bcbca8a90001b9");
} catch(ClientException $e) {
  $response = $e->getResponse();
  $statusCode = $response->getStatusCode();
  if ($statusCode == '404') {
    // Handle 404 error
    return;
  } else {
    throw $e;
  }
}
```

Pull Requests
-------------

[](#pull-requests)

- **Add tests!** Your patch won't be accepted if it doesn't have tests.
- **Document any change in behaviour**. Make sure the README and any other relevant documentation are kept up-to-date.
- **Create topic branches**. Don't ask us to pull from your master branch.
- **One pull request per feature**. If you want to do more than one thing, send multiple pull requests.
- **Send coherent history**. Make sure each individual commit in your pull request is meaningful. If you had to make multiple intermediate commits while developing, please squash them before sending them to us.

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor3

3 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~35 days

Recently: every ~82 days

Total

42

Last Release

2881d ago

Major Versions

v1.5.0 → v2.0.02016-05-03

v2.0.0 → v3.0.02016-07-18

PHP version history (2 changes)v1.0.0-b8PHP &gt;=5.4.0

v3.0.0PHP &gt;= 5.6

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/22685632?v=4)[Qive (Antiga Arquivei)](/maintainers/arquivei)[@arquivei](https://github.com/arquivei)

---

Top Contributors

[![dannyfallon](https://avatars.githubusercontent.com/u/1104475?v=4)](https://github.com/dannyfallon "dannyfallon (86 commits)")[![nurazem](https://avatars.githubusercontent.com/u/2227794?v=4)](https://github.com/nurazem "nurazem (80 commits)")[![bobjflong](https://avatars.githubusercontent.com/u/2264896?v=4)](https://github.com/bobjflong "bobjflong (60 commits)")[![josler](https://avatars.githubusercontent.com/u/167061?v=4)](https://github.com/josler "josler (31 commits)")[![dehora](https://avatars.githubusercontent.com/u/5454?v=4)](https://github.com/dehora "dehora (24 commits)")[![choran](https://avatars.githubusercontent.com/u/15954251?v=4)](https://github.com/choran "choran (13 commits)")[![RuairiK](https://avatars.githubusercontent.com/u/3501544?v=4)](https://github.com/RuairiK "RuairiK (10 commits)")[![kmossco](https://avatars.githubusercontent.com/u/11810153?v=4)](https://github.com/kmossco "kmossco (7 commits)")[![mmartinic](https://avatars.githubusercontent.com/u/1299531?v=4)](https://github.com/mmartinic "mmartinic (6 commits)")[![eugeneius](https://avatars.githubusercontent.com/u/432189?v=4)](https://github.com/eugeneius "eugeneius (6 commits)")[![ziemkowski](https://avatars.githubusercontent.com/u/704098?v=4)](https://github.com/ziemkowski "ziemkowski (4 commits)")[![lemuel-arquivei](https://avatars.githubusercontent.com/u/36743377?v=4)](https://github.com/lemuel-arquivei "lemuel-arquivei (4 commits)")[![bviolier](https://avatars.githubusercontent.com/u/1247610?v=4)](https://github.com/bviolier "bviolier (3 commits)")[![thewheat](https://avatars.githubusercontent.com/u/892961?v=4)](https://github.com/thewheat "thewheat (3 commits)")[![apassant](https://avatars.githubusercontent.com/u/402693?v=4)](https://github.com/apassant "apassant (3 commits)")[![AndrewTSeipp](https://avatars.githubusercontent.com/u/95777971?v=4)](https://github.com/AndrewTSeipp "AndrewTSeipp (3 commits)")[![klimesf](https://avatars.githubusercontent.com/u/5357636?v=4)](https://github.com/klimesf "klimesf (3 commits)")[![shibby](https://avatars.githubusercontent.com/u/291643?v=4)](https://github.com/shibby "shibby (2 commits)")[![fnwbr](https://avatars.githubusercontent.com/u/706419?v=4)](https://github.com/fnwbr "fnwbr (2 commits)")[![FallDi](https://avatars.githubusercontent.com/u/4299295?v=4)](https://github.com/FallDi "FallDi (2 commits)")

---

Tags

apiGuzzleintercomarquiveiintercom.io

###  Code Quality

TestsPHPUnit

Code StylePHP\_CodeSniffer

### Embed Badge

![Health badge](/badges/arquivei-intercom-php/health.svg)

```
[![Health](https://phpackages.com/badges/arquivei-intercom-php/health.svg)](https://phpackages.com/packages/arquivei-intercom-php)
```

###  Alternatives

[darkin1/intercom

Wrapper on the Intercom class provided by Intercom - with support for Laravel 5.x, 6.x, 7.x

1587.7k](/packages/darkin1-intercom)[onesignal/onesignal-php-api

A powerful way to send personalized messages at scale and build effective customer engagement strategies. Learn more at onesignal.com

34199.5k2](/packages/onesignal-onesignal-php-api)[dreamfactory/df-core

DreamFactory(tm) Core Components

1652.0k38](/packages/dreamfactory-df-core)[antoinelemaire/aircall-php

Aircall API client built on top of Guzzle 6

1050.2k](/packages/antoinelemaire-aircall-php)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
