Skip to content

Commit f1a443b

Browse files
authored
Update readme with API versions (#308)
1 parent 0b0f27b commit f1a443b

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

README.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,11 @@ $client = new IntercomClient('<insert_token_here>', null, ['Intercom-Version' =>
5151

5252
For more information about API Versioning, please check the [API Versioning Documentation](https://developers.intercom.com/building-apps/docs/api-versioning) and the [API changelog](https://developers.intercom.com/building-apps/docs/api-changelog).
5353

54+
**Important**: Not all the resources supported by this API are supported by all API versions. See the notes below or the [API Reference](https://developers.intercom.com/intercom-api-reference/reference) for more information about the resources supported by each API version.
55+
5456
## Contacts
55-
Warning: This resource is only available on version 2.0 of the Intercom API.
57+
58+
This resource is only available in API Versions 2.0 and above
5659

5760
```php
5861
/** Create a contact */
@@ -91,6 +94,8 @@ $client->contacts->getContacts([]);
9194

9295
## Users
9396

97+
This resource is only available in API Versions 1.0 to 1.4. Newer versions use the [Contacts](#contacts) resource instead.
98+
9499
```php
95100
/** Create a user */
96101
$client->users->create([
@@ -158,6 +163,8 @@ See [here](https://github.com/intercom/intercom-php#scroll) for more info on usi
158163

159164
## Leads
160165

166+
This resource is only available in API Versions 1.0 to 1.4. Newer versions use the [Contacts](#contacts) resource instead.
167+
161168
```php
162169
/**
163170
* Create a lead
@@ -309,15 +316,14 @@ $client->companies->create([
309316
]);
310317

311318
/**
312-
* Update a company (Note: This method is an alias to the create method.
313-
* In practice you can use create to update companies if you wish)
319+
* Update a company
314320
*/
315321
$client->companies->update([
316322
"name" => "foocorp",
317323
"id" => "3"
318324
]);
319325

320-
/** Creating or Update a company with custom attributes. */
326+
/** Create or update a company with custom attributes. */
321327
$client->companies->update([
322328
"name" => "foocorp",
323329
"id" => "3",
@@ -410,7 +416,7 @@ $client->conversations->search([
410416
"pagination" => ["per_page" => 10]
411417
]);
412418

413-
/** Get next page of conversation search results (API version > 2.0) */
419+
/** Get next page of conversation search results (API version >= 2.0) */
414420
$client->conversations->nextSearch($query, $response->pages);
415421

416422
/**
@@ -515,7 +521,7 @@ You can grab the next page of results using the client:
515521
$client->nextPage($response->pages);
516522
```
517523

518-
In API version 2.0 subsequent pages for listing contacts can be retreived with:
524+
In API versions 2.0 and above subsequent pages for listing contacts can be retreived with:
519525

520526
```php
521527
$client->nextCursor($response->pages);

src/IntercomClient.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121

2222
class IntercomClient
2323
{
24+
const SDK_VERSION = '4.4.0';
25+
2426
/**
2527
* @var HttpClient $httpClient
2628
*/
@@ -328,7 +330,8 @@ private function getRequestHeaders()
328330
return array_merge(
329331
[
330332
'Accept' => 'application/json',
331-
'Content-Type' => 'application/json'
333+
'Content-Type' => 'application/json',
334+
'User-Agent' => 'Intercom-PHP/' . self::SDK_VERSION,
332335
],
333336
$this->extraRequestHeaders
334337
);

0 commit comments

Comments
 (0)