intercom-client 2.10.5 → 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 +696 -390
- package/package.json +65 -48
- package/dist/admin.js +0 -38
- package/dist/bulk.js +0 -46
- package/dist/client.js +0 -261
- package/dist/company.js +0 -72
- package/dist/contact.js +0 -76
- package/dist/conversation.js +0 -43
- package/dist/counts.js +0 -63
- package/dist/event.js +0 -44
- package/dist/get_user.js +0 -13
- package/dist/index.js +0 -60
- package/dist/message.js +0 -28
- package/dist/note.js +0 -38
- package/dist/scroll.js +0 -74
- package/dist/segment.js +0 -33
- package/dist/snippet.js +0 -114
- package/dist/tag.js +0 -54
- package/dist/user-data.js +0 -100
- package/dist/user.js +0 -110
- package/dist/visitor.js +0 -47
package/README.md
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
# intercom-node
|
|
2
|
-
> Official Node bindings to the Intercom API
|
|
3
2
|
|
|
4
|
-
[](https://circleci.com/gh/intercom/intercom-node)
|
|
4
|
+
[](https://www.npmjs.com/package/intercom-client)
|
|
5
|
+

|
|
6
|
+

|
|
5
7
|
|
|
6
|
-
[
|
|
8
|
+
> Official Node bindings to the [Intercom API](https://api.intercom.io/docs)
|
|
7
9
|
|
|
8
|
-
##
|
|
10
|
+
## Project Updates
|
|
11
|
+
|
|
12
|
+
### Maintenance
|
|
9
13
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
(Note, this is in Beta and is for testing purposes only, it should not be used in production)
|
|
14
|
+
Current repository is a new WIP version of Node SDK, that supports latest API version (v2.4 as of 14/01/2022)
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
14
17
|
|
|
15
18
|
```bash
|
|
16
|
-
|
|
19
|
+
yarn add intercom-client
|
|
17
20
|
```
|
|
18
21
|
|
|
19
22
|
**This client is intended for server side use only. Please use the [Intercom Javascript SDK](https://developers.intercom.com/v2.0/docs/intercom-javascript) for client-side operations.**
|
|
@@ -21,7 +24,7 @@ npm install intercom-client
|
|
|
21
24
|
## Testing
|
|
22
25
|
|
|
23
26
|
```bash
|
|
24
|
-
|
|
27
|
+
yarn test
|
|
25
28
|
```
|
|
26
29
|
|
|
27
30
|
## Running the code locally
|
|
@@ -29,585 +32,888 @@ npm test
|
|
|
29
32
|
Compile using babel:
|
|
30
33
|
|
|
31
34
|
```bash
|
|
32
|
-
|
|
35
|
+
yarn prepublish
|
|
33
36
|
```
|
|
34
37
|
|
|
35
|
-
|
|
38
|
+
## Usage
|
|
36
39
|
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
Import Intercom:
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { Client } from './dist/index';
|
|
39
44
|
```
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
Create a client using access tokens:
|
|
42
47
|
|
|
43
|
-
|
|
48
|
+
```typescript
|
|
49
|
+
const client = new Client({ tokenAuth: { token: 'my_token' } });
|
|
50
|
+
```
|
|
44
51
|
|
|
45
|
-
|
|
46
|
-
|
|
52
|
+
## Request Options
|
|
53
|
+
|
|
54
|
+
This client library also supports passing in [`request` options](https://github.com/axios/axios#request-config):
|
|
55
|
+
|
|
56
|
+
```typescript
|
|
57
|
+
const client = new Client({ tokenAuth: { token: 'my_token' } });
|
|
58
|
+
client.useRequestOpts({
|
|
59
|
+
baseURL: 'http://local.test-server.com',
|
|
60
|
+
});
|
|
47
61
|
```
|
|
48
62
|
|
|
49
|
-
|
|
50
|
-
|
|
63
|
+
Note that certain request options (such as `json`, and certain `headers` names cannot be overriden).
|
|
64
|
+
|
|
65
|
+
### Setting the API version
|
|
51
66
|
|
|
52
|
-
|
|
53
|
-
|
|
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
|
+
},
|
|
75
|
+
});
|
|
54
76
|
```
|
|
55
77
|
|
|
56
|
-
##
|
|
78
|
+
## Examples
|
|
57
79
|
|
|
58
|
-
|
|
80
|
+
### Admins
|
|
59
81
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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' });
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### [Set Admin away](https://developers.intercom.com/intercom-api-reference/reference/set-admin-away-mode)
|
|
89
|
+
|
|
90
|
+
```typescript
|
|
91
|
+
await client.admins.away({
|
|
92
|
+
adminId: '123',
|
|
93
|
+
enableAwayMode: true,
|
|
94
|
+
enableReassignMode: false,
|
|
63
95
|
});
|
|
96
|
+
```
|
|
64
97
|
|
|
65
|
-
|
|
98
|
+
#### [List all activity logs](https://developers.intercom.com/intercom-api-reference/reference/view-admin-activity-logs)
|
|
66
99
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
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');,
|
|
70
104
|
});
|
|
71
105
|
```
|
|
72
106
|
|
|
73
|
-
|
|
107
|
+
#### [List all admins](https://developers.intercom.com/intercom-api-reference/reference/list-admins)
|
|
74
108
|
|
|
75
|
-
|
|
109
|
+
```typescript
|
|
110
|
+
const admins = await client.admins.list();
|
|
111
|
+
```
|
|
76
112
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
113
|
+
### Companies
|
|
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: {},
|
|
80
128
|
});
|
|
81
129
|
```
|
|
82
130
|
|
|
83
|
-
|
|
131
|
+
#### [Update a company](https://developers.intercom.com/intercom-api-reference/reference/update-a-company)
|
|
84
132
|
|
|
85
|
-
|
|
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
|
+
});
|
|
145
|
+
```
|
|
86
146
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
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,
|
|
93
154
|
});
|
|
94
155
|
```
|
|
95
156
|
|
|
96
|
-
|
|
157
|
+
##### By name
|
|
97
158
|
|
|
159
|
+
```typescript
|
|
160
|
+
const company = await client.companies.find({
|
|
161
|
+
name: 'bruh moment inc.',
|
|
162
|
+
});
|
|
163
|
+
```
|
|
98
164
|
|
|
99
|
-
|
|
165
|
+
#### [Delete a company](https://developers.intercom.com/intercom-api-reference/reference/delete-a-company)
|
|
100
166
|
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
custom_attributes: {
|
|
106
|
-
foo: 'bar'
|
|
107
|
-
}
|
|
108
|
-
}, callback);
|
|
109
|
-
|
|
110
|
-
// Update a user
|
|
111
|
-
client.users.update({
|
|
112
|
-
email: 'jayne@serenity.io',
|
|
113
|
-
custom_attributes: {
|
|
114
|
-
foo: 'bar'
|
|
115
|
-
}
|
|
116
|
-
}, callback);
|
|
167
|
+
```typescript
|
|
168
|
+
const company = await client.companies.delete({
|
|
169
|
+
id: 62049,
|
|
170
|
+
});
|
|
117
171
|
```
|
|
118
172
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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,
|
|
182
|
+
});
|
|
122
183
|
```
|
|
123
184
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
185
|
+
##### With TagId and SegmentId
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
const companies = await client.companies.list({
|
|
189
|
+
tagId: '1234',
|
|
190
|
+
segmentId: '4567',
|
|
191
|
+
});
|
|
127
192
|
```
|
|
128
193
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
194
|
+
#### [Scroll over companies](https://developers.intercom.com/intercom-api-reference/reference/iterating-over-all-companies)
|
|
195
|
+
|
|
196
|
+
##### Using infinite scroll
|
|
197
|
+
|
|
198
|
+
```typescript
|
|
199
|
+
const companies = await client.companies.scroll.each({});
|
|
132
200
|
```
|
|
133
201
|
|
|
134
|
-
|
|
135
|
-
// Scroll through users list
|
|
136
|
-
client.users.scroll.each({}, function(res) {
|
|
137
|
-
// if you return a promise from your callback, the client will only scroll
|
|
138
|
-
// after this promise has resolved
|
|
139
|
-
new Bluebird((resolve) => {
|
|
140
|
-
setTimeout(() => {
|
|
141
|
-
console.log(res.body.users.length);
|
|
142
|
-
// Your custom logic
|
|
143
|
-
resolve();
|
|
144
|
-
}, 500)
|
|
145
|
-
})
|
|
146
|
-
});
|
|
202
|
+
##### Using manual scroll
|
|
147
203
|
|
|
204
|
+
```typescript
|
|
205
|
+
const companies = await client.companies.scroll.next({
|
|
206
|
+
scrollParam: '123_soleil',
|
|
207
|
+
});
|
|
148
208
|
```
|
|
149
209
|
|
|
150
|
-
|
|
151
|
-
// Find user by id
|
|
152
|
-
client.users.find({ id: '55b9eaf' }, callback);
|
|
210
|
+
#### [Attach a contact](https://developers.intercom.com/intercom-api-reference/reference/attach-contact-to-company)
|
|
153
211
|
|
|
154
|
-
|
|
155
|
-
client.
|
|
212
|
+
```typescript
|
|
213
|
+
const response = await client.companies.attachContact({
|
|
214
|
+
contactId: '123',
|
|
215
|
+
companyId: '234',
|
|
216
|
+
});
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
#### [Detach a contact](https://developers.intercom.com/intercom-api-reference/reference/detach-contact-from-company)
|
|
156
220
|
|
|
157
|
-
|
|
158
|
-
client.
|
|
221
|
+
```typescript
|
|
222
|
+
const response = await client.companies.detachContact({
|
|
223
|
+
contactId: '123',
|
|
224
|
+
companyId: '234',
|
|
225
|
+
});
|
|
159
226
|
```
|
|
160
227
|
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
228
|
+
#### [List attached contacts](https://developers.intercom.com/intercom-api-reference/reference/list-company-contacts)
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
const response = await client.companies.listAttachedContacts({
|
|
232
|
+
companyId: '123',
|
|
233
|
+
page: 1,
|
|
234
|
+
perPage: 15,
|
|
235
|
+
});
|
|
164
236
|
```
|
|
165
237
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
client.
|
|
238
|
+
#### [List attached segments](https://developers.intercom.com/intercom-api-reference/reference/list-attached-segments-1)
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
const response = await client.companies.listAttachedSegments({
|
|
242
|
+
companyId: '123',
|
|
243
|
+
});
|
|
170
244
|
```
|
|
171
245
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
246
|
+
### Contacts
|
|
247
|
+
|
|
248
|
+
#### [Create Contact](https://developers.intercom.com/intercom-api-reference/reference/create-contact)
|
|
175
249
|
|
|
176
|
-
|
|
177
|
-
client.users.requestPermanentDeletionByParams({ user_id: 'foobar' }, callback);
|
|
250
|
+
##### With User Role
|
|
178
251
|
|
|
179
|
-
|
|
180
|
-
client.
|
|
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,
|
|
262
|
+
});
|
|
181
263
|
```
|
|
182
264
|
|
|
183
|
-
|
|
265
|
+
##### With Lead Role
|
|
184
266
|
|
|
185
|
-
```
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
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,
|
|
189
276
|
});
|
|
277
|
+
```
|
|
278
|
+
|
|
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' });
|
|
283
|
+
```
|
|
190
284
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
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
|
+
},
|
|
194
295
|
});
|
|
195
296
|
```
|
|
196
297
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
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' });
|
|
200
302
|
```
|
|
201
303
|
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
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' });
|
|
205
308
|
```
|
|
206
309
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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' });
|
|
314
|
+
```
|
|
315
|
+
|
|
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',
|
|
219
322
|
});
|
|
220
323
|
```
|
|
221
324
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
+
});
|
|
225
373
|
```
|
|
226
374
|
|
|
375
|
+
#### [List all Contacts](https://developers.intercom.com/intercom-api-reference/reference/list-contacts)
|
|
227
376
|
|
|
228
|
-
|
|
229
|
-
// Find contact by id
|
|
230
|
-
client.leads.find({ id: '5342423' }, callback);
|
|
231
|
-
```
|
|
377
|
+
##### With cursor
|
|
232
378
|
|
|
233
|
-
```
|
|
234
|
-
|
|
235
|
-
|
|
379
|
+
```typescript
|
|
380
|
+
const response = await client.contacts.list({
|
|
381
|
+
perPage: 5,
|
|
382
|
+
startingAfter:
|
|
383
|
+
'WzE2MzU3NzU4NjkwMDAsIjYxODJiNjJhMDMwZTk4OTBkZWU4NGM5YiIsMl0=',
|
|
384
|
+
});
|
|
236
385
|
```
|
|
237
386
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
user: { email: 'mal@serenity.io' }
|
|
243
|
-
};
|
|
244
|
-
client.leads.convert(conversion, callback);
|
|
387
|
+
##### Without a cursor
|
|
388
|
+
|
|
389
|
+
```typescript
|
|
390
|
+
const response = await client.contacts.list();
|
|
245
391
|
```
|
|
246
392
|
|
|
247
|
-
|
|
393
|
+
#### [List attached companies](https://developers.intercom.com/intercom-api-reference/reference/list-companies-of-contact)
|
|
248
394
|
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
|
|
395
|
+
```typescript
|
|
396
|
+
const response = await client.contacts.listAttachedCompanies({
|
|
397
|
+
id: '123',
|
|
398
|
+
perPage: 5,
|
|
399
|
+
page: 1,
|
|
400
|
+
});
|
|
252
401
|
```
|
|
253
402
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
client.
|
|
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' });
|
|
258
407
|
```
|
|
259
408
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
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' });
|
|
263
413
|
```
|
|
264
414
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
};
|
|
272
|
-
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
|
+
});
|
|
273
421
|
```
|
|
274
422
|
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
423
|
+
### Conversations
|
|
424
|
+
|
|
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',
|
|
431
|
+
});
|
|
282
432
|
```
|
|
283
433
|
|
|
434
|
+
#### [Retrieve a conversation](https://developers.intercom.com/intercom-api-reference/reference/retrieve-a-conversation)
|
|
284
435
|
|
|
285
|
-
|
|
436
|
+
##### Formatted text
|
|
286
437
|
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
console.log(r);
|
|
438
|
+
```typescript
|
|
439
|
+
const response = await client.conversations.find({
|
|
440
|
+
id: '123',
|
|
291
441
|
});
|
|
292
442
|
```
|
|
293
443
|
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
444
|
+
##### As plain text
|
|
445
|
+
|
|
446
|
+
```typescript
|
|
447
|
+
const response = await client.conversations.find({
|
|
448
|
+
id: '123',
|
|
449
|
+
inPlainText: true,
|
|
450
|
+
});
|
|
297
451
|
```
|
|
298
452
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
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
|
+
},
|
|
462
|
+
});
|
|
302
463
|
```
|
|
303
464
|
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
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',
|
|
316
477
|
});
|
|
317
478
|
```
|
|
318
479
|
|
|
480
|
+
###### As admin
|
|
319
481
|
|
|
320
|
-
```
|
|
321
|
-
|
|
322
|
-
|
|
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
|
+
});
|
|
323
490
|
```
|
|
324
491
|
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
492
|
+
##### By last conversation
|
|
493
|
+
|
|
494
|
+
###### As user
|
|
495
|
+
|
|
496
|
+
```typescript
|
|
497
|
+
const response = await client.conversations.replyByLastAsUser({
|
|
498
|
+
body: 'blablbalba',
|
|
499
|
+
intercomUserId: '123',
|
|
500
|
+
attachmentUrls: '345',
|
|
501
|
+
});
|
|
329
502
|
```
|
|
330
503
|
|
|
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
|
+
});
|
|
513
|
+
```
|
|
331
514
|
|
|
332
|
-
|
|
515
|
+
#### [Assign a conversation](https://developers.intercom.com/intercom-api-reference/reference/assign-a-conversation)
|
|
333
516
|
|
|
334
|
-
|
|
517
|
+
##### As team without assignment rules
|
|
335
518
|
|
|
336
|
-
```
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}, function (d) {
|
|
344
|
-
console.log(d);
|
|
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>',
|
|
345
526
|
});
|
|
346
527
|
```
|
|
347
528
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
529
|
+
##### As team with assignment rules
|
|
530
|
+
|
|
531
|
+
```typescript
|
|
532
|
+
const response = await client.conversations.assign({
|
|
533
|
+
id: '123',
|
|
534
|
+
withRunningAssignmentRules: true,
|
|
535
|
+
});
|
|
354
536
|
```
|
|
355
537
|
|
|
356
|
-
|
|
538
|
+
#### [Snooze a conversation](https://developers.intercom.com/intercom-api-reference/reference/snooze-a-conversation)
|
|
357
539
|
|
|
358
|
-
```
|
|
359
|
-
client.
|
|
540
|
+
```typescript
|
|
541
|
+
const response = await client.conversations.snooze({
|
|
542
|
+
id: '123',
|
|
543
|
+
adminId: '234',
|
|
544
|
+
snoozedUntil: '1501512795',
|
|
545
|
+
});
|
|
546
|
+
```
|
|
360
547
|
|
|
361
|
-
|
|
548
|
+
#### [Close a conversation](https://developers.intercom.com/intercom-api-reference/reference/close-a-conversation)
|
|
362
549
|
|
|
363
|
-
|
|
550
|
+
```typescript
|
|
551
|
+
const response = await client.conversations.close({
|
|
552
|
+
id: '123',
|
|
553
|
+
adminId: '456',
|
|
554
|
+
body: "That's it...",
|
|
555
|
+
});
|
|
556
|
+
```
|
|
364
557
|
|
|
365
|
-
|
|
558
|
+
#### [Open a conversation](https://developers.intercom.com/intercom-api-reference/reference/open-a-conversation)
|
|
366
559
|
|
|
367
|
-
|
|
560
|
+
```typescript
|
|
561
|
+
const response = await client.conversations.open({
|
|
562
|
+
id: '123',
|
|
563
|
+
adminId: '234',
|
|
564
|
+
});
|
|
565
|
+
```
|
|
368
566
|
|
|
369
|
-
|
|
567
|
+
#### [Attach a contact to group conversation](https://developers.intercom.com/intercom-api-reference/reference/adding-to-group-conversations-as-admin)
|
|
370
568
|
|
|
371
|
-
|
|
569
|
+
##### As admin, using intercomUserid
|
|
372
570
|
|
|
373
|
-
|
|
571
|
+
```typescript
|
|
572
|
+
const response = await client.conversations.attachContactAsAdmin({
|
|
573
|
+
id: '123',
|
|
574
|
+
adminId: '234',
|
|
575
|
+
customer: {
|
|
576
|
+
intercomUserId: '456',
|
|
577
|
+
},
|
|
578
|
+
});
|
|
374
579
|
```
|
|
375
580
|
|
|
376
|
-
|
|
581
|
+
##### As contact, using intercomUserid
|
|
377
582
|
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
|
|
583
|
+
```typescript
|
|
584
|
+
const response = await client.conversations.attachContactAsAdmin({
|
|
585
|
+
id: '123',
|
|
586
|
+
userId: '234',
|
|
587
|
+
customer: {
|
|
588
|
+
intercomUserId: '456',
|
|
589
|
+
},
|
|
590
|
+
});
|
|
381
591
|
```
|
|
382
592
|
|
|
383
|
-
|
|
384
|
-
// Find current admin (only works with OAuth tokens)
|
|
385
|
-
client.admins.me(callback);
|
|
386
|
-
```
|
|
593
|
+
#### [Delete a contact from group conversation as admin](https://developers.intercom.com/intercom-api-reference/reference/deleting-from-group-conversations)
|
|
387
594
|
|
|
595
|
+
```typescript
|
|
596
|
+
const response = await client.conversations.detachContactAsAdmin({
|
|
597
|
+
conversationId: '123',
|
|
598
|
+
contactId: '456',
|
|
599
|
+
adminId: '789',
|
|
600
|
+
});
|
|
388
601
|
```
|
|
389
|
-
|
|
390
|
-
|
|
602
|
+
|
|
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
|
+
});
|
|
391
654
|
```
|
|
392
655
|
|
|
393
|
-
|
|
656
|
+
#### [List all conversations](https://developers.intercom.com/intercom-api-reference/reference/list-conversations)
|
|
394
657
|
|
|
395
|
-
```
|
|
396
|
-
|
|
397
|
-
|
|
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
|
+
});
|
|
398
667
|
```
|
|
399
668
|
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
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
|
+
});
|
|
403
677
|
```
|
|
404
678
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
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
|
+
});
|
|
408
691
|
```
|
|
409
692
|
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
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
|
+
});
|
|
413
702
|
```
|
|
414
703
|
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
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
|
+
});
|
|
418
711
|
```
|
|
419
712
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
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
|
+
});
|
|
423
735
|
```
|
|
424
736
|
|
|
425
|
-
|
|
737
|
+
#### [List all data events](https://developers.intercom.com/intercom-api-reference/reference/list-user-events)
|
|
426
738
|
|
|
427
|
-
```
|
|
428
|
-
|
|
429
|
-
|
|
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
|
+
});
|
|
430
746
|
```
|
|
431
747
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
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
|
+
});
|
|
435
767
|
```
|
|
436
768
|
|
|
437
|
-
|
|
769
|
+
### Segments
|
|
438
770
|
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
template: "plain",
|
|
447
|
-
from: {
|
|
448
|
-
type: "admin",
|
|
449
|
-
id: "21599"
|
|
450
|
-
},
|
|
451
|
-
to: {
|
|
452
|
-
type: "user",
|
|
453
|
-
id: "55c1ce1def857c31f80001af"
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
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
|
+
});
|
|
458
778
|
```
|
|
459
779
|
|
|
460
|
-
|
|
461
|
-
// Creating a user-initiated message:
|
|
462
|
-
var message = {
|
|
463
|
-
from: {
|
|
464
|
-
type: "user",
|
|
465
|
-
id: "55c1ce1def857c31f80001af"
|
|
466
|
-
},
|
|
467
|
-
body: "Howdy"
|
|
468
|
-
}
|
|
780
|
+
#### [List all segments](https://developers.intercom.com/intercom-api-reference/reference/list-segments)
|
|
469
781
|
|
|
470
|
-
|
|
782
|
+
```typescript
|
|
783
|
+
const response = await client.segments.list({
|
|
784
|
+
includeCount: true,
|
|
785
|
+
});
|
|
471
786
|
```
|
|
472
787
|
|
|
473
|
-
|
|
788
|
+
### Tags
|
|
474
789
|
|
|
475
|
-
|
|
790
|
+
#### [Create or update a tag](https://developers.intercom.com/intercom-api-reference/reference/create-and-update-tags)
|
|
476
791
|
|
|
477
|
-
|
|
478
|
-
|
|
792
|
+
##### Create
|
|
793
|
+
|
|
794
|
+
```typescript
|
|
795
|
+
const response = await client.tags.create({ name: 'haven' });
|
|
479
796
|
```
|
|
480
797
|
|
|
798
|
+
##### Update
|
|
481
799
|
|
|
482
|
-
```
|
|
483
|
-
|
|
484
|
-
client.conversations.find({ id: '1062682196' }, callback);
|
|
800
|
+
```typescript
|
|
801
|
+
const response = await client.tags.update({ id: '123', name: 'haven' });
|
|
485
802
|
```
|
|
486
803
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
intercom_user_id: '55b26822ce97179e52001334',
|
|
492
|
-
body: 'Some reply :)',
|
|
493
|
-
type: 'user',
|
|
494
|
-
message_type: 'comment'
|
|
495
|
-
};
|
|
496
|
-
|
|
497
|
-
client.conversations.reply(reply, callback);
|
|
498
|
-
|
|
499
|
-
// Reply to a conversation with attachments
|
|
500
|
-
var reply = {
|
|
501
|
-
id: '1039067180',
|
|
502
|
-
intercom_user_id: '55b26822ce97179e52001334',
|
|
503
|
-
body: 'Some reply :)',
|
|
504
|
-
type: 'user',
|
|
505
|
-
message_type: 'comment',
|
|
506
|
-
attachment_urls: ['http://www.example.com/myattachment.jpg']
|
|
507
|
-
};
|
|
508
|
-
|
|
509
|
-
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' });
|
|
510
808
|
```
|
|
511
809
|
|
|
512
|
-
|
|
513
|
-
// Assign a conversation to an admin
|
|
514
|
-
var assignment = {
|
|
515
|
-
id: '13879167940',
|
|
516
|
-
type: 'admin',
|
|
517
|
-
admin_id: '1309092',
|
|
518
|
-
assignee_id: '1723471',
|
|
519
|
-
message_type: 'assignment'
|
|
520
|
-
};
|
|
810
|
+
#### [Attach a contact](https://developers.intercom.com/intercom-api-reference/reference/tag-contact)
|
|
521
811
|
|
|
522
|
-
|
|
812
|
+
```typescript
|
|
813
|
+
const response = await client.tags.tagContact({
|
|
814
|
+
contactId: '123',
|
|
815
|
+
tagId: '234',
|
|
816
|
+
});
|
|
817
|
+
```
|
|
523
818
|
|
|
524
|
-
|
|
525
|
-
var assignment = {
|
|
526
|
-
id: '13879167940',
|
|
527
|
-
type: 'admin',
|
|
528
|
-
admin_id: '1309092',
|
|
529
|
-
assignee_id: '0',
|
|
530
|
-
message_type: 'assignment'
|
|
531
|
-
}
|
|
819
|
+
#### [Attach a conversation](https://developers.intercom.com/intercom-api-reference/reference/attach-a-tag-to-a-conversation)
|
|
532
820
|
|
|
533
|
-
|
|
821
|
+
```typescript
|
|
822
|
+
const response = await client.tags.tagConversation({
|
|
823
|
+
conversationId: '123',
|
|
824
|
+
tagId: '456',
|
|
825
|
+
adminId: '789',
|
|
826
|
+
});
|
|
534
827
|
```
|
|
535
828
|
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
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
|
+
});
|
|
539
836
|
```
|
|
540
837
|
|
|
541
|
-
|
|
838
|
+
#### [Untag companies](https://developers.intercom.com/intercom-api-reference/reference/untag-companies)
|
|
542
839
|
|
|
543
|
-
```
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
id: '55b26822ce97179e52001334'
|
|
550
|
-
}
|
|
551
|
-
};
|
|
840
|
+
```typescript
|
|
841
|
+
const response = await client.tags.tagCompanies({
|
|
842
|
+
tagName: 'gutenTag',
|
|
843
|
+
companiesIds: ['123', '234', '456'],
|
|
844
|
+
});
|
|
845
|
+
```
|
|
552
846
|
|
|
553
|
-
|
|
847
|
+
#### [Untag conversation](https://developers.intercom.com/intercom-api-reference/reference/detach-a-tag-from-a-conversation)
|
|
848
|
+
|
|
849
|
+
```typescript
|
|
850
|
+
const response = await client.tags.untagConversation({
|
|
851
|
+
conversationId: '123',
|
|
852
|
+
tagId: '345',
|
|
853
|
+
adminId: '678',
|
|
854
|
+
});
|
|
554
855
|
```
|
|
555
856
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
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
|
+
});
|
|
559
864
|
```
|
|
560
865
|
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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();
|
|
564
870
|
```
|
|
565
871
|
|
|
566
|
-
|
|
872
|
+
### Teams
|
|
567
873
|
|
|
568
|
-
|
|
874
|
+
#### [Retrieve a team](https://developers.intercom.com/intercom-api-reference/reference/view-a-team)
|
|
569
875
|
|
|
570
|
-
```
|
|
571
|
-
{
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
}
|
|
575
|
-
}
|
|
876
|
+
```typescript
|
|
877
|
+
const response = await client.teams.find({
|
|
878
|
+
id: '123',
|
|
879
|
+
});
|
|
576
880
|
```
|
|
577
881
|
|
|
578
|
-
|
|
882
|
+
#### [List all teams](https://developers.intercom.com/intercom-api-reference/reference/list-teams)
|
|
579
883
|
|
|
580
|
-
```
|
|
581
|
-
client.
|
|
884
|
+
```typescript
|
|
885
|
+
const response = await client.teams.list();
|
|
582
886
|
```
|
|
583
887
|
|
|
584
|
-
|
|
888
|
+
### Identity verification
|
|
585
889
|
|
|
586
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):
|
|
587
891
|
|
|
588
|
-
```
|
|
892
|
+
```node
|
|
589
893
|
import { IdentityVerification } from 'intercom-client';
|
|
590
894
|
|
|
591
|
-
IdentityVerification.userHash({
|
|
895
|
+
IdentityVerification.userHash({
|
|
896
|
+
secretKey: 's3cre7',
|
|
897
|
+
identifier: 'jayne@serenity.io',
|
|
898
|
+
});
|
|
592
899
|
```
|
|
593
900
|
|
|
594
901
|
## License
|
|
595
902
|
|
|
596
903
|
Apache-2.0
|
|
597
904
|
|
|
598
|
-
|
|
599
905
|
## Pull Requests
|
|
600
906
|
|
|
601
|
-
-
|
|
907
|
+
- **Add tests!** Your patch won't be accepted if it doesn't have tests.
|
|
602
908
|
|
|
603
|
-
-
|
|
604
|
-
|
|
909
|
+
- **Document any change in behaviour**. Make sure the README and any other
|
|
910
|
+
relevant documentation are kept up-to-date.
|
|
605
911
|
|
|
606
|
-
-
|
|
912
|
+
- **Create topic branches**. Don't ask us to pull from your master branch.
|
|
607
913
|
|
|
608
|
-
-
|
|
609
|
-
|
|
914
|
+
- **One pull request per feature**. If you want to do more than one thing, send
|
|
915
|
+
multiple pull requests.
|
|
610
916
|
|
|
611
|
-
-
|
|
612
|
-
|
|
613
|
-
|
|
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.
|