crisp-api 8.3.2 → 8.5.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/CHANGELOG.md CHANGED
@@ -1,6 +1,24 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v8.5.0
5
+
6
+ ### Breaking Changes
7
+
8
+ * ⚠️ Changed the argument of the `CrispClient.website.batchResolveConversations` method.
9
+ * ⚠️ Changed the argument of the `CrispClient.website.batchReadConversations` method.
10
+ * ⚠️ Changed the argument of the `CrispClient.website.batchRemoveConversations` method.
11
+
12
+ ### New Features
13
+
14
+ * Added the new `CrispClient.website.updateConversationInbox` method.
15
+
16
+ ## v8.4.0
17
+
18
+ ### New Features
19
+
20
+ * Added the new `CrispClient.website.abortWebsiteDeletion` method.
21
+
4
22
  ## v8.3.2
5
23
 
6
24
  ### New Features
package/EXAMPLES.md CHANGED
@@ -230,6 +230,16 @@ CrispClient.website.assignConversationRouting(websiteID, sessionID, assign);
230
230
 
231
231
  =========================
232
232
 
233
+ https://docs.crisp.chat/references/rest-api/v1/#update-conversation-inbox
234
+
235
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
236
+ var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
237
+ var inboxID = "bf6935c9-43b3-4f8e-87ea-175c1e1ed1a9";
238
+
239
+ CrispClient.website.updateConversationInbox(websiteID, sessionID, inboxID);
240
+
241
+ =========================
242
+
233
243
  https://docs.crisp.chat/references/rest-api/v1/#get-conversation-metas
234
244
 
235
245
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
@@ -1548,6 +1558,14 @@ CrispClient.website.deleteWebsite(websiteID, verify);
1548
1558
 
1549
1559
  =========================
1550
1560
 
1561
+ https://docs.crisp.chat/references/rest-api/v1/#abort-website-deletion
1562
+
1563
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1564
+
1565
+ CrispClient.website.abortWebsiteDeletion(websiteID);
1566
+
1567
+ =========================
1568
+
1551
1569
  https://docs.crisp.chat/references/rest-api/v1/#get-website-settings
1552
1570
 
1553
1571
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
@@ -1597,6 +1615,8 @@ var settings = {
1597
1615
  "ignore_privacy": false,
1598
1616
  "visitor_compose": false,
1599
1617
  "file_transfer": true,
1618
+ "overlay_search": true,
1619
+ "overlay_mode": false,
1600
1620
  "helpdesk_link": true,
1601
1621
  "helpdesk_only": false,
1602
1622
  "status_health_dead": true,
@@ -1819,7 +1839,16 @@ https://docs.crisp.chat/references/rest-api/v1/#batch-resolve-items
1819
1839
 
1820
1840
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1821
1841
 
1822
- CrispClient.website.batchResolveConversations(websiteID, sessions);
1842
+ var operation = {
1843
+ "inbox_id": null,
1844
+
1845
+ "sessions": [
1846
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
1847
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
1848
+ ]
1849
+ };
1850
+
1851
+ CrispClient.website.batchResolveConversations(websiteID, operation);
1823
1852
 
1824
1853
  =========================
1825
1854
 
@@ -1827,7 +1856,16 @@ https://docs.crisp.chat/references/rest-api/v1/#batch-read-items
1827
1856
 
1828
1857
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1829
1858
 
1830
- CrispClient.website.batchReadConversations(websiteID, sessions);
1859
+ var operation = {
1860
+ "inbox_id": null,
1861
+
1862
+ "sessions": [
1863
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
1864
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
1865
+ ]
1866
+ };
1867
+
1868
+ CrispClient.website.batchReadConversations(websiteID, operation);
1831
1869
 
1832
1870
  =========================
1833
1871
 
@@ -1835,12 +1873,16 @@ https://docs.crisp.chat/references/rest-api/v1/#batch-remove-items
1835
1873
 
1836
1874
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1837
1875
 
1838
- var sessions = [
1839
- "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
1840
- "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
1841
- ];
1876
+ var operation = {
1877
+ "inbox_id": null,
1878
+
1879
+ "sessions": [
1880
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
1881
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
1882
+ ]
1883
+ };
1842
1884
 
1843
- CrispClient.website.batchRemoveConversations(websiteID, sessions);
1885
+ CrispClient.website.batchRemoveConversations(websiteID, operation);
1844
1886
 
1845
1887
  =========================
1846
1888
 
package/README.md CHANGED
@@ -6,7 +6,7 @@ The Crisp API Node wrapper. Authenticate, send messages, fetch conversations, ac
6
6
 
7
7
  Copyright 2023 Crisp IM SAS. See LICENSE for copying information.
8
8
 
9
- * **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 10/04/2024
9
+ * **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 12/07/2024
10
10
  * **😘 Maintainers**: [@baptistejamin](https://github.com/baptistejamin), [@eliottvincent](https://github.com/eliottvincent), [@valeriansaliou](https://github.com/valeriansaliou)
11
11
 
12
12
  ## Installation
@@ -485,6 +485,20 @@ All methods that you will most likely need when building a Crisp integration are
485
485
  ```
486
486
  </details>
487
487
 
488
+ * **Update Conversation Inbox** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#update-conversation-inbox)
489
+ * `CrispClient.website.updateConversationInbox(websiteID, sessionID, inboxID)`
490
+ * <details>
491
+ <summary>See Example</summary>
492
+
493
+ ```javascript
494
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
495
+ var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
496
+ var inboxID = "bf6935c9-43b3-4f8e-87ea-175c1e1ed1a9";
497
+
498
+ CrispClient.website.updateConversationInbox(websiteID, sessionID, inboxID);
499
+ ```
500
+ </details>
501
+
488
502
  * **⭐ Get Conversation Metas** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-conversation-metas)
489
503
  * `CrispClient.website.getConversationMetas(websiteID, sessionID)`
490
504
  * <details>
@@ -2260,6 +2274,18 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2260
2274
  ```
2261
2275
  </details>
2262
2276
 
2277
+ * **Abort Website Deletion** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#abort-website-deletion)
2278
+ * `CrispClient.website.abortWebsiteDeletion(websiteID)`
2279
+ * <details>
2280
+ <summary>See Example</summary>
2281
+
2282
+ ```javascript
2283
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2284
+
2285
+ CrispClient.website.abortWebsiteDeletion(websiteID);
2286
+ ```
2287
+ </details>
2288
+
2263
2289
 
2264
2290
  * #### **Website Settings**
2265
2291
  * **Get Website Settings** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-website-settings)
@@ -2319,6 +2345,8 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2319
2345
  "ignore_privacy": false,
2320
2346
  "visitor_compose": false,
2321
2347
  "file_transfer": true,
2348
+ "overlay_search": true,
2349
+ "overlay_mode": false,
2322
2350
  "helpdesk_link": true,
2323
2351
  "helpdesk_only": false,
2324
2352
  "status_health_dead": true,
@@ -2618,43 +2646,65 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2618
2646
 
2619
2647
  * #### **Website Batch**
2620
2648
  * **Batch Resolve Conversations** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-resolve-items)
