intercom-client 3.0.0-2 → 3.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 +185 -3
- package/package.json +4 -2
package/README.md
CHANGED
|
@@ -9,9 +9,9 @@
|
|
|
9
9
|
|
|
10
10
|
## Project Updates
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
## Breaking changes
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
The Node SDK has been updated to support latest API version (2.4). The update also contains requested features, such like Typescript support. You can find more information on how-to migrate and what has changed in the [migration guide](https://github.com/intercom/intercom-node/wiki/Migration-guide).
|
|
15
15
|
|
|
16
16
|
## Installation
|
|
17
17
|
|
|
@@ -19,7 +19,7 @@ Current repository is a new WIP version of Node SDK, that supports latest API ve
|
|
|
19
19
|
yarn add intercom-client
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
**This client is intended for server side use only. Please use the [Intercom Javascript SDK](https://developers.intercom.com/v2.
|
|
22
|
+
**This client is intended for server side use only. Please use the [Intercom Javascript SDK](https://developers.intercom.com/v2.4/docs/intercom-javascript) for client-side operations.**
|
|
23
23
|
|
|
24
24
|
## Testing
|
|
25
25
|
|
|
@@ -110,6 +110,76 @@ await client.admins.listAllActivityLogs({
|
|
|
110
110
|
const admins = await client.admins.list();
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
### Articles
|
|
114
|
+
|
|
115
|
+
#### [Create an article](https://developers.intercom.com/intercom-api-reference/reference/create-an-article)
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
const article = await client.articles.create({
|
|
119
|
+
title: 'Thanks for everything',
|
|
120
|
+
description: 'English description',
|
|
121
|
+
body: '<p>This is the body in html</p>',
|
|
122
|
+
authorId: 1,
|
|
123
|
+
state: 'published',
|
|
124
|
+
parentId: 1,
|
|
125
|
+
parentType: 'collection',
|
|
126
|
+
translatedContent: {
|
|
127
|
+
fr: {
|
|
128
|
+
title: 'Allez les verts',
|
|
129
|
+
description: 'French description',
|
|
130
|
+
body: '<p>French body in html</p>',
|
|
131
|
+
author_id: 1,
|
|
132
|
+
state: 'published',
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
#### [Retrieve an article](https://developers.intercom.com/intercom-api-reference/reference/retrieve-an-article)
|
|
139
|
+
|
|
140
|
+
```typescript
|
|
141
|
+
const response = await client.articles.find({ id: '123' });
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
#### [Update an article](https://developers.intercom.com/intercom-api-reference/reference/update-an-article)
|
|
145
|
+
|
|
146
|
+
```typescript
|
|
147
|
+
const article = await client.articles.update({
|
|
148
|
+
id: '123',
|
|
149
|
+
title: 'Thanks for everything',
|
|
150
|
+
description: 'English description',
|
|
151
|
+
body: '<p>This is the body in html</p>',
|
|
152
|
+
authorId: 1,
|
|
153
|
+
state: 'published',
|
|
154
|
+
parentId: 1,
|
|
155
|
+
parentType: 'collection',
|
|
156
|
+
translatedContent: {
|
|
157
|
+
fr: {
|
|
158
|
+
title: 'Allez les verts',
|
|
159
|
+
description: 'French description',
|
|
160
|
+
body: '<p>French body in html</p>',
|
|
161
|
+
author_id: 1,
|
|
162
|
+
state: 'published',
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
});
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
#### [Delete an article](https://developers.intercom.com/intercom-api-reference/reference/delete-an-article)
|
|
169
|
+
|
|
170
|
+
```typescript
|
|
171
|
+
await client.articles.delete({ id: '123' });
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
#### [List all articles](https://developers.intercom.com/intercom-api-reference/reference/list-all-articles)
|
|
175
|
+
|
|
176
|
+
```typescript
|
|
177
|
+
const response = await client.articles.list({
|
|
178
|
+
page: 3,
|
|
179
|
+
perPage: 12,
|
|
180
|
+
});
|
|
181
|
+
```
|
|
182
|
+
|
|
113
183
|
### Companies
|
|
114
184
|
|
|
115
185
|
#### [Create a company](https://developers.intercom.com/intercom-api-reference/reference/create-or-update-company)
|
|
@@ -745,6 +815,118 @@ const response = await client.events.listBy({
|
|
|
745
815
|
});
|
|
746
816
|
```
|
|
747
817
|
|
|
818
|
+
### Help Center - Collections
|
|
819
|
+
|
|
820
|
+
#### [Create a collection](https://developers.intercom.com/intercom-api-reference/reference/create-a-collection)
|
|
821
|
+
|
|
822
|
+
```typescript
|
|
823
|
+
const collection = await client.helpCenter.collections.create({
|
|
824
|
+
name: 'Thanks for everything',
|
|
825
|
+
description: 'English description',
|
|
826
|
+
translatedContent: {
|
|
827
|
+
fr: {
|
|
828
|
+
name: 'Allez les verts',
|
|
829
|
+
description: 'French description',
|
|
830
|
+
},
|
|
831
|
+
},
|
|
832
|
+
});
|
|
833
|
+
```
|
|
834
|
+
|
|
835
|
+
#### [Retrieve a collection](https://developers.intercom.com/intercom-api-reference/reference/retrieve-a-collection)
|
|
836
|
+
|
|
837
|
+
```typescript
|
|
838
|
+
const response = await client.helpCenter.collections.find({ id: '123' });
|
|
839
|
+
```
|
|
840
|
+
|
|
841
|
+
#### [Update a collection](https://developers.intercom.com/intercom-api-reference/reference/update-a-collection)
|
|
842
|
+
|
|
843
|
+
```typescript
|
|
844
|
+
const article = await client.helpCenter.collections.update({
|
|
845
|
+
id: '123',
|
|
846
|
+
name: 'Thanks for everything',
|
|
847
|
+
description: 'English description',
|
|
848
|
+
translated_content: {
|
|
849
|
+
fr: {
|
|
850
|
+
name: 'Allez les verts',
|
|
851
|
+
description: 'French description',
|
|
852
|
+
},
|
|
853
|
+
},
|
|
854
|
+
});
|
|
855
|
+
```
|
|
856
|
+
|
|
857
|
+
#### [Delete a collection](https://developers.intercom.com/intercom-api-reference/reference/delete-a-collection)
|
|
858
|
+
|
|
859
|
+
```typescript
|
|
860
|
+
await client.helpCenter.collections.delete({
|
|
861
|
+
id: '123',
|
|
862
|
+
});
|
|
863
|
+
```
|
|
864
|
+
|
|
865
|
+
#### [List all collections](https://developers.intercom.com/intercom-api-reference/reference/list-all-collections)
|
|
866
|
+
|
|
867
|
+
```typescript
|
|
868
|
+
const response = client.helpCenter.collections.list({
|
|
869
|
+
page: 3,
|
|
870
|
+
perPage: 12,
|
|
871
|
+
});
|
|
872
|
+
```
|
|
873
|
+
|
|
874
|
+
## Help Center - Sections
|
|
875
|
+
|
|
876
|
+
#### [Create a section](https://developers.intercom.com/intercom-api-reference/reference/create-a-section)
|
|
877
|
+
|
|
878
|
+
```typescript
|
|
879
|
+
const collection = await client.helpCenter.sections.create({
|
|
880
|
+
name: 'Thanks for everything',
|
|
881
|
+
parent_id: '1234',
|
|
882
|
+
translatedContent: {
|
|
883
|
+
fr: {
|
|
884
|
+
name: 'Allez les verts',
|
|
885
|
+
description: 'French description',
|
|
886
|
+
},
|
|
887
|
+
},
|
|
888
|
+
});
|
|
889
|
+
```
|
|
890
|
+
|
|
891
|
+
#### [Retrieve a section](https://developers.intercom.com/intercom-api-reference/reference/retrieve-a-section)
|
|
892
|
+
|
|
893
|
+
```typescript
|
|
894
|
+
const response = await client.helpCenter.sections.find({ id: '123' });
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
#### [Update a section](https://developers.intercom.com/intercom-api-reference/reference/update-a-section)
|
|
898
|
+
|
|
899
|
+
```typescript
|
|
900
|
+
const article = await client.helpCenter.sections.update({
|
|
901
|
+
id: '123',
|
|
902
|
+
name: 'Thanks for everything',
|
|
903
|
+
parent_id: '456',
|
|
904
|
+
translated_content: {
|
|
905
|
+
fr: {
|
|
906
|
+
name: 'Allez les verts',
|
|
907
|
+
description: 'French description',
|
|
908
|
+
},
|
|
909
|
+
},
|
|
910
|
+
});
|
|
911
|
+
```
|
|
912
|
+
|
|
913
|
+
#### [Delete a section](https://developers.intercom.com/intercom-api-reference/reference/delete-a-section)
|
|
914
|
+
|
|
915
|
+
```typescript
|
|
916
|
+
await client.helpCenter.sections.delete({
|
|
917
|
+
id: '123',
|
|
918
|
+
});
|
|
919
|
+
```
|
|
920
|
+
|
|
921
|
+
#### [List all sections](https://developers.intercom.com/intercom-api-reference/reference/list-all-sections)
|
|
922
|
+
|
|
923
|
+
```typescript
|
|
924
|
+
const response = client.helpCenter.sections.list({
|
|
925
|
+
page: 3,
|
|
926
|
+
perPage: 12,
|
|
927
|
+
});
|
|
928
|
+
```
|
|
929
|
+
|
|
748
930
|
### Messages
|
|
749
931
|
|
|
750
932
|
#### [Create a message](https://developers.intercom.com/intercom-api-reference/reference/admin-initiated-conversation)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "intercom-client",
|
|
3
|
-
"version": "3.0.0
|
|
3
|
+
"version": "3.0.0",
|
|
4
4
|
"description": "Official Node bindings to the Intercom API",
|
|
5
5
|
"homepage": "https://github.com/intercom/intercom-node",
|
|
6
6
|
"bugs:": "https://github.com/intercom/intercom-node/issues",
|
|
@@ -43,9 +43,11 @@
|
|
|
43
43
|
"typescript": "^4.5.3"
|
|
44
44
|
},
|
|
45
45
|
"scripts": {
|
|
46
|
+
"clean": "rm -r dist",
|
|
46
47
|
"static": "eslint .",
|
|
47
48
|
"compile_ts": "tsc",
|
|
48
|
-
"
|
|
49
|
+
"move_compiled_to_dist": "mv dist/lib/* dist && rmdir dist/lib",
|
|
50
|
+
"prepublish": "yarn clean && yarn static && yarn compile_ts && yarn move_compiled_to_dist",
|
|
49
51
|
"test": "mocha -r ts-node/register test/*.ts",
|
|
50
52
|
"coverage": "nyc yarn test"
|
|
51
53
|
},
|