Skip to content

Commit 701e2e4

Browse files
authored
Merge pull request #263 from intercom/ga/fix-readme
Fixes to README
2 parents a9959cf + a0f2dd4 commit 701e2e4

File tree

1 file changed

+38
-35
lines changed

1 file changed

+38
-35
lines changed

README.md

Lines changed: 38 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1+
# intercom-php
12

23
[![Code
34
Climate](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/badges/2aa25d4736f09f40282e/gpa.svg)](https://codeclimate.com/repos/537da4a7e30ba062b101be9c/feed) [![Circle CI](https://circleci.com/gh/intercom/intercom-php.png?style=badge)](https://circleci.com/gh/intercom/intercom-php)
45

5-
## intercom-php
6-
7-
> Official PHP bindings to the Intercom API
6+
Official PHP bindings to the Intercom API
87

98
## Installation
109

@@ -14,14 +13,14 @@ The recommended way to install intercom-php is through [Composer](https://getcom
1413

1514
First, install Composer:
1615

17-
```
18-
$ curl -sS https://getcomposer.org/installer | php
16+
```sh
17+
curl -sS https://getcomposer.org/installer | php
1918
```
2019

2120
Next, install the latest intercom-php:
2221

23-
```
24-
$ php composer.phar require intercom/intercom-php
22+
```sh
23+
php composer.phar require intercom/intercom-php
2524
```
2625

2726
Finally, you need to require the library in your PHP application:
@@ -31,17 +30,18 @@ require "vendor/autoload.php";
3130
```
3231

3332
## Clients
33+
3434
For OAuth or Access Tokens use:
3535

3636
```php
3737
use Intercom\IntercomClient;
3838

39-
$client = new IntercomClient(<insert_token_here>, null);
39+
$client = new IntercomClient('<insert_token_here>', null);
4040
```
4141

42-
> 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).
43-
44-
> 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.
42+
> If you already have an access token you can find it [here](https://app.intercom.com/a/apps/_/developer-hub). If you want to create or learn more about access tokens then you can find more info [here](https://developers.intercom.com/building-apps/docs/authorization#section-access-tokens).
43+
>
44+
> If you are building a third party application you can get your OAuth token by [setting-up-oauth](https://developers.intercom.com/building-apps/docs/authorization#section-oauth) for Intercom.
4545
4646
## Users
4747

@@ -52,8 +52,8 @@ $client->users->create([
5252
"custom_attributes" => ['foo' => 'bar']
5353
]);
5454

55-
/**
56-
* Update a user (Note: This method is an alias to the create method. In practice you
55+
/**
56+
* Update a user (Note: This method is an alias to the create method. In practice you
5757
* can use create to update users if you wish)
5858
*/
5959
$client->users->update([
@@ -94,10 +94,10 @@ $client->users->getUsers(["email" => "[email protected]"]);
9494
/** List all users up to 10k records */
9595
$client->users->getUsers([]);
9696

97-
/**
97+
/**
9898
* List all users (even above 10k records)
99-
* The result object contains an array of your user objects and a scroll_param which you can then
100-
* use to request the next 100 users. Note that the scroll parameter will time out after one minute
99+
* The result object contains an array of your user objects and a scroll_param which you can then
100+
* use to request the next 100 users. Note that the scroll parameter will time out after one minute
101101
* and you will need to make a new request
102102
*/
103103
$client->users->scrollUsers();
@@ -108,7 +108,7 @@ See [here](https://github.com/intercom/intercom-php#scroll) for more info on usi
108108
## Leads
109109

110110
```php
111-
/**
111+
/**
112112
* Create a lead
113113
* See more options here: https://developers.intercom.io/reference#create-lead
114114
*/
@@ -118,15 +118,15 @@ $client->leads->create([
118118
]);
119119

120120
/**
121-
* Update a lead (Note: This method is an alias to the create method.
121+
* Update a lead (Note: This method is an alias to the create method.
122122
* In practice you can use create to update leads if you wish)
123123
*/
124124
$client->leads->update([
125125
"email" => "[email protected]",
126126
"custom_attributes" => ['foo' => 'bar']
127127
]);
128128

129-
/**
129+
/**
130130
* List leads
131131
* See more options here: https://developers.intercom.io/reference#list-leads
132132
*/
@@ -148,10 +148,10 @@ $client->leads->convertLead([
148148
]
149149
]);
150150

151-
/**
151+
/**
152152
* List all leads (even above 10k records)
153-
* The result object contains an array of your contacts objects and a scroll_param which you can then
154-
* use to request the next 100 leads. Note that the scroll parameter will time out after one minute
153+
* The result object contains an array of your contacts objects and a scroll_param which you can then
154+
* use to request the next 100 leads. Note that the scroll parameter will time out after one minute
155155
* and you will need to make a new request
156156
*/
157157
$client->leads->scrollLeads();
@@ -160,6 +160,7 @@ $client->leads->scrollLeads();
160160
See [here](https://github.com/intercom/intercom-php#scroll) for more info on using the scroll parameter
161161

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

165166
```php
@@ -204,7 +205,7 @@ $client->visitors->convertVisitor([
204205
/** List tags */
205206
$client->tags->getTags();
206207

207-
/**
208+
/**
208209
* Tag users
209210
* See more options here: https://developers.intercom.io/reference#tag-or-untag-users-companies-leads-contacts
210211
*/
@@ -228,6 +229,7 @@ $client->segments->getSegment("58a707924f6651b07b94376c");
228229
/** View a segment with count */
229230
$client->segments->getSegment("59c124f770e00fd819b9ce81", ["include_count"=>"true"]);
230231
```
232+
231233
## Events
232234

233235
```php
@@ -250,8 +252,8 @@ $client->companies->create([
250252
"name" => "foocorp", "company_id" => "3"
251253
]);
252254

253-
/**
254-
* Update a company (Note: This method is an alias to the create method.
255+
/**
256+
* Update a company (Note: This method is an alias to the create method.
255257
* In practice you can use create to update companies if you wish)
256258
*/
257259
$client->companies->update([
@@ -285,7 +287,7 @@ $client->admins->getAdmins();
285287
## Messages
286288

287289
```php
288-
/**
290+
/**
289291
* Send a message from an admin to a user
290292
* See more options here: https://developers.intercom.io/reference#conversations
291293
*/
@@ -307,7 +309,7 @@ $client->messages->create([
307309
## Conversations
308310

309311
```php
310-
/**
312+
/**
311313
* List conversations for an admin
312314
* See more options here: https://developers.intercom.io/reference#list-conversations
313315
*/
@@ -324,7 +326,7 @@ $client->conversations->getConversation("1234", [
324326
"display_as" => "plaintext"
325327
])
326328

327-
/**
329+
/**
328330
* Reply to a conversation
329331
* See more options here: https://developers.intercom.io/reference#replying-to-a-conversation
330332
*/
@@ -335,7 +337,7 @@ $client->conversations->replyToConversation("5678", [
335337
"message_type" => "comment"
336338
]);
337339

338-
/**
340+
/**
339341
* Reply to a user's last conversation
340342
* See more options here: https://developers.intercom.com/reference#replying-to-users-last-conversation
341343
*/
@@ -346,7 +348,7 @@ $client->conversations->replyToLastConversation([
346348
"message_type" => "comment"
347349
]);
348350

349-
/**
351+
/**
350352
* Mark a conversation as read
351353
* See API documentation here: https://developers.intercom.io/reference#marking-a-conversation-as-read
352354
*/
@@ -356,7 +358,7 @@ $client->conversations->markConversationAsRead("7890");
356358
## Counts
357359

358360
```php
359-
/**
361+
/**
360362
* List counts
361363
* See more options here: https://developers.intercom.io/reference#getting-counts
362364
*/
@@ -389,11 +391,12 @@ $client->notes->getNote("42");
389391
Rate limit info is passed via the rate limit headers.
390392
You can access this information as follows:
391393

392-
```
394+
```php
393395
$rate_limit = $intercom->getRateLimitDetails();
394396
print("{$rate_limit['remaining']} {$rate_limit['limit']} \n");
395397
print_r($rate_limit['reset_at']->format(DateTime::ISO8601));
396398
```
399+
397400
For more info on rate limits and these headers please see the [API reference docs](https://developers.intercom.com/reference#rate-limiting)
398401

399402
## Pagination
@@ -414,7 +417,8 @@ You can grab the next page of results using the client:
414417
$client->nextPage($response->pages);
415418
```
416419

417-
## Scroll
420+
## Scroll
421+
418422
The first time you use the scroll API you can just send a simple GET request.
419423
This will return up to 100 records. If you have more than 100 you will need to make another call.
420424
To do this you need to use to scroll_parameter returned in the original response.
@@ -423,7 +427,7 @@ This means there are no records and the scroll timer will be reset.
423427
For more information on scroll please see the [API reference](https://developers.intercom.com/reference#iterating-over-all-users)
424428
Here is an example of a simple way to use the scroll for multiple calls:
425429

426-
```
430+
```php
427431
<?php
428432
require "vendor/autoload.php";
429433
use Intercom\IntercomClient;
@@ -443,7 +447,6 @@ while (!empty($resp->scroll_param && sizeof($resp->users) > 0)){
443447
?>
444448
```
445449

446-
447450
## Exceptions
448451

449452
Exceptions are handled by [Guzzle](https://github.com/guzzle/guzzle).

0 commit comments

Comments
 (0)