2621
- * `CrispClient.website.batchResolveConversations(websiteID, sessions)`
2649
+ * `CrispClient.website.batchResolveConversations(websiteID, operation)`
2622
2650
  * <details>
2623
2651
  <summary>See Example</summary>
2624
2652
 
2625
2653
  ```javascript
2626
2654
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2627
2655
 
2628
- CrispClient.website.batchResolveConversations(websiteID, sessions);
2656
+ var operation = {
2657
+ "inbox_id": null,
2658
+
2659
+ "sessions": [
2660
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
2661
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
2662
+ ]
2663
+ };
2664
+
2665
+ CrispClient.website.batchResolveConversations(websiteID, operation);
2629
2666
  ```
2630
2667
  </details>
2631
2668
 
2632
2669
  * **Batch Read Conversations** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-read-items)
2633
- * `CrispClient.website.batchReadConversations(websiteID, sessions)`
2670
+ * `CrispClient.website.batchReadConversations(websiteID, operation)`
2634
2671
  * <details>
2635
2672
  <summary>See Example</summary>
2636
2673
 
2637
2674
  ```javascript
2638
2675
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2639
2676
 
2640
- CrispClient.website.batchReadConversations(websiteID, sessions);
2677
+ var operation = {
2678
+ "inbox_id": null,
2679
+
2680
+ "sessions": [
2681
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
2682
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
2683
+ ]
2684
+ };
2685
+
2686
+ CrispClient.website.batchReadConversations(websiteID, operation);
2641
2687
  ```
2642
2688
  </details>
2643
2689
 
2644
2690
  * **Batch Remove Conversations** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#batch-remove-items)
2645
- * `CrispClient.website.batchRemoveConversations(websiteID, sessions)`
2691
+ * `CrispClient.website.batchRemoveConversations(websiteID, operation)`
2646
2692
  * <details>
2647
2693
  <summary>See Example</summary>
2648
2694
 
2649
2695
  ```javascript
2650
2696
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2651
2697
 
2652
- var sessions = [
2653
- "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
2654
- "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
2655
- ];
2698
+ var operation = {
2699
+ "inbox_id": null,
2656
2700
 
2657
- CrispClient.website.batchRemoveConversations(websiteID, sessions);
2701
+ "sessions": [
2702
+ "session_19e5240f-0a8d-461e-a661-a3123fc6eec9",
2703
+ "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881"
2704
+ ]
2705
+ };
2706
+
2707
+ CrispClient.website.batchRemoveConversations(websiteID, operation);
2658
2708
  ```
