Skip to content

Commit 0ca6e2f

Browse files
committed
update readme
1 parent 991dbb7 commit 0ca6e2f

File tree

1 file changed

+56
-69
lines changed

1 file changed

+56
-69
lines changed

README.md

Lines changed: 56 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import { IntercomClient } from "intercom-client";
3434

3535
const client = new IntercomClient({ token: "YOUR_TOKEN" });
3636
await client.articles.create({
37-
title: "Thanks for everything",
38-
description: "Description of the Article",
39-
body: "Body of the Article",
37+
title: "How to create an account",
38+
description: "Example article about creating an account.",
39+
body: "Here are the steps to create an account.",
4040
author_id: 1295,
4141
state: "published",
4242
});
@@ -87,19 +87,6 @@ client.useRequestOpts({
8787

8888
Note that certain request options (such as `json`, and certain `headers` names cannot be overriden).
8989

90-
### Setting the API version
91-
92-
We version our API (see the "Choose Version" section of the [API & Webhooks Reference](https://developers.intercom.com/intercom-api-reference/reference) for details). You can specify which version of the API to use when performing API requests using request options:
93-
94-
```typescript
95-
const client = new Client({ tokenAuth: { token: "my_token" } });
96-
client.useRequestOpts({
97-
headers: {
98-
"Intercom-Version": 2.6,
99-
},
100-
});
101-
```
102-
10390
### Setting the API base url
10491

10592
If you are using the european instance of intercom and would like to call it directly and not be redirected through our US instance, you can set the `baseUrl` as follows:
@@ -115,13 +102,13 @@ client.useRequestOpts({
115102

116103
### Admins
117104

118-
#### [Retrieve admin](https://developers.intercom.com/intercom-api-reference/reference/view-an-admin)
105+
#### [Retrieve admin](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/admins/retrieveadmin)
119106

120107
```typescript
121108
const admin = await client.admins.find({ id: "123" });
122109
```
123110

124-
#### [Set Admin away](https://developers.intercom.com/intercom-api-reference/reference/set-admin-away-mode)
111+
#### [Set Admin away](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/admins/setawayadmin)
125112

126113
```typescript
127114
await client.admins.away({
@@ -131,7 +118,7 @@ await client.admins.away({
131118
});
132119
```
133120

134-
#### [List all activity logs](https://developers.intercom.com/intercom-api-reference/reference/view-admin-activity-logs)
121+
#### [List all activity logs](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/admins/listactivitylogs)
135122

136123
```typescript
137124
await client.admins.listAllActivityLogs({
@@ -140,74 +127,74 @@ await client.admins.listAllActivityLogs({
140127
});
141128
```
142129

143-
#### [List all admins](https://developers.intercom.com/intercom-api-reference/reference/list-admins)
130+
#### [List all admins](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/admins/listadmins)
144131

145132
```typescript
146133
const admins = await client.admins.list();
147134
```
148135

149136
### Articles
150137

151-
#### [Create an article](https://developers.intercom.com/intercom-api-reference/reference/create-an-article)
138+
#### [Create an article](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/createarticle)
152139

153140
```typescript
154141
const article = await client.articles.create({
155-
title: "Thanks for everything",
156-
description: "English description",
157-
body: "<p>This is the body in html</p>",
142+
title: "How to create an account",
143+
description: "Example article about creating an account.",
144+
body: "<p>Here are the steps to create an account.</p>",
158145
authorId: 1,
159146
state: "published",
160147
parentId: 1,
161148
parentType: "collection",
162149
translatedContent: {
163150
fr: {
164-
title: "Allez les verts",
165-
description: "French description",
166-
body: "<p>French body in html</p>",
151+
title: "Comment créer un compte",
152+
description: "Exemple d'article sur la création d'un compte.",
153+
body: "<p>Voici les étapes pour créer un compte.</p>",
167154
author_id: 1,
168155
state: "published",
169156
},
170157
},
171158
});
172159
```
173160

174-
#### [Retrieve an article](https://developers.intercom.com/intercom-api-reference/reference/retrieve-an-article)
161+
#### [Retrieve an article](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/retrievearticle)
175162

176163
```typescript
177164
const response = await client.articles.find({ id: "123" });
178165
```
179166

180-
#### [Update an article](https://developers.intercom.com/intercom-api-reference/reference/update-an-article)
167+
#### [Update an article](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/updatearticle)
181168

182169
```typescript
183170
const article = await client.articles.update({
184171
id: "123",
185-
title: "Thanks for everything",
186-
description: "English description",
187-
body: "<p>This is the body in html</p>",
172+
title: "How to create an account",
173+
description: "Example article about creating an account.",
174+
body: "<p>Here are the steps to create an account.</p>",
188175
authorId: 1,
189176
state: "published",
190177
parentId: 1,
191178
parentType: "collection",
192179
translatedContent: {
193180
fr: {
194-
title: "Allez les verts",
195-
description: "French description",
196-
body: "<p>French body in html</p>",
181+
title: "Comment créer un compte",
182+
description: "Exemple d'article sur la création d'un compte.",
183+
body: "<p>Voici les étapes pour créer un compte.</p>",
197184
author_id: 1,
198185
state: "published",
199186
},
200187
},
201188
});
202189
```
203190

204-
#### [Delete an article](https://developers.intercom.com/intercom-api-reference/reference/delete-an-article)
191+
#### [Delete an article](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/deletearticle)
205192

206193
```typescript
207194
await client.articles.delete({ id: "123" });
208195
```
209196

210-
#### [List all articles](https://developers.intercom.com/intercom-api-reference/reference/list-all-articles)
197+
#### [List all articles](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/articles/listarticles)
211198

212199
```typescript
213200
const response = await client.articles.list({
@@ -218,39 +205,39 @@ const response = await client.articles.list({
218205

219206
### Companies
220207

221-
#### [Create a company](https://developers.intercom.com/intercom-api-reference/reference/create-or-update-company)
208+
#### [Create a company](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/companies/createorupdatecompany)
222209

223210
```typescript
224211
const company = await client.companies.create({
225212
createdAt: dateToUnixTimestamp(new Date()),
226-
companyId: "46029",
227-
name: "BestCompanyInc.",
213+
companyId: "1234",
214+
name: "Acme Inc.",
228215
monthlySpend: 9001,
229-
plan: "1. Get pizzaid",
216+
plan: "Premium",
230217
size: 62049,
231-
website: "http://the-best.one",
232-
industry: "The Best One",
218+
website: "http://acme-example.com",
219+
industry: "Software",
233220
customAttributes: {},
234221
});
235222
```
236223

237-
#### [Update a company](https://developers.intercom.com/intercom-api-reference/reference/update-a-company)
224+
#### [Update a company](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/companies/updatecompany)
238225

239226
```typescript
240227
const company = await client.companies.update({
241228
createdAt: dateToUnixTimestamp(new Date()),
242-
companyId: "46029",
243-
name: "BestCompanyInc.",
229+
companyId: "1234",
230+
name: "Acme Inc.",
244231
monthlySpend: 9001,
245-
plan: "1. Get pizzaid",
232+
plan: "Premium",
246233
size: 62049,
247-
website: "http://the-best.one",
248-
industry: "The Best One",
234+
website: "http://acme-example.com",
235+
industry: "Software",
249236
customAttributes: {},
250237
});
251238
```
252239

253-
#### [Retrieve a company](https://developers.intercom.com/intercom-api-reference/reference/view-a-company)
240+
#### [Retrieve a company](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/companies/retrieveacompanybyid)
254241

255242
##### By id
256243

@@ -268,15 +255,15 @@ const company = await client.companies.find({
268255
});
269256
```
270257

271-
#### [Delete a company](https://developers.intercom.com/intercom-api-reference/reference/delete-a-company)
258+
#### [Delete a company](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/companies/deletecompany)
272259

273260
```typescript
274261
const company = await client.companies.delete({
275262
id: 62049,
276263
});
277264
```
278265

279-
#### [List all companies](https://developers.intercom.com/intercom-api-reference/reference/list-companies)
266+
#### [List all companies](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/companies/listallcompanies)
280267

281268
##### With pagination
282269

@@ -297,7 +284,7 @@ const companies = await client.companies.list({
297284
});
298285
```
299286

300-
#### [Scroll over companies](https://developers.intercom.com/intercom-api-reference/reference/iterating-over-all-companies)
287+
#### [Scroll over companies](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/companies/scrolloverallcompanies)
301288

302289
##### Using infinite scroll
303290

@@ -313,7 +300,7 @@ const companies = await client.companies.scroll.next({
313300
});
314301
```
315302

316-
#### [Attach a contact](https://developers.intercom.com/intercom-api-reference/reference/attach-contact-to-company)
303+
#### [Attach a contact](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/attachcontacttoacompany)
317304

318305
```typescript
319306
const response = await client.companies.attachContact({
@@ -322,7 +309,7 @@ const response = await client.companies.attachContact({
322309
});
323310
```
324311

325-
#### [Detach a contact](https://developers.intercom.com/intercom-api-reference/reference/detach-contact-from-company)
312+
#### [Detach a contact](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/detachcontactfromacompany)
326313

327314
```typescript
328315
const response = await client.companies.detachContact({
@@ -331,7 +318,7 @@ const response = await client.companies.detachContact({
331318
});
332319
```
333320

334-
#### [List attached contacts](https://developers.intercom.com/intercom-api-reference/reference/list-company-contacts)
321+
#### [List attached contacts](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/listattachedcontacts)
335322

336323
```typescript
337324
const response = await client.companies.listAttachedContacts({
@@ -341,7 +328,7 @@ const response = await client.companies.listAttachedContacts({
341328
});
342329
```
343330

344-
#### [List attached segments](https://developers.intercom.com/intercom-api-reference/reference/list-attached-segments-1)
331+
#### [List attached segments](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/listsegmentsforacontact)
345332

346333
```typescript
347334
const response = await client.companies.listAttachedSegments({
@@ -351,16 +338,16 @@ const response = await client.companies.listAttachedSegments({
351338

352339
### Contacts
353340

354-
#### [Create Contact](https://developers.intercom.com/intercom-api-reference/reference/create-contact)
341+
#### [Create Contact](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/createcontact)
355342

356343
##### With User Role
357344

358345
```typescript
359346
const user = await client.contacts.createUser({
360347
externalId: "536e564f316c83104c000020",
361-
phone: "+48370044567",
362-
name: "Niko Bellic",
363-
avatar: "https://nico-from-gta-iv.com/lets_go_bowling.jpg",
348+
phone: "+447778889999",
349+
name: "Joe Example",
350+
avatar: "https://example.com/photo.jpg",
364351
signedUpAt: 1638203719,
365352
lastSeenAt: 1638203720,
366353
ownerId: "536e564f316c83104c000021",
@@ -372,36 +359,36 @@ const user = await client.contacts.createUser({
372359

373360
```typescript
374361
const lead = await client.contacts.createLead({
375-
phone: "+48370044567",
376-
name: "Roman Bellic",
377-
avatar: "https://nico-from-gta-iv.com/lets_go_bowling_yey.jpg",
362+
phone: "+447778889999",
363+
name: "Joe Example",
364+
avatar: "https://example.com/photo.jpg",
378365
signedUpAt: 1638203719,
379366
lastSeenAt: 1638203720,
380367
ownerId: "536e564f316c83104c000021",
381368
isUnsubscribedFromEmails: true,
382369
});
383370
```
384371

385-
#### [Retrieve a Contact](https://developers.intercom.com/intercom-api-reference/reference/get-contact)
372+
#### [Retrieve a Contact](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/showcontact)
386373

387374
```typescript
388375
const response = await client.contacts.find({ id: "123" });
389376
```
390377

391-
#### [Update a Contact](https://developers.intercom.com/intercom-api-reference/reference/update-contact)
378+
#### [Update a Contact](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/updatecontact)
392379

393380
```typescript
394381
const response = await client.contacts.update({
395382
id: "123",
396383
role: Role.USER,
397-
name: "Roman The Bowling Fan",
384+
name: "Jane Example",
398385
customAttributes: {
399-
callBrother: "Hey Niko, it's me – Roman. Let's go bowling!",
386+
billingType: "Monthly",
400387
},
401388
});
402389
```
403390

404-
#### [Delete a Contact](https://developers.intercom.com/intercom-api-reference/reference/delete-contact)
391+
#### [Delete a Contact](https://developers.intercom.com/docs/references/rest-api/api.intercom.io/contacts/deletecontact)
405392

406393
```typescript
407394
const response = await client.contacts.delete({ id: "123" });

0 commit comments

Comments
 (0)