intercom-client 2.11.2 → 3.0.0-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +681 -404
- package/package.json +65 -49
- package/dist/admin.js +0 -46
- package/dist/bulk.js +0 -53
- package/dist/client.js +0 -245
- package/dist/company.js +0 -83
- package/dist/contact.js +0 -81
- package/dist/conversation.js +0 -48
- package/dist/counts.js +0 -86
- package/dist/customer.js +0 -31
- package/dist/event.js +0 -45
- package/dist/index.js +0 -76
- package/dist/message.js +0 -31
- package/dist/note.js +0 -41
- package/dist/scroll.js +0 -80
- package/dist/segment.js +0 -36
- package/dist/snippet.js +0 -119
- package/dist/tag.js +0 -57
- package/dist/user-data.js +0 -103
- package/dist/user.js +0 -118
- package/dist/visitor.js +0 -52
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
[](https://circleci.com/gh/intercom/intercom-node)
|
|
4
4
|
[](https://www.npmjs.com/package/intercom-client)
|
|
5
|
-

|
|
6
|
+

|
|
6
7
|
|
|
7
8
|
> Official Node bindings to the [Intercom API](https://api.intercom.io/docs)
|
|
8
9
|
|
|
@@ -10,11 +11,7 @@
|
|
|
10
11
|
|
|
11
12
|
### Maintenance
|
|
12
13
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
In the meantime, we'll be operating on limited capacity, meaning all pull requests will be evaluated on a best effort basis and will be limited to critical issues.
|
|
16
|
-
|
|
17
|
-
We'll communicate all relevant updates as we build this new team and support strategy in the coming months.
|
|
14
|
+
Current repository is a new WIP version of Node SDK, that supports latest API version (v2.4 as of 14/01/2022)
|
|
18
15
|
|
|
19
16
|
## Installation
|
|
20
17
|
|
|
@@ -35,590 +32,870 @@ yarn test
|
|
|
35
32
|
Compile using babel:
|
|
36
33
|
|
|
37
34
|
```bash
|
|
38
|
-
yarn
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Require Intercom:
|
|
42
|
-
|
|
43
|
-
```node
|
|
44
|
-
var Intercom = require('./dist/index');
|
|
35
|
+
yarn prepublish
|
|
45
36
|
```
|
|
46
37
|
|
|
47
38
|
## Usage
|
|
48
39
|
|
|
49
|
-
|
|
40
|
+
Import Intercom:
|
|
50
41
|
|
|
51
|
-
```
|
|
52
|
-
|
|
42
|
+
```typescript
|
|
43
|
+
import { Client } from './dist/index';
|
|
53
44
|
```
|
|
54
45
|
|
|
55
46
|
Create a client using access tokens:
|
|
56
47
|
|
|
57
|
-
```
|
|
58
|
-
|
|
48
|
+
```typescript
|
|
49
|
+
const client = new Client({ tokenAuth: { token: 'my_token' } });
|
|
59
50
|
```
|
|
60
51
|
|
|
61
|
-
##
|
|
52
|
+
## Request Options
|
|
62
53
|
|
|
63
|
-
This client library supports
|
|
54
|
+
This client library also supports passing in [`request` options](https://github.com/axios/axios#request-config):
|
|
64
55
|
|
|
65
|
-
```
|
|
66
|
-
client
|
|
67
|
-
|
|
56
|
+
```typescript
|
|
57
|
+
const client = new Client({ tokenAuth: { token: 'my_token' } });
|
|
58
|
+
client.useRequestOpts({
|
|
59
|
+
baseURL: 'http://local.test-server.com',
|
|
68
60
|
});
|
|
69
61
|
```
|
|
70
62
|
|
|
71
|
-
|
|
63
|
+
Note that certain request options (such as `json`, and certain `headers` names cannot be overriden).
|
|
72
64
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
65
|
+
### Setting the API version
|
|
66
|
+
|
|
67
|
+
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:
|
|
68
|
+
|
|
69
|
+
```typescript
|
|
70
|
+
const client = new Client({ tokenAuth: { token: 'my_token' } });
|
|
71
|
+
client.useRequestOpts({
|
|
72
|
+
headers: {
|
|
73
|
+
'Intercom-Version': 2.4,
|
|
74
|
+
},
|
|
77
75
|
});
|
|
78
76
|
```
|
|
79
77
|
|
|
80
|
-
##
|
|
78
|
+
## Examples
|
|
81
79
|
|
|
82
|
-
|
|
80
|
+
### Admins
|
|
83
81
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
});
|
|
82
|
+
#### [Retrieve admin](https://developers.intercom.com/intercom-api-reference/reference/view-an-admin)
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
const admin = await client.admins.find({ id: '123' });
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
|
|
88
|
+
#### [Set Admin away](https://developers.intercom.com/intercom-api-reference/reference/set-admin-away-mode)
|
|
91
89
|
|
|
92
|
-
|
|
90
|
+
```typescript
|
|
91
|
+
await client.admins.away({
|
|
92
|
+
adminId: '123',
|
|
93
|
+
enableAwayMode: true,
|
|
94
|
+
enableReassignMode: false,
|
|
95
|
+
});
|
|
96
|
+
```
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
#### [List all activity logs](https://developers.intercom.com/intercom-api-reference/reference/view-admin-activity-logs)
|
|
99
|
+
|
|
100
|
+
```typescript
|
|
101
|
+
await client.admins.listAllActivityLogs({
|
|
102
|
+
before: new Date('Fri, 17 Dec 2021 18:02:18 GMT');,
|
|
103
|
+
after: new Date('Fri, 17 Dec 2021 18:02:18 GMT');,
|
|
100
104
|
});
|
|
101
105
|
```
|
|
102
106
|
|
|
103
|
-
|
|
107
|
+
#### [List all admins](https://developers.intercom.com/intercom-api-reference/reference/list-admins)
|
|
104
108
|
|
|
105
|
-
|
|
109
|
+
```typescript
|
|
110
|
+
const admins = await client.admins.list();
|
|
111
|
+
```
|
|
106
112
|
|
|
107
|
-
|
|
113
|
+
### Companies
|
|
108
114
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
+
#### [Create a company](https://developers.intercom.com/intercom-api-reference/reference/create-or-update-company)
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const company = await client.companies.create({
|
|
119
|
+
createdAt: dateToUnixTimestamp(new Date()),
|
|
120
|
+
companyId: '46029',
|
|
121
|
+
name: 'BestCompanyInc.',
|
|
122
|
+
monthlySpend: 9001,
|
|
123
|
+
plan: '1. Get pizzaid',
|
|
124
|
+
size: 62049,
|
|
125
|
+
website: 'http://the-best.one',
|
|
126
|
+
industry: 'The Best One',
|
|
127
|
+
customAttributes: {},
|
|
115
128
|
});
|
|
116
129
|
```
|
|
117
130
|
|
|
118
|
-
|
|
131
|
+
#### [Update a company](https://developers.intercom.com/intercom-api-reference/reference/update-a-company)
|
|
119
132
|
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
custom_attributes: {
|
|
133
|
-
foo: 'bar'
|
|
134
|
-
}
|
|
135
|
-
}, callback);
|
|
133
|
+
```typescript
|
|
134
|
+
const company = await client.companies.create({
|
|
135
|
+
createdAt: dateToUnixTimestamp(new Date()),
|
|
136
|
+
companyId: '46029',
|
|
137
|
+
name: 'BestCompanyInc.',
|
|
138
|
+
monthlySpend: 9001,
|
|
139
|
+
plan: '1. Get pizzaid',
|
|
140
|
+
size: 62049,
|
|
141
|
+
website: 'http://the-best.one',
|
|
142
|
+
industry: 'The Best One',
|
|
143
|
+
customAttributes: {},
|
|
144
|
+
});
|
|
136
145
|
```
|
|
137
146
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
147
|
+
#### [Retrieve a company](https://developers.intercom.com/intercom-api-reference/reference/view-a-company)
|
|
148
|
+
|
|
149
|
+
##### By id
|
|
150
|
+
|
|
151
|
+
```typescript
|
|
152
|
+
const company = await client.companies.find({
|
|
153
|
+
companyId: 123,
|
|
154
|
+
});
|
|
141
155
|
```
|
|
142
156
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
157
|
+
##### By name
|
|
158
|
+
|
|
159
|
+
```typescript
|
|
160
|
+
const company = await client.companies.find({
|
|
161
|
+
name: 'bruh moment inc.',
|
|
162
|
+
});
|
|
146
163
|
```
|
|
147
164
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
165
|
+
#### [Delete a company](https://developers.intercom.com/intercom-api-reference/reference/delete-a-company)
|
|
166
|
+
|
|
167
|
+
```typescript
|
|
168
|
+
const company = await client.companies.delete({
|
|
169
|
+
id: 62049,
|
|
170
|
+
});
|
|
151
171
|
```
|
|
152
172
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
resolve();
|
|
163
|
-
}, 500)
|
|
164
|
-
})
|
|
173
|
+
#### [List all companies](https://developers.intercom.com/intercom-api-reference/reference/list-companies)
|
|
174
|
+
|
|
175
|
+
##### With pagination
|
|
176
|
+
|
|
177
|
+
```typescript
|
|
178
|
+
const companies = await client.companies.list({
|
|
179
|
+
page: 1,
|
|
180
|
+
perPage: 35,
|
|
181
|
+
order: Order.DESC,
|
|
165
182
|
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
##### With TagId and SegmentId
|
|
166
186
|
|
|
187
|
+
```typescript
|
|
188
|
+
const companies = await client.companies.list({
|
|
189
|
+
tagId: '1234',
|
|
190
|
+
segmentId: '4567',
|
|
191
|
+
});
|
|
167
192
|
```
|
|
168
193
|
|
|
169
|
-
|
|
170
|
-
// Find user by id
|
|
171
|
-
client.users.find({ id: '55b9eaf' }, callback);
|
|
194
|
+
#### [Scroll over companies](https://developers.intercom.com/intercom-api-reference/reference/iterating-over-all-companies)
|
|
172
195
|
|
|
173
|
-
|
|
174
|
-
client.users.find({ user_id: 'foobar' }, callback);
|
|
196
|
+
##### Using infinite scroll
|
|
175
197
|
|
|
176
|
-
|
|
177
|
-
client.
|
|
198
|
+
```typescript
|
|
199
|
+
const companies = await client.companies.scroll.each({});
|
|
178
200
|
```
|
|
179
201
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
202
|
+
##### Using manual scroll
|
|
203
|
+
|
|
204
|
+
```typescript
|
|
205
|
+
const companies = await client.companies.scroll.next({
|
|
206
|
+
scrollParam: '123_soleil',
|
|
207
|
+
});
|
|
183
208
|
```
|
|
184
209
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
client.
|
|
210
|
+
#### [Attach a contact](https://developers.intercom.com/intercom-api-reference/reference/attach-contact-to-company)
|
|
211
|
+
|
|
212
|
+
```typescript
|
|
213
|
+
const response = await client.companies.attachContact({
|
|
214
|
+
contactId: '123',
|
|
215
|
+
companyId: '234',
|
|
216
|
+
});
|
|
189
217
|
```
|
|
190
218
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
219
|
+
#### [Detach a contact](https://developers.intercom.com/intercom-api-reference/reference/detach-contact-from-company)
|
|
220
|
+
|
|
221
|
+
```typescript
|
|
222
|
+
const response = await client.companies.detachContact({
|
|
223
|
+
contactId: '123',
|
|
224
|
+
companyId: '234',
|
|
225
|
+
});
|
|
226
|
+
```
|
|
194
227
|
|
|
195
|
-
|
|
196
|
-
client.users.requestPermanentDeletionByParams({ user_id: 'foobar' }, callback);
|
|
228
|
+
#### [List attached contacts](https://developers.intercom.com/intercom-api-reference/reference/list-company-contacts)
|
|
197
229
|
|
|
198
|
-
|
|
199
|
-
client.
|
|
230
|
+
```typescript
|
|
231
|
+
const response = await client.companies.listAttachedContacts({
|
|
232
|
+
companyId: '123',
|
|
233
|
+
page: 1,
|
|
234
|
+
perPage: 15,
|
|
235
|
+
});
|
|
200
236
|
```
|
|
201
237
|
|
|
202
|
-
|
|
238
|
+
#### [List attached segments](https://developers.intercom.com/intercom-api-reference/reference/list-attached-segments-1)
|
|
203
239
|
|
|
204
|
-
```
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
console.log(r);
|
|
240
|
+
```typescript
|
|
241
|
+
const response = await client.companies.listAttachedSegments({
|
|
242
|
+
companyId: '123',
|
|
208
243
|
});
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Contacts
|
|
209
247
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
248
|
+
#### [Create Contact](https://developers.intercom.com/intercom-api-reference/reference/create-contact)
|
|
249
|
+
|
|
250
|
+
##### With User Role
|
|
251
|
+
|
|
252
|
+
```typescript
|
|
253
|
+
const user = await client.contacts.createUser({
|
|
254
|
+
externalId: '536e564f316c83104c000020',
|
|
255
|
+
phone: '+48370044567',
|
|
256
|
+
name: 'Niko Bellic',
|
|
257
|
+
avatar: 'https://nico-from-gta-iv.com/lets_go_bowling.jpg',
|
|
258
|
+
signedUpAt: 1638203719,
|
|
259
|
+
lastSeenAt: 1638203720,
|
|
260
|
+
ownerId: '536e564f316c83104c000021',
|
|
261
|
+
isUnsubscribedFromEmails: true,
|
|
213
262
|
});
|
|
214
263
|
```
|
|
215
264
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
265
|
+
##### With Lead Role
|
|
266
|
+
|
|
267
|
+
```typescript
|
|
268
|
+
const lead = await client.contacts.createLead({
|
|
269
|
+
phone: '+48370044567',
|
|
270
|
+
name: 'Roman Bellic',
|
|
271
|
+
avatar: 'https://nico-from-gta-iv.com/lets_go_bowling_yey.jpg',
|
|
272
|
+
signedUpAt: 1638203719,
|
|
273
|
+
lastSeenAt: 1638203720,
|
|
274
|
+
ownerId: '536e564f316c83104c000021',
|
|
275
|
+
isUnsubscribedFromEmails: true,
|
|
276
|
+
});
|
|
219
277
|
```
|
|
220
278
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
279
|
+
#### [Retrieve a Contact](https://developers.intercom.com/intercom-api-reference/reference/get-contact)
|
|
280
|
+
|
|
281
|
+
```typescript
|
|
282
|
+
const response = await client.contacts.find({ id: '123' });
|
|
224
283
|
```
|
|
225
284
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
}, 500)
|
|
237
|
-
})
|
|
285
|
+
#### [Update a Contact](https://developers.intercom.com/intercom-api-reference/reference/update-contact)
|
|
286
|
+
|
|
287
|
+
```typescript
|
|
288
|
+
const response = await client.contacts.update({
|
|
289
|
+
id: '123',
|
|
290
|
+
role: Role.USER,
|
|
291
|
+
name: 'Roman The Bowling Fan',
|
|
292
|
+
customAttributes: {
|
|
293
|
+
callBrother: "Hey Niko, it's me – Roman. Let's go bowling!",
|
|
294
|
+
},
|
|
238
295
|
});
|
|
239
296
|
```
|
|
240
297
|
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
298
|
+
#### [Delete a Contact](https://developers.intercom.com/intercom-api-reference/reference/delete-contact)
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
const response = await client.contacts.delete({ id: '123' });
|
|
244
302
|
```
|
|
245
303
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
304
|
+
#### [Archive a Contact](https://developers.intercom.com/intercom-api-reference/reference/archive-a-contact)
|
|
305
|
+
|
|
306
|
+
```typescript
|
|
307
|
+
const response = await client.contacts.archive({ id: '123' });
|
|
249
308
|
```
|
|
250
309
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
310
|
+
#### [Unarchive a Contact](https://developers.intercom.com/intercom-api-reference/reference/unarchive-a-contact)
|
|
311
|
+
|
|
312
|
+
```typescript
|
|
313
|
+
const response = await client.contacts.unarchive({ id: '123' });
|
|
254
314
|
```
|
|
255
315
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
316
|
+
#### [Merge two Contacts](https://developers.intercom.com/intercom-api-reference/reference/merge-contact)
|
|
317
|
+
|
|
318
|
+
```typescript
|
|
319
|
+
const response = await client.contacts.mergeLeadInUser({
|
|
320
|
+
leadId: '123',
|
|
321
|
+
userId: '234',
|
|
322
|
+
});
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
#### [Search for contacts](https://developers.intercom.com/intercom-api-reference/reference/search-for-contacts)
|
|
326
|
+
|
|
327
|
+
```typescript
|
|
328
|
+
const response = await client.contacts.search({
|
|
329
|
+
data: {
|
|
330
|
+
query: {
|
|
331
|
+
operator: Operators.AND,
|
|
332
|
+
value: [
|
|
333
|
+
{
|
|
334
|
+
operator: Operators.AND,
|
|
335
|
+
value: [
|
|
336
|
+
{
|
|
337
|
+
field: 'updated_at',
|
|
338
|
+
operator: Operators.GREATER_THAN,
|
|
339
|
+
value: 1560436650,
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
field: 'conversation_rating.rating',
|
|
343
|
+
operator: Operators.EQUALS,
|
|
344
|
+
value: 1,
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
},
|
|
348
|
+
{
|
|
349
|
+
operator: Operators.OR,
|
|
350
|
+
value: [
|
|
351
|
+
{
|
|
352
|
+
field: 'updated_at',
|
|
353
|
+
operator: Operators.GREATER_THAN,
|
|
354
|
+
value: 1560436650,
|
|
355
|
+
},
|
|
356
|
+
{
|
|
357
|
+
field: 'conversation_rating.rating',
|
|
358
|
+
operator: Operators.EQUALS,
|
|
359
|
+
value: 2,
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
},
|
|
363
|
+
],
|
|
364
|
+
},
|
|
365
|
+
pagination: {
|
|
366
|
+
per_page: 5,
|
|
367
|
+
starting_after:
|
|
368
|
+
'WzE2MzU4NjA2NDgwMDAsIjYxODJiNjJlNDM4YjdhM2EwMWE4YWYxNSIsMl0=',
|
|
369
|
+
},
|
|
370
|
+
sort: { field: 'name', order: SearchContactOrderBy.ASC },
|
|
371
|
+
},
|
|
372
|
+
});
|
|
263
373
|
```
|
|
264
374
|
|
|
265
|
-
|
|
375
|
+
#### [List all Contacts](https://developers.intercom.com/intercom-api-reference/reference/list-contacts)
|
|
266
376
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
377
|
+
##### With cursor
|
|
378
|
+
|
|
379
|
+
```typescript
|
|
380
|
+
const response = await client.contacts.list({
|
|
381
|
+
perPage: 5,
|
|
382
|
+
startingAfter:
|
|
383
|
+
'WzE2MzU3NzU4NjkwMDAsIjYxODJiNjJhMDMwZTk4OTBkZWU4NGM5YiIsMl0=',
|
|
384
|
+
});
|
|
274
385
|
```
|
|
275
386
|
|
|
276
|
-
|
|
387
|
+
##### Without a cursor
|
|
277
388
|
|
|
278
|
-
```
|
|
279
|
-
|
|
280
|
-
client.visitors.update({ id: '5435345', email: 'wash@serenity.io' }, callback);
|
|
389
|
+
```typescript
|
|
390
|
+
const response = await client.contacts.list();
|
|
281
391
|
```
|
|
282
392
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
client.
|
|
393
|
+
#### [List attached companies](https://developers.intercom.com/intercom-api-reference/reference/list-companies-of-contact)
|
|
394
|
+
|
|
395
|
+
```typescript
|
|
396
|
+
const response = await client.contacts.listAttachedCompanies({
|
|
397
|
+
id: '123',
|
|
398
|
+
perPage: 5,
|
|
399
|
+
page: 1,
|
|
400
|
+
});
|
|
287
401
|
```
|
|
288
402
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
403
|
+
#### [List attached tags](https://developers.intercom.com/intercom-api-reference/reference/list-tags-of-contact)
|
|
404
|
+
|
|
405
|
+
```typescript
|
|
406
|
+
const response = await client.contacts.listAttachedTags({ id: '123' });
|
|
292
407
|
```
|
|
293
408
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
user: { email: 'mal@serenity.io' },
|
|
299
|
-
type: "user"
|
|
300
|
-
};
|
|
301
|
-
client.visitors.convert(conversion, callback);
|
|
409
|
+
#### [List attached segments](https://developers.intercom.com/intercom-api-reference/reference/list-attached-segments)
|
|
410
|
+
|
|
411
|
+
```typescript
|
|
412
|
+
const response = await client.contacts.listAttachedSegments({ id: '123' });
|
|
302
413
|
```
|
|
303
414
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
};
|
|
310
|
-
client.visitors.convert(conversion, callback);
|
|
415
|
+
#### [List attached email subscriptions](https://developers.intercom.com/intercom-api-reference/reference/list-attached-email-subscriptions)
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
const response = await client.contacts.listAttachedEmailSubscriptions({
|
|
419
|
+
id: '123',
|
|
420
|
+
});
|
|
311
421
|
```
|
|
312
422
|
|
|
313
|
-
|
|
423
|
+
### Conversations
|
|
314
424
|
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
425
|
+
#### [Create a conversation](https://developers.intercom.com/intercom-api-reference/reference/create-a-conversation)
|
|
426
|
+
|
|
427
|
+
```typescript
|
|
428
|
+
const response = await client.conversations.create({
|
|
429
|
+
userId: '123',
|
|
430
|
+
body: 'Hello darkness my old friend',
|
|
319
431
|
});
|
|
320
432
|
```
|
|
321
433
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
434
|
+
#### [Retrieve a conversation](https://developers.intercom.com/intercom-api-reference/reference/retrieve-a-conversation)
|
|
435
|
+
|
|
436
|
+
##### Formatted text
|
|
437
|
+
|
|
438
|
+
```typescript
|
|
439
|
+
const response = await client.conversations.find({
|
|
440
|
+
id: '123',
|
|
441
|
+
});
|
|
325
442
|
```
|
|
326
443
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
444
|
+
##### As plain text
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
const response = await client.conversations.find({
|
|
448
|
+
id: '123',
|
|
449
|
+
inPlainText: true,
|
|
450
|
+
});
|
|
330
451
|
```
|
|
331
452
|
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
resolve();
|
|
342
|
-
}, 500)
|
|
343
|
-
})
|
|
453
|
+
#### [Update a conversation](https://developers.intercom.com/intercom-api-reference/reference/update-a-conversation)
|
|
454
|
+
|
|
455
|
+
```typescript
|
|
456
|
+
const response = await client.conversations.update({
|
|
457
|
+
id,
|
|
458
|
+
markRead: true,
|
|
459
|
+
customAttributes: {
|
|
460
|
+
anything: 'you want',
|
|
461
|
+
},
|
|
344
462
|
});
|
|
345
463
|
```
|
|
346
464
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
465
|
+
#### [Reply to a conversation](https://developers.intercom.com/intercom-api-reference/reference/reply-to-a-conversation)
|
|
466
|
+
|
|
467
|
+
##### By id
|
|
468
|
+
|
|
469
|
+
###### As user
|
|
470
|
+
|
|
471
|
+
```typescript
|
|
472
|
+
const response = await client.conversations.replyByIdAsUser({
|
|
473
|
+
id: '098',
|
|
474
|
+
body: 'blablbalba',
|
|
475
|
+
intercomUserId: '123',
|
|
476
|
+
attachmentUrls: '345',
|
|
477
|
+
});
|
|
350
478
|
```
|
|
351
479
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
client.
|
|
480
|
+
###### As admin
|
|
481
|
+
|
|
482
|
+
```typescript
|
|
483
|
+
const response = await client.conversations.replyByIdAsAdmin({
|
|
484
|
+
id: '098',
|
|
485
|
+
adminId: '458',
|
|
486
|
+
messageType: ReplyToConversationMessageType.NOTE,
|
|
487
|
+
body: '<b>Bee C</b>',
|
|
488
|
+
attachmentUrls: ['https://site.org/bebra.jpg'],
|
|
489
|
+
});
|
|
356
490
|
```
|
|
357
491
|
|
|
358
|
-
|
|
492
|
+
##### By last conversation
|
|
359
493
|
|
|
360
|
-
|
|
494
|
+
###### As user
|
|
361
495
|
|
|
362
|
-
```
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
user_id: 'bar',
|
|
368
|
-
metadata: { type: 'baz' }
|
|
369
|
-
}, function (d) {
|
|
370
|
-
console.log(d);
|
|
496
|
+
```typescript
|
|
497
|
+
const response = await client.conversations.replyByLastAsUser({
|
|
498
|
+
body: 'blablbalba',
|
|
499
|
+
intercomUserId: '123',
|
|
500
|
+
attachmentUrls: '345',
|
|
371
501
|
});
|
|
372
502
|
```
|
|
373
503
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
504
|
+
###### As admin
|
|
505
|
+
|
|
506
|
+
```typescript
|
|
507
|
+
const response = await client.conversations.replyByLastAsAdmin({
|
|
508
|
+
adminId: '458',
|
|
509
|
+
messageType: ReplyToConversationMessageType.NOTE,
|
|
510
|
+
body: '<b>Bee C</b>',
|
|
511
|
+
attachmentUrls: ['https://site.org/bebra.jpg'],
|
|
512
|
+
});
|
|
380
513
|
```
|
|
381
514
|
|
|
382
|
-
|
|
515
|
+
#### [Assign a conversation](https://developers.intercom.com/intercom-api-reference/reference/assign-a-conversation)
|
|
383
516
|
|
|
384
|
-
|
|
385
|
-
client.counts.appCounts(callback);
|
|
517
|
+
##### As team without assignment rules
|
|
386
518
|
|
|
387
|
-
|
|
519
|
+
```typescript
|
|
520
|
+
const response = await client.conversations.assign({
|
|
521
|
+
id: '123',
|
|
522
|
+
type: AssignToConversationUserType.TEAM,
|
|
523
|
+
adminId: '456',
|
|
524
|
+
assigneeId: '789',
|
|
525
|
+
body: '<b>blablbalba</b>',
|
|
526
|
+
});
|
|
527
|
+
```
|
|
388
528
|
|
|
389
|
-
|
|
529
|
+
##### As team with assignment rules
|
|
390
530
|
|
|
391
|
-
|
|
531
|
+
```typescript
|
|
532
|
+
const response = await client.conversations.assign({
|
|
533
|
+
id: '123',
|
|
534
|
+
withRunningAssignmentRules: true,
|
|
535
|
+
});
|
|
536
|
+
```
|
|
392
537
|
|
|
393
|
-
|
|
538
|
+
#### [Snooze a conversation](https://developers.intercom.com/intercom-api-reference/reference/snooze-a-conversation)
|
|
394
539
|
|
|
395
|
-
|
|
540
|
+
```typescript
|
|
541
|
+
const response = await client.conversations.snooze({
|
|
542
|
+
id: '123',
|
|
543
|
+
adminId: '234',
|
|
544
|
+
snoozedUntil: '1501512795',
|
|
545
|
+
});
|
|
546
|
+
```
|
|
396
547
|
|
|
397
|
-
|
|
548
|
+
#### [Close a conversation](https://developers.intercom.com/intercom-api-reference/reference/close-a-conversation)
|
|
398
549
|
|
|
399
|
-
|
|
550
|
+
```typescript
|
|
551
|
+
const response = await client.conversations.close({
|
|
552
|
+
id: '123',
|
|
553
|
+
adminId: '456',
|
|
554
|
+
body: "That's it...",
|
|
555
|
+
});
|
|
400
556
|
```
|
|
401
557
|
|
|
402
|
-
|
|
558
|
+
#### [Open a conversation](https://developers.intercom.com/intercom-api-reference/reference/open-a-conversation)
|
|
403
559
|
|
|
404
|
-
```
|
|
405
|
-
|
|
406
|
-
|
|
560
|
+
```typescript
|
|
561
|
+
const response = await client.conversations.open({
|
|
562
|
+
id: '123',
|
|
563
|
+
adminId: '234',
|
|
564
|
+
});
|
|
407
565
|
```
|
|
408
566
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
567
|
+
#### [Attach a contact to group conversation](https://developers.intercom.com/intercom-api-reference/reference/adding-to-group-conversations-as-admin)
|
|
568
|
+
|
|
569
|
+
##### As admin, using intercomUserid
|
|
570
|
+
|
|
571
|
+
```typescript
|
|
572
|
+
const response = await client.conversations.attachContactAsAdmin({
|
|
573
|
+
id: '123',
|
|
574
|
+
adminId: '234',
|
|
575
|
+
customer: {
|
|
576
|
+
intercomUserId: '456',
|
|
577
|
+
},
|
|
578
|
+
});
|
|
412
579
|
```
|
|
413
580
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
581
|
+
##### As contact, using intercomUserid
|
|
582
|
+
|
|
583
|
+
```typescript
|
|
584
|
+
const response = await client.conversations.attachContactAsAdmin({
|
|
585
|
+
id: '123',
|
|
586
|
+
userId: '234',
|
|
587
|
+
customer: {
|
|
588
|
+
intercomUserId: '456',
|
|
589
|
+
},
|
|
590
|
+
});
|
|
417
591
|
```
|
|
418
592
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
593
|
+
#### [Delete a contact from group conversation as admin](https://developers.intercom.com/intercom-api-reference/reference/deleting-from-group-conversations)
|
|
594
|
+
|
|
595
|
+
```typescript
|
|
596
|
+
const response = await client.conversations.detachContactAsAdmin({
|
|
597
|
+
conversationId: '123',
|
|
598
|
+
contactId: '456',
|
|
599
|
+
adminId: '789',
|
|
600
|
+
});
|
|
422
601
|
```
|
|
423
602
|
|
|
424
|
-
|
|
603
|
+
#### [Search for conversations](https://developers.intercom.com/intercom-api-reference/reference/search-for-conversations)
|
|
604
|
+
|
|
605
|
+
```typescript
|
|
606
|
+
const response = await client.conversations.search({
|
|
607
|
+
data: {
|
|
608
|
+
query: {
|
|
609
|
+
operator: Operators.AND,
|
|
610
|
+
value: [
|
|
611
|
+
{
|
|
612
|
+
operator: Operators.AND,
|
|
613
|
+
value: [
|
|
614
|
+
{
|
|
615
|
+
field: 'updated_at',
|
|
616
|
+
operator: Operators.GREATER_THAN,
|
|
617
|
+
value: 1560436650,
|
|
618
|
+
},
|
|
619
|
+
{
|
|
620
|
+
field: 'conversation_rating.rating',
|
|
621
|
+
operator: Operators.EQUALS,
|
|
622
|
+
value: 1,
|
|
623
|
+
},
|
|
624
|
+
],
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
operator: Operators.OR,
|
|
628
|
+
value: [
|
|
629
|
+
{
|
|
630
|
+
field: 'updated_at',
|
|
631
|
+
operator: Operators.GREATER_THAN,
|
|
632
|
+
value: 1560436650,
|
|
633
|
+
},
|
|
634
|
+
{
|
|
635
|
+
field: 'conversation_rating.rating',
|
|
636
|
+
operator: Operators.EQUALS,
|
|
637
|
+
value: 2,
|
|
638
|
+
},
|
|
639
|
+
],
|
|
640
|
+
},
|
|
641
|
+
],
|
|
642
|
+
},
|
|
643
|
+
pagination: {
|
|
644
|
+
per_page: 5,
|
|
645
|
+
starting_after:
|
|
646
|
+
'WzE2MzU4NjA2NDgwMDAsIjYxODJiNjJlNDM4YjdhM2EwMWE4YWYxNSIsMl0=',
|
|
647
|
+
},
|
|
648
|
+
sort: {
|
|
649
|
+
field: 'name',
|
|
650
|
+
order: SearchConversationOrderBy.DESC,
|
|
651
|
+
},
|
|
652
|
+
},
|
|
653
|
+
});
|
|
654
|
+
```
|
|
425
655
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
656
|
+
#### [List all conversations](https://developers.intercom.com/intercom-api-reference/reference/list-conversations)
|
|
657
|
+
|
|
658
|
+
```typescript
|
|
659
|
+
const response = await client.conversations.list({
|
|
660
|
+
query: {
|
|
661
|
+
order: Order.DESC,
|
|
662
|
+
sort: SortBy.UpdatedAt,
|
|
663
|
+
page: 1,
|
|
664
|
+
perPage: 10,
|
|
665
|
+
},
|
|
666
|
+
});
|
|
429
667
|
```
|
|
430
668
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
669
|
+
#### [Redact a conversation](https://developers.intercom.com/intercom-api-reference/reference/redact-a-conversation-part)
|
|
670
|
+
|
|
671
|
+
```typescript
|
|
672
|
+
const response = await client.conversations.redactConversationPart({
|
|
673
|
+
type: RedactConversationPartType.CONVERSATION_PART,
|
|
674
|
+
conversationId: '123',
|
|
675
|
+
conversationPartId: '456',
|
|
676
|
+
});
|
|
434
677
|
```
|
|
435
678
|
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
679
|
+
### Data Attributes
|
|
680
|
+
|
|
681
|
+
#### [Create Data Attribute](https://developers.intercom.com/intercom-api-reference/reference/create-data-attributes)
|
|
682
|
+
|
|
683
|
+
```typescript
|
|
684
|
+
const response = await client.dataAttributes.create({
|
|
685
|
+
name: 'list_cda',
|
|
686
|
+
model: ModelType.CONTACT,
|
|
687
|
+
dataType: DataType.STRING,
|
|
688
|
+
description: 'You are either alive or dead',
|
|
689
|
+
options: [{ value: 'alive' }, { value: 'dead' }],
|
|
690
|
+
});
|
|
439
691
|
```
|
|
440
692
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
693
|
+
#### [Update Data Attribute](https://developers.intercom.com/intercom-api-reference/reference/update-data-attributes)
|
|
694
|
+
|
|
695
|
+
```typescript
|
|
696
|
+
const response = await client.dataAttributes.update({
|
|
697
|
+
id: '123',
|
|
698
|
+
description: 'You are either alive or dead',
|
|
699
|
+
options: [{ value: 'alive' }, { value: 'dead' }],
|
|
700
|
+
archived: true,
|
|
701
|
+
});
|
|
444
702
|
```
|
|
445
703
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
704
|
+
#### [List all Data Attributes](https://developers.intercom.com/intercom-api-reference/reference/list-data-attributes)
|
|
705
|
+
|
|
706
|
+
```typescript
|
|
707
|
+
const response = await client.dataAttributes.list({
|
|
708
|
+
model: ModelType.CONTACT,
|
|
709
|
+
includeArchived: true,
|
|
710
|
+
});
|
|
449
711
|
```
|
|
450
712
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
713
|
+
### Events
|
|
714
|
+
|
|
715
|
+
#### [Submit a data event](https://developers.intercom.com/intercom-api-reference/reference/list-data-attributes)
|
|
716
|
+
|
|
717
|
+
```typescript
|
|
718
|
+
const response = await client.events.create({
|
|
719
|
+
eventName: 'placed-order',
|
|
720
|
+
createdAt: 1389913941,
|
|
721
|
+
userId: 'f4ca124298',
|
|
722
|
+
metadata: {
|
|
723
|
+
order_date: 1392036272,
|
|
724
|
+
stripe_invoice: 'inv_3434343434',
|
|
725
|
+
order_number: {
|
|
726
|
+
value: '3434-3434',
|
|
727
|
+
url: 'https://example.org/orders/3434-3434',
|
|
728
|
+
},
|
|
729
|
+
price: {
|
|
730
|
+
currency: 'usd',
|
|
731
|
+
amount: 2999,
|
|
732
|
+
},
|
|
733
|
+
},
|
|
734
|
+
});
|
|
454
735
|
```
|
|
455
736
|
|
|
456
|
-
|
|
737
|
+
#### [List all data events](https://developers.intercom.com/intercom-api-reference/reference/list-user-events)
|
|
457
738
|
|
|
458
|
-
```
|
|
459
|
-
|
|
460
|
-
|
|
739
|
+
```typescript
|
|
740
|
+
const response = await client.events.listBy({
|
|
741
|
+
userId: '1234',
|
|
742
|
+
perPage: 2,
|
|
743
|
+
summary: true,
|
|
744
|
+
email: 'i_love_memes@gmail.com',
|
|
745
|
+
});
|
|
461
746
|
```
|
|
462
747
|
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
748
|
+
### Messages
|
|
749
|
+
|
|
750
|
+
#### [Create a message](https://developers.intercom.com/intercom-api-reference/reference/admin-initiated-conversation)
|
|
751
|
+
|
|
752
|
+
```typescript
|
|
753
|
+
const response = await client.messages.create({
|
|
754
|
+
messageType: 'email',
|
|
755
|
+
subject: 'This is our demand now',
|
|
756
|
+
body: 'Destroy ponies',
|
|
757
|
+
template: 'plain',
|
|
758
|
+
from: {
|
|
759
|
+
type: 'admin',
|
|
760
|
+
id: '394051',
|
|
761
|
+
},
|
|
762
|
+
to: {
|
|
763
|
+
type: 'user',
|
|
764
|
+
id: '536e564f316c83104c000020',
|
|
765
|
+
},
|
|
766
|
+
});
|
|
466
767
|
```
|
|
467
768
|
|
|
468
|
-
|
|
769
|
+
### Segments
|
|
469
770
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
template: "plain",
|
|
478
|
-
from: {
|
|
479
|
-
type: "admin",
|
|
480
|
-
id: "21599"
|
|
481
|
-
},
|
|
482
|
-
to: {
|
|
483
|
-
type: "user",
|
|
484
|
-
id: "55c1ce1def857c31f80001af"
|
|
485
|
-
}
|
|
486
|
-
}
|
|
487
|
-
|
|
488
|
-
client.messages.create(message, callback);
|
|
771
|
+
#### [Retrieve a segment](https://developers.intercom.com/intercom-api-reference/reference/view-a-segment)
|
|
772
|
+
|
|
773
|
+
```typescript
|
|
774
|
+
const response = await client.segments.find({
|
|
775
|
+
id: '123',
|
|
776
|
+
includeCount: true,
|
|
777
|
+
});
|
|
489
778
|
```
|
|
490
779
|
|
|
491
|
-
|
|
492
|
-
// Creating a user-initiated message:
|
|
493
|
-
var message = {
|
|
494
|
-
from: {
|
|
495
|
-
type: "user",
|
|
496
|
-
id: "55c1ce1def857c31f80001af"
|
|
497
|
-
},
|
|
498
|
-
body: "Howdy"
|
|
499
|
-
}
|
|
780
|
+
#### [List all segments](https://developers.intercom.com/intercom-api-reference/reference/list-segments)
|
|
500
781
|
|
|
501
|
-
|
|
782
|
+
```typescript
|
|
783
|
+
const response = await client.segments.list({
|
|
784
|
+
includeCount: true,
|
|
785
|
+
});
|
|
502
786
|
```
|
|
503
787
|
|
|
504
|
-
|
|
788
|
+
### Tags
|
|
505
789
|
|
|
506
|
-
|
|
790
|
+
#### [Create or update a tag](https://developers.intercom.com/intercom-api-reference/reference/create-and-update-tags)
|
|
507
791
|
|
|
508
|
-
|
|
509
|
-
|
|
792
|
+
##### Create
|
|
793
|
+
|
|
794
|
+
```typescript
|
|
795
|
+
const response = await client.tags.create({ name: 'haven' });
|
|
510
796
|
```
|
|
511
797
|
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
798
|
+
##### Update
|
|
799
|
+
|
|
800
|
+
```typescript
|
|
801
|
+
const response = await client.tags.update({ id: '123', name: 'haven' });
|
|
515
802
|
```
|
|
516
803
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
intercom_user_id: '55b26822ce97179e52001334',
|
|
522
|
-
body: 'Some reply :)',
|
|
523
|
-
type: 'user',
|
|
524
|
-
message_type: 'comment'
|
|
525
|
-
};
|
|
526
|
-
|
|
527
|
-
client.conversations.reply(reply, callback);
|
|
528
|
-
|
|
529
|
-
// Reply to a conversation with attachments
|
|
530
|
-
var reply = {
|
|
531
|
-
id: '1039067180',
|
|
532
|
-
intercom_user_id: '55b26822ce97179e52001334',
|
|
533
|
-
body: 'Some reply :)',
|
|
534
|
-
type: 'user',
|
|
535
|
-
message_type: 'comment',
|
|
536
|
-
attachment_urls: ['http://www.example.com/myattachment.jpg']
|
|
537
|
-
};
|
|
538
|
-
|
|
539
|
-
client.conversations.reply(reply, callback);
|
|
804
|
+
#### [Delete a tag](https://developers.intercom.com/intercom-api-reference/reference/delete-a-tag)
|
|
805
|
+
|
|
806
|
+
```typescript
|
|
807
|
+
const response = await client.tags.delete({ id: 'baz' });
|
|
540
808
|
```
|
|
541
809
|
|
|
542
|
-
|
|
543
|
-
// Assign a conversation to an admin
|
|
544
|
-
var assignment = {
|
|
545
|
-
id: '13879167940',
|
|
546
|
-
type: 'admin',
|
|
547
|
-
admin_id: '1309092',
|
|
548
|
-
assignee_id: '1723471',
|
|
549
|
-
message_type: 'assignment'
|
|
550
|
-
};
|
|
810
|
+
#### [Attach a contact](https://developers.intercom.com/intercom-api-reference/reference/tag-contact)
|
|
551
811
|
|
|
552
|
-
|
|
812
|
+
```typescript
|
|
813
|
+
const response = await client.tags.tagContact({
|
|
814
|
+
contactId: '123',
|
|
815
|
+
tagId: '234',
|
|
816
|
+
});
|
|
817
|
+
```
|
|
553
818
|
|
|
554
|
-
|
|
555
|
-
var assignment = {
|
|
556
|
-
id: '13879167940',
|
|
557
|
-
type: 'admin',
|
|
558
|
-
admin_id: '1309092',
|
|
559
|
-
assignee_id: '0',
|
|
560
|
-
message_type: 'assignment'
|
|
561
|
-
}
|
|
819
|
+
#### [Attach a conversation](https://developers.intercom.com/intercom-api-reference/reference/attach-a-tag-to-a-conversation)
|
|
562
820
|
|
|
563
|
-
|
|
821
|
+
```typescript
|
|
822
|
+
const response = await client.tags.tagConversation({
|
|
823
|
+
conversationId: '123',
|
|
824
|
+
tagId: '456',
|
|
825
|
+
adminId: '789',
|
|
826
|
+
});
|
|
564
827
|
```
|
|
565
828
|
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
829
|
+
#### [Tag companies](https://developers.intercom.com/intercom-api-reference/reference/tag-companies)
|
|
830
|
+
|
|
831
|
+
```typescript
|
|
832
|
+
const response = await client.tags.tagCompanies({
|
|
833
|
+
tagName: 'gutenTag',
|
|
834
|
+
companiesIds: ['123', '234', '456'],
|
|
835
|
+
});
|
|
569
836
|
```
|
|
570
837
|
|
|
571
|
-
|
|
838
|
+
#### [Untag companies](https://developers.intercom.com/intercom-api-reference/reference/untag-companies)
|
|
572
839
|
|
|
573
|
-
```
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
};
|
|
840
|
+
```typescript
|
|
841
|
+
const response = await client.tags.tagCompanies({
|
|
842
|
+
tagName: 'gutenTag',
|
|
843
|
+
companiesIds: ['123', '234', '456'],
|
|
844
|
+
});
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
#### [Untag conversation](https://developers.intercom.com/intercom-api-reference/reference/detach-a-tag-from-a-conversation)
|
|
582
848
|
|
|
583
|
-
|
|
849
|
+
```typescript
|
|
850
|
+
const response = await client.tags.untagConversation({
|
|
851
|
+
conversationId: '123',
|
|
852
|
+
tagId: '345',
|
|
853
|
+
adminId: '678',
|
|
854
|
+
});
|
|
584
855
|
```
|
|
585
856
|
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
857
|
+
#### [Untag contact](https://developers.intercom.com/intercom-api-reference/reference/untag-contact)
|
|
858
|
+
|
|
859
|
+
```typescript
|
|
860
|
+
const response = await client.tags.untagContact({
|
|
861
|
+
contactId: '123',
|
|
862
|
+
tagId: '345',
|
|
863
|
+
});
|
|
589
864
|
```
|
|
590
865
|
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
866
|
+
#### [List all tags](https://developers.intercom.com/intercom-api-reference/reference/list-tags-for-an-app)
|
|
867
|
+
|
|
868
|
+
```typescript
|
|
869
|
+
const response = await client.tags.list();
|
|
594
870
|
```
|
|
595
871
|
|
|
596
|
-
|
|
872
|
+
### Teams
|
|
597
873
|
|
|
598
|
-
|
|
874
|
+
#### [Retrieve a team](https://developers.intercom.com/intercom-api-reference/reference/view-a-team)
|
|
599
875
|
|
|
600
|
-
```
|
|
601
|
-
{
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
}
|
|
605
|
-
}
|
|
876
|
+
```typescript
|
|
877
|
+
const response = await client.teams.find({
|
|
878
|
+
id: '123',
|
|
879
|
+
});
|
|
606
880
|
```
|
|
607
881
|
|
|
608
|
-
|
|
882
|
+
#### [List all teams](https://developers.intercom.com/intercom-api-reference/reference/list-teams)
|
|
609
883
|
|
|
610
|
-
```
|
|
611
|
-
client.
|
|
884
|
+
```typescript
|
|
885
|
+
const response = await client.teams.list();
|
|
612
886
|
```
|
|
613
887
|
|
|
614
|
-
|
|
888
|
+
### Identity verification
|
|
615
889
|
|
|
616
890
|
`intercom-node` provides a helper for using [identity verification](https://docs.intercom.com/configure-intercom-for-your-product-or-site/staying-secure/enable-identity-verification-on-your-web-product):
|
|
617
891
|
|
|
618
|
-
```
|
|
892
|
+
```node
|
|
619
893
|
import { IdentityVerification } from 'intercom-client';
|
|
620
894
|
|
|
621
|
-
IdentityVerification.userHash({
|
|
895
|
+
IdentityVerification.userHash({
|
|
896
|
+
secretKey: 's3cre7',
|
|
897
|
+
identifier: 'jayne@serenity.io',
|
|
898
|
+
});
|
|
622
899
|
```
|
|
623
900
|
|
|
624
901
|
## License
|
|
@@ -627,16 +904,16 @@ Apache-2.0
|
|
|
627
904
|
|
|
628
905
|
## Pull Requests
|
|
629
906
|
|
|
630
|
-
-
|
|
907
|
+
- **Add tests!** Your patch won't be accepted if it doesn't have tests.
|
|
631
908
|
|
|
632
|
-
-
|
|
633
|
-
|
|
909
|
+
- **Document any change in behaviour**. Make sure the README and any other
|
|
910
|
+
relevant documentation are kept up-to-date.
|
|
634
911
|
|
|
635
|
-
-
|
|
912
|
+
- **Create topic branches**. Don't ask us to pull from your master branch.
|
|
636
913
|
|
|
637
|
-
-
|
|
638
|
-
|
|
914
|
+
- **One pull request per feature**. If you want to do more than one thing, send
|
|
915
|
+
multiple pull requests.
|
|
639
916
|
|
|
640
|
-
-
|
|
641
|
-
|
|
642
|
-
|
|
917
|
+
- **Send coherent history**. Make sure each individual commit in your pull
|
|
918
|
+
request is meaningful. If you had to make multiple intermediate commits while
|
|
919
|
+
developing, please squash them before sending them to us.
|