2659
2709
  </details>
2660
2710
 
@@ -3426,6 +3476,8 @@ Available events are listed below:
3426
3476
  * `session:set_mentions`
3427
3477
  * **Session Set Routing** [`user`, `plugin`]:
3428
3478
  * `session:set_routing`
3479
+ * **Session Set Inbox** [`user`, `plugin`]:
3480
+ * `session:set_inbox`
3429
3481
  * **Session Removed** [`user`, `plugin`]:
3430
3482
  * `session:removed`
3431
3483
 
package/lib/crisp.js CHANGED
@@ -79,6 +79,7 @@ Crisp.DEFAULT_RTM_EVENTS = [
79
79
  "session:set_participants",
80
80
  "session:set_mentions",
81
81
  "session:set_routing",
82
+ "session:set_inbox",
82
83
  "session:removed",
83
84
 
84
85
  // Message Events
@@ -79,6 +79,20 @@ function WebsiteBase(service, crisp) {
79
79
  }
80
80
  );
81
81
  };
82
+
83
+ /**
84
+ * Abort Website Deletion
85
+ * @memberof WebsiteBase
86
+ * @public
87
+ * @method abortWebsiteDeletion
88
+ * @param {string} websiteID
89
+ * @return {Promise}
90
+ */
91
+ service.abortWebsiteDeletion = function(websiteID) {
92
+ return crisp.delete(
93
+ crisp._prepareRestUrl(["website", websiteID, "expunge"])
94
+ );
95
+ };
82
96
  }
83
97
 
84
98
 
@@ -21,18 +21,14 @@ function WebsiteBatch(service, crisp) {
21
21
  * @public
22
22
  * @method batchResolveConversations
23
23
  * @param {string} websiteID
24
- * @param {object} sessions
24
+ * @param {object} operation
25
25
  * @return {Promise}
26
26
  */
27
- service.batchResolveConversations = function(websiteID, sessions) {
27
+ service.batchResolveConversations = function(websiteID, operation) {
28
28
  return crisp.patch(
29
29
  crisp._prepareRestUrl(["website", websiteID, "batch", "resolve"]),
30
30
 
31
- null,
32
-
33
- {
34
- sessions : sessions
35
- }
31
+ null, operation
36
32
  );
37
33
  };
38
34
 
@@ -42,18 +38,14 @@ function WebsiteBatch(service, crisp) {
42
38
  * @public
43
39
  * @method batchReadConversations
44
40
  * @param {string} websiteID
45
- * @param {object} sessions
41
+ * @param {object} operation
46
42
  * @return {Promise}
47
43
  */
48
- service.batchReadConversations = function(websiteID, sessions) {
44
+ service.batchReadConversations = function(websiteID, operation) {
49
45
  return crisp.patch(
50
46
  crisp._prepareRestUrl(["website", websiteID, "batch", "read"]),
51
47
 
52
- null,
53
-
54
- {
55
- sessions : sessions
56
- }
48
+ null, operation
57
49
  );
58
50
  };
59
51
 
@@ -63,18 +55,14 @@ function WebsiteBatch(service, crisp) {
63
55
  * @public
64
56
  * @method batchRemoveConversations
65
57
  * @param {string} websiteID
66
- * @param {object} sessions
58
+ * @param {object} operation
67
59
  * @return {Promise}
68
60
  */
69
- service.batchRemoveConversations = function(websiteID, sessions) {
61
+ service.batchRemoveConversations = function(websiteID, operation) {
70
62
  return crisp.patch(
71
63
  crisp._prepareRestUrl(["website", websiteID, "batch", "remove"]),
72
64
 
73
- null,
74
-
75
- {
76
- sessions : sessions
77
- }
65
+ null, operation
78
66
  );
79
67
  };
80
68
 
@@ -431,6 +431,30 @@ function WebsiteConversation(service, crisp) {
431
431
  );
432
432
  };
433
433
 
434
+ /**
435
+ * Update Conversation Inbox
436
+ * @memberof WebsiteConversation
437
+ * @public
438
+ * @method updateConversationInbox
439
+ * @param {string} websiteID
440
+ * @param {string} sessionID
441
+ * @param {string} inboxID
442
+ * @return {Promise}
443
+ */
444
+ service.updateConversationInbox = function(websiteID, sessionID, inboxID) {
445
+ return crisp.patch(
446
+ crisp._prepareRestUrl([
447
+ "website", websiteID, "conversation", sessionID, "inbox"
448
+ ]),
449
+
450
+ null,
451
+
452
+ {
453
+ inbox_id : inboxID
454
+ }
455
+ );
456
+ };
457
+
434
458
  /**
435
459
  * Get Conversation Metas
436
460
  * @memberof WebsiteConversation
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": "8.3.2",
4
+ "version": "8.5.0",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {