crisp-api 10.10.0 → 10.10.2

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/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v10.10.2
5
+
6
+ ### Changes
7
+
8
+ * Added `CrispClient.website.requestToolCallForConversation` method.
9
+
10
+ ## v10.10.1
11
+
12
+ ### Changes
13
+
14
+ * Added `CrispClient.website.batchUpdateConversationsData`, `CrispClient.website.batchUpdatePeopleData`, `CrispClient.website.batchUpdateConversationsSegments` and `CrispClient.website.batchUpdatePeopleSegments` methods.
15
+
4
16
  ## v10.9.3
5
17
 
6
18
  ### Changes
package/EXAMPLES.md CHANGED
@@ -602,6 +602,17 @@ CrispClient.website.transmitSignalingOnOngoingCallSession(websiteID, sessionID,
602
602
 
603
603
  =========================
604
604
 
605
+ https://docs.crisp.chat/references/rest-api/v1/#request-tool-call-for-conversation
606
+
607
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
608
+ var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
609
+
610
+ var command = "list_tools";
611
+
612
+ CrispClient.website.requestToolCallForConversation(websiteID, sessionID, command);
613
+
614
+ =========================
615
+
605
616
  https://docs.crisp.chat/references/rest-api/v1/#deliver-widget-button-action-for-conversation
606
617
 
607
618
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
@@ -1692,7 +1703,6 @@ var settings = {
1692
1703
  "emails": {
1693
1704
  "rating": true,
1694
1705
  "transcript": true,
1695
- "enrich": true,
1696
1706
  "junk_filter": true
1697
1707
  },
1698
1708
  "chatbox": {
@@ -1990,6 +2000,84 @@ CrispClient.website.batchRemovePeople(websiteID, people);
1990
2000
 
1991
2001
  =========================
1992
2002
 
2003
+ https://docs.crisp.chat/references/rest-api/v1/#batch-data-items
2004
+
2005
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2006
+
2007
+ var operation = {
2008
+ "sessions": [
2009
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
2010
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
2011
+ ],
2012
+
2013
+ "data": {
2014
+ "plan": "pro",
2015
+ "subscribed": true
2016
+ }
2017
+ };
2018
+
2019
+ CrispClient.website.batchUpdateConversationsData(websiteID, operation);
2020
+
2021
+ =========================
2022
+
2023
+ https://docs.crisp.chat/references/rest-api/v1/#batch-data-items
2024
+
2025
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2026
+
2027
+ var people = {
2028
+ "profiles": [
2029
+ "eee8759d-52db-48e5-982d-3426e3566ce0"
2030
+ ]
2031
+ };
2032
+
2033
+ var data = {
2034
+ "plan": "pro",
2035
+ "subscribed": true
2036
+ };
2037
+
2038
+ CrispClient.website.batchUpdatePeopleData(websiteID, people, data);
2039
+
2040
+ =========================
2041
+
2042
+ https://docs.crisp.chat/references/rest-api/v1/#batch-segments-items
2043
+
2044
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2045
+
2046
+ var operation = {
2047
+ "sessions": [
2048
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
2049
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
2050
+ ],
2051
+
2052
+ "segments": [
2053
+ "vip",
2054
+ "lead"
2055
+ ]
2056
+ };
2057
+
2058
+ CrispClient.website.batchUpdateConversationsSegments(websiteID, operation);
2059
+
2060
+ =========================
2061
+
2062
+ https://docs.crisp.chat/references/rest-api/v1/#batch-segments-items
2063
+
2064
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2065
+
2066
+ var people = {
2067
+ "profiles": [
2068
+ "eee8759d-52db-48e5-982d-3426e3566ce0"
2069
+ ]
2070
+ };
2071
+
2072
+ var segments = [
2073
+ "vip",
2074
+ "lead"
2075
+ ];
2076
+
2077
+ CrispClient.website.batchUpdatePeopleSegments(websiteID, people, segments);
2078
+
2079
+ =========================
2080
+
1993
2081
  https://docs.crisp.chat/references/rest-api/v1/#list-website-inboxes
1994
2082
 
1995
2083
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
package/README.md CHANGED
@@ -1003,6 +1003,21 @@ All methods that you will most likely need when building a Crisp integration are
1003
1003
  ```
1004
1004
  </details>
1005
1005
 
1006
+ * **Request Tool Call For Conversation**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#request-tool-call-for-conversation)
1007
+ * `CrispClient.website.requestToolCallForConversation(websiteID, sessionID, command, payload)`
1008
+ * <details>
1009
+ <summary>See Example</summary>
1010
+
1011
+ ```javascript
1012
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1013
+ var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
1014
+
1015
+ var command = "list_tools";
1016
+
1017
+ CrispClient.website.requestToolCallForConversation(websiteID, sessionID, command);
1018
+ ```
1019
+ </details>
1020
+
1006
1021
  * **Deliver Widget Button Action For Conversation**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#deliver-widget-button-action-for-conversation)
1007
1022
  * `CrispClient.website.deliverWidgetButtonActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data, value)`
1008
1023
  * <details>
@@ -2468,7 +2483,6 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2468
2483
  "emails": {
2469
2484
  "rating": true,
2470
2485
  "transcript": true,
2471
- "enrich": true,
2472
2486
  "junk_filter": true
2473
2487
  },
2474
2488
  "chatbox": {
@@ -2978,6 +2992,100 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2978
2992
  ```
2979
2993
  </details>
2980
2994
 
2995
+ * **Batch Update Conversations Data**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-data-items)
2996
+ * `CrispClient.website.batchUpdateConversationsData(websiteID, operation)`
2997
+ * <details>
2998
+ <summary>See Example</summary>
2999
+
3000
+ ```javascript
3001
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
3002
+
3003
+ var operation = {
3004
+ "sessions": [
3005
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
3006
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
3007
+ ],
3008
+
3009
+ "data": {
3010
+ "plan": "pro",
3011
+ "subscribed": true
3012
+ }
3013
+ };
3014
+
3015
+ CrispClient.website.batchUpdateConversationsData(websiteID, operation);
3016
+ ```
3017
+ </details>
3018
+
3019
+ * **Batch Update People Data**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-data-items)
3020
+ * `CrispClient.website.batchUpdatePeopleData(websiteID, people, data)`
3021
+ * <details>
3022
+ <summary>See Example</summary>
3023
+
3024
+ ```javascript
3025
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
3026
+
3027
+ var people = {
3028
+ "profiles": [
3029
+ "eee8759d-52db-48e5-982d-3426e3566ce0"
3030
+ ]
3031
+ };
3032
+
3033
+ var data = {
3034
+ "plan": "pro",
3035
+ "subscribed": true
3036
+ };
3037
+
3038
+ CrispClient.website.batchUpdatePeopleData(websiteID, people, data);
3039
+ ```
3040
+ </details>
3041
+
3042
+ * **Batch Update Conversations Segments**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-segments-items)
3043
+ * `CrispClient.website.batchUpdateConversationsSegments(websiteID, operation)`
3044
+ * <details>
3045
+ <summary>See Example</summary>
3046
+
3047
+ ```javascript
3048
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
3049
+
3050
+ var operation = {
3051
+ "sessions": [
3052
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
3053
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
3054
+ ],
3055
+
3056
+ "segments": [
3057
+ "vip",
3058
+ "lead"
3059
+ ]
3060
+ };
3061
+
3062
+ CrispClient.website.batchUpdateConversationsSegments(websiteID, operation);
3063
+ ```
3064
+ </details>
3065
+
3066
+ * **Batch Update People Segments**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-segments-items)
3067
+ * `CrispClient.website.batchUpdatePeopleSegments(websiteID, people, segments)`
3068
+ * <details>
3069
+ <summary>See Example</summary>
3070
+
3071
+ ```javascript
3072
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
3073
+
3074
+ var people = {
3075
+ "profiles": [
3076
+ "eee8759d-52db-48e5-982d-3426e3566ce0"
3077
+ ]
3078
+ };
3079
+
3080
+ var segments = [
3081
+ "vip",
3082
+ "lead"
3083
+ ];
3084
+
3085
+ CrispClient.website.batchUpdatePeopleSegments(websiteID, people, segments);
3086
+ ```
3087
+ </details>
3088
+
2981
3089
 
2982
3090
  * #### **Website Inbox**
2983
3091
  * **List Inboxes**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-website-inboxes)
package/dist/crisp.js CHANGED
@@ -46,7 +46,7 @@ const AVAILABLE_RTM_MODES = [
46
46
  "websockets",
47
47
  "webhooks"
48
48
  ];
49
- const VERSION = "10.10.0";
49
+ const VERSION = "10.10.2";
50
50
  // Base configuration
51
51
  const DEFAULT_REQUEST_TIMEOUT = 10000;
52
52
  const DEFAULT_SOCKET_TIMEOUT = 10000;
@@ -32,6 +32,15 @@ export type WebsiteBatchPeopleOperationInner = {
32
32
  profiles?: string[];
33
33
  search?: string;
34
34
  };
35
+ export type WebsiteBatchDataPayload = Record<string, string | number | boolean>;
36
+ export type WebsiteBatchConversationsDataOperation = {
37
+ sessions: string[];
38
+ data: WebsiteBatchDataPayload;
39
+ };
40
+ export type WebsiteBatchConversationsSegmentsOperation = {
41
+ sessions: string[];
42
+ segments: string[];
43
+ };
35
44
  /**************************************************************************
36
45
  * CLASSES
37
46
  ***************************************************************************/
@@ -97,6 +106,22 @@ declare class WebsiteBatch extends BaseResource {
97
106
  * Batch Inbox Conversations
98
107
  */
99
108
  batchInboxConversations(websiteID: string, operation: WebsiteBatchInboxOperation): Promise<any>;
109
+ /**
110
+ * Batch Update Conversations Data
111
+ */
112
+ batchUpdateConversationsData(websiteID: string, operation: WebsiteBatchConversationsDataOperation): Promise<any>;
113
+ /**
114
+ * Batch Update People Data
115
+ */
116
+ batchUpdatePeopleData(websiteID: string, people: WebsiteBatchPeopleOperationInner, data: WebsiteBatchDataPayload): Promise<any>;
117
+ /**
118
+ * Batch Update Conversations Segments
119
+ */
120
+ batchUpdateConversationsSegments(websiteID: string, operation: WebsiteBatchConversationsSegmentsOperation): Promise<any>;
121
+ /**
122
+ * Batch Update People Segments
123
+ */
124
+ batchUpdatePeopleSegments(websiteID: string, people: WebsiteBatchPeopleOperationInner, segments: string[]): Promise<any>;
100
125
  }
101
126
  /**************************************************************************
102
127
  * EXPORTS
@@ -111,6 +111,40 @@ class WebsiteBatch extends BaseResource_1.default {
111
111
  return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "inbox"]), null, operation);
112
112
  }
113
113
  ;
114
+ /**
115
+ * Batch Update Conversations Data
116
+ */
117
+ batchUpdateConversationsData(websiteID, operation) {
118
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "data"]), null, operation);
119
+ }
120
+ ;
121
+ /**
122
+ * Batch Update People Data
123
+ */
124
+ batchUpdatePeopleData(websiteID, people, data) {
125
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "data"]), null, {
126
+ people: people,
127
+ data: data
128
+ });
129
+ }
130
+ ;
131
+ /**
132
+ * Batch Update Conversations Segments
133
+ */
134
+ batchUpdateConversationsSegments(websiteID, operation) {
135
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "segments"]), null, operation);
136
+ }
137
+ ;
138
+ /**
139
+ * Batch Update People Segments
140
+ */
141
+ batchUpdatePeopleSegments(websiteID, people, segments) {
142
+ return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "segments"]), null, {
143
+ people: people,
144
+ segments: segments
145
+ });
146
+ }
147
+ ;
114
148
  }
115
149
  /**************************************************************************
116
150
  * EXPORTS
@@ -668,6 +668,10 @@ declare class WebsiteConversation extends BaseResource {
668
668
  * Transmit Signaling On Ongoing Call Session
669
669
  */
670
670
  transmitSignalingOnOngoingCallSession(websiteID: string, sessionID: string, callID: string, payload: object): Promise<any>;
671
+ /**
672
+ * Request Tool Call For Conversation
673
+ */
674
+ requestToolCallForConversation(websiteID: string, sessionID: string, command: string, payload?: object): Promise<any>;
671
675
  /**
672
676
  * Deliver Widget Button Action For Conversation
673
677
  */
@@ -569,6 +569,23 @@ class WebsiteConversation extends BaseResource_1.default {
569
569
  ]), null, payload);
570
570
  }
571
571
  ;
572
+ /**
573
+ * Request Tool Call For Conversation
574
+ */
575
+ requestToolCallForConversation(websiteID, sessionID, command, payload) {
576
+ // Generate body
577
+ let body = {
578
+ command: command
579
+ };
580
+ if (payload) {
581
+ // @ts-ignore
582
+ body.payload = payload;
583
+ }
584
+ return this.crisp.post(this.crisp.prepareRestUrl([
585
+ "website", websiteID, "conversation", sessionID, "tool"
586
+ ]), null, body);
587
+ }
588
+ ;
572
589
  /**
573
590
  * Deliver Widget Button Action For Conversation
574
591
  */
@@ -36,7 +36,6 @@ export interface WebsiteSettingsInbox {
36
36
  export interface WebsiteSettingsEmails {
37
37
  rating?: boolean;
38
38
  transcript?: boolean;
39
- enrich?: boolean;
40
39
  junk_filter?: boolean;
41
40
  }
42
41
  export interface WebsiteSettingsChatbox {
@@ -113,7 +112,6 @@ export interface WebsiteSettingsUpdateInbox {
113
112
  export interface WebsiteSettingsUpdateEmails {
114
113
  rating?: boolean;
115
114
  transcript?: boolean;
116
- enrich?: boolean;
117
115
  junk_filter?: boolean;
118
116
  }
119
117
  export interface WebsiteSettingsUpdateChatbox {
@@ -50,6 +50,18 @@ export type WebsiteBatchPeopleOperationInner = {
50
50
  search?: string;
51
51
  }
52
52
 
53
+ export type WebsiteBatchDataPayload = Record<string, string | number | boolean>;
54
+
55
+ export type WebsiteBatchConversationsDataOperation = {
56
+ sessions: string[];
57
+ data: WebsiteBatchDataPayload;
58
+ }
59
+
60
+ export type WebsiteBatchConversationsSegmentsOperation = {
61
+ sessions: string[];
62
+ segments: string[];
63
+ }
64
+
53
65
  /**************************************************************************
54
66
  * CLASSES
55
67
  ***************************************************************************/
@@ -209,6 +221,70 @@ class WebsiteBatch extends BaseResource {
209
221
  null, operation
210
222
  );
211
223
  };
224
+
225
+ /**
226
+ * Batch Update Conversations Data
227
+ */
228
+ batchUpdateConversationsData(
229
+ websiteID: string, operation: WebsiteBatchConversationsDataOperation
230
+ ) {
231
+ return this.crisp.patch(
232
+ this.crisp.prepareRestUrl(["website", websiteID, "batch", "data"]),
233
+
234
+ null, operation
235
+ );
236
+ };
237
+
238
+ /**
239
+ * Batch Update People Data
240
+ */
241
+ batchUpdatePeopleData(
242
+ websiteID: string, people: WebsiteBatchPeopleOperationInner,
243
+ data: WebsiteBatchDataPayload
244
+ ) {
245
+ return this.crisp.patch(
246
+ this.crisp.prepareRestUrl(["website", websiteID, "batch", "data"]),
247
+
248
+ null,
249
+
250
+ {
251
+ people: people,
252
+ data: data
253
+ }
254
+ );
255
+ };
256
+
257
+ /**
258
+ * Batch Update Conversations Segments
259
+ */
260
+ batchUpdateConversationsSegments(
261
+ websiteID: string, operation: WebsiteBatchConversationsSegmentsOperation
262
+ ) {
263
+ return this.crisp.patch(
264
+ this.crisp.prepareRestUrl(["website", websiteID, "batch", "segments"]),
265
+
266
+ null, operation
267
+ );
268
+ };
269
+
270
+ /**
271
+ * Batch Update People Segments
272
+ */
273
+ batchUpdatePeopleSegments(
274
+ websiteID: string, people: WebsiteBatchPeopleOperationInner,
275
+ segments: string[]
276
+ ) {
277
+ return this.crisp.patch(
278
+ this.crisp.prepareRestUrl(["website", websiteID, "batch", "segments"]),
279
+
280
+ null,
281
+
282
+ {
283
+ people: people,
284
+ segments: segments
285
+ }
286
+ );
287
+ };
212
288
  }
213
289
 
214
290
  /**************************************************************************
@@ -1429,6 +1429,31 @@ class WebsiteConversation extends BaseResource {
1429
1429
  );
1430
1430
  };
1431
1431
 
1432
+ /**
1433
+ * Request Tool Call For Conversation
1434
+ */
1435
+ requestToolCallForConversation(
1436
+ websiteID: string, sessionID: string, command: string, payload?: object
1437
+ ) {
1438
+ // Generate body
1439
+ let body = {
1440
+ command: command
1441
+ };
1442
+
1443
+ if (payload) {
1444
+ // @ts-ignore
1445
+ body.payload = payload;
1446
+ }
1447
+
1448
+ return this.crisp.post(
1449
+ this.crisp.prepareRestUrl([
1450
+ "website", websiteID, "conversation", sessionID, "tool"
1451
+ ]),
1452
+
1453
+ null, body
1454
+ );
1455
+ };
1456
+
1432
1457
  /**
1433
1458
  * Deliver Widget Button Action For Conversation
1434
1459
  */
@@ -51,7 +51,6 @@ export interface WebsiteSettingsInbox {
51
51
  export interface WebsiteSettingsEmails {
52
52
  rating?: boolean;
53
53
  transcript?: boolean;
54
- enrich?: boolean;
55
54
  junk_filter?: boolean;
56
55
  }
57
56
 
@@ -134,7 +133,6 @@ export interface WebsiteSettingsUpdateInbox {
134
133
  export interface WebsiteSettingsUpdateEmails {
135
134
  rating?: boolean;
136
135
  transcript?: boolean;
137
- enrich?: boolean;
138
136
  junk_filter?: boolean;
139
137
  }
140
138
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "crisp-api",
3
3
  "description": "Crisp API wrapper for Node - official, maintained by Crisp",
4
- "version": "10.10.0",
4
+ "version": "10.10.2",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {