crisp-api 8.5.0 → 9.1.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,26 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v9.1.0
5
+
6
+ ### New Features
7
+
8
+ * Added the new `CrispClient.website.listSpamConversation` method.
9
+ * Added the new `CrispClient.website.resolveSpamConversationContent` method.
10
+ * Added the new `CrispClient.website.submitSpamConversationDecision` method.
11
+
12
+ ## v9.0.0
13
+
14
+ ### Breaking Changes
15
+
16
+ * ⚠️ Removed the `CrispClient.website.acquireAnalyticsPoints` method (API route has been removed).
17
+ * ⚠️ Removed the `CrispClient.website.listAnalyticsFilters` method (API route has been removed).
18
+ * ⚠️ Removed the `CrispClient.website.listAnalyticsClassifiers` method (API route has been removed).
19
+
20
+ ### New Features
21
+
22
+ * Added the new `CrispClient.website.generateAnalytics` method.
23
+
4
24
  ## v8.5.0
5
25
 
6
26
  ### Breaking Changes
package/EXAMPLES.md CHANGED
@@ -45,6 +45,35 @@ CrispClient.website.deleteSuggestedConversationDataKey(websiteID, key);
45
45
 
46
46
  =========================
47
47
 
48
+ https://docs.crisp.chat/references/rest-api/v1/#list-spam-conversations
49
+
50
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
51
+ var pageNumber = 1;
52
+
53
+ CrispClient.website.listSpamConversations(websiteID, pageNumber);
54
+
55
+ =========================
56
+
57
+ https://docs.crisp.chat/references/rest-api/v1/#resolve-spam-conversation-content
58
+
59
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
60
+ var spamID = "b45e7d75-61ab-416c-858b-1919b5fcfd10";
61
+
62
+ CrispClient.website.resolveSpamConversationContent(websiteID, spamID);
63
+
64
+ =========================
65
+
66
+ https://docs.crisp.chat/references/rest-api/v1/#submit-spam-conversation-decision
67
+
68
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
69
+ var spamID = "b45e7d75-61ab-416c-858b-1919b5fcfd10";
70
+
71
+ var action = "reject";
72
+
73
+ CrispClient.website.submitSpamConversationDecision(websiteID, spamID, action);
74
+
75
+ =========================
76
+
48
77
  https://docs.crisp.chat/references/rest-api/v1/#create-a-new-conversation
49
78
 
50
79
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
@@ -1582,6 +1611,9 @@ var settings = {
1582
1611
  "name": "Crisp",
1583
1612
  "domain": "crisp.chat",
1584
1613
  "logo": "https://storage.crisp.chat/users/avatar/website/8c842203-7ed8-4e29-a608-7cf78a7d2fcc/b6c2948d-b061-405e-91a9-2fdf855d1cc0.png",
1614
+ "audit": {
1615
+ "log": true
1616
+ },
1585
1617
  "contact": {
1586
1618
  "email": "contact@crisp.chat",
1587
1619
  "phone": "+33757905447"
@@ -1809,29 +1841,11 @@ CrispClient.website.listWebsiteOperatorAvailabilities(websiteID);
1809
1841
 
1810
1842
  =========================
1811
1843
 
1812
- https://docs.crisp.chat/references/rest-api/v1/#acquire-analytics-points
1813
-
1814
- var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1815
-
1816
- CrispClient.website.acquireAnalyticsPoints(websiteID, pointType, pointMetric, dateFrom, dateTo, dateSplit, classifier, filterPrimary, filterSecondary, filterTertiary);
1817
-
1818
- =========================
1819
-
1820
- https://docs.crisp.chat/references/rest-api/v1/#list-analytics-filters
1844
+ https://docs.crisp.chat/references/rest-api/v1/#generate-analytics
1821
1845
 
1822
1846
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1823
- var pageNumber = 1;
1824
-
1825
- CrispClient.website.listAnalyticsFilters(websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo);
1826
-
1827
- =========================
1828
-
1829
- https://docs.crisp.chat/references/rest-api/v1/#list-analytics-classifiers
1830
-
1831
- var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
1832
- var pageNumber = 1;
1833
1847
 
1834
- CrispClient.website.listAnalyticsClassifiers(websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo);
1848
+ CrispClient.website.generateAnalytics(websiteID, query);
1835
1849
 
1836
1850
  =========================
1837
1851
 
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: 12/07/2024
9
+ * **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 27/08/2024
10
10
  * **😘 Maintainers**: [@baptistejamin](https://github.com/baptistejamin), [@eliottvincent](https://github.com/eliottvincent), [@valeriansaliou](https://github.com/valeriansaliou)
11
11
 
12
12
  ## Installation
@@ -234,6 +234,47 @@ All methods that you will most likely need when building a Crisp integration are
234
234
  ```
235
235
  </details>
236
236
 
237
+ * **List Spam Conversations** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-spam-conversations)
238
+ * `CrispClient.website.listSpamConversations(websiteID, pageNumber)`
239
+ * <details>
240
+ <summary>See Example</summary>
241
+
242
+ ```javascript
243
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
244
+ var pageNumber = 1;
245
+
246
+ CrispClient.website.listSpamConversations(websiteID, pageNumber);
247
+ ```
248
+ </details>
249
+
250
+ * **Resolve Spam Conversation Content** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#resolve-spam-conversation-content)
251
+ * `CrispClient.website.resolveSpamConversationContent(websiteID, spamID)`
252
+ * <details>
253
+ <summary>See Example</summary>
254
+
255
+ ```javascript
256
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
257
+ var spamID = "b45e7d75-61ab-416c-858b-1919b5fcfd10";
258
+
259
+ CrispClient.website.resolveSpamConversationContent(websiteID, spamID);
260
+ ```
261
+ </details>
262
+
263
+ * **Submit Spam Conversation Decision** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#submit-spam-conversation-decision)
264
+ * `CrispClient.website.submitSpamConversationDecision(websiteID, spamID, action)`
265
+ * <details>
266
+ <summary>See Example</summary>
267
+
268
+ ```javascript
269
+ var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
270
+ var spamID = "b45e7d75-61ab-416c-858b-1919b5fcfd10";
271
+
272
+ var action = "reject";
273
+
274
+ CrispClient.website.submitSpamConversationDecision(websiteID, spamID, action);
275
+ ```
276
+ </details>
277
+
237
278
 
238
279
  * #### **Website Conversation**
239
280
  * **⭐ Create A New Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#create-a-new-conversation)
@@ -2312,6 +2353,9 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2312
2353
  "name": "Crisp",
2313
2354
  "domain": "crisp.chat",
2314
2355
  "logo": "https://storage.crisp.chat/users/avatar/website/8c842203-7ed8-4e29-a608-7cf78a7d2fcc/b6c2948d-b061-405e-91a9-2fdf855d1cc0.png",
2356
+ "audit": {
2357
+ "log": true
2358
+ },
2315
2359
  "contact": {
2316
2360
  "email": "contact@crisp.chat",
2317
2361
  "phone": "+33757905447"
@@ -2605,41 +2649,15 @@ _👉 Notice: The `peopleID` argument can be an email or the `peopleID`._
2605
2649
 
2606
2650
 
2607
2651
  * #### **Website Analytics**
2608
- * **Acquire Analytics Points** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#acquire-analytics-points)
2609
- * `CrispClient.website.acquireAnalyticsPoints(websiteID, pointType, pointMetric, dateFrom, dateTo, dateSplit, classifier, filterPrimary, filterSecondary, filterTertiary)`
2652
+ * **Generate Analytics** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#generate-analytics)
2653
+ * `CrispClient.website.generateAnalytics(websiteID, query)`
2610
2654
  * <details>
2611
2655
  <summary>See Example</summary>
2612
2656
 
2613
2657
  ```javascript
2614
2658
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2615
2659
 
2616
- CrispClient.website.acquireAnalyticsPoints(websiteID, pointType, pointMetric, dateFrom, dateTo, dateSplit, classifier, filterPrimary, filterSecondary, filterTertiary);
2617
- ```
2618
- </details>
2619
-
2620
- * **List Analytics Filters** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-analytics-filters)
2621
- * `CrispClient.website.listAnalyticsFilters(websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo)`
2622
- * <details>
2623
- <summary>See Example</summary>
2624
-
2625
- ```javascript
2626
- var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2627
- var pageNumber = 1;
2628
-
2629
- CrispClient.website.listAnalyticsFilters(websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo);
2630
- ```
2631
- </details>
2632
-
2633
- * **List Analytics Classifiers** [`user`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#list-analytics-classifiers)
2634
- * `CrispClient.website.listAnalyticsClassifiers(websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo)`
2635
- * <details>
2636
- <summary>See Example</summary>
2637
-
2638
- ```javascript
2639
- var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
2640
- var pageNumber = 1;
2641
-
2642
- CrispClient.website.listAnalyticsClassifiers(websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo);
2660
+ CrispClient.website.generateAnalytics(websiteID, query);
2643
2661
  ```
2644
2662
  </details>
2645
2663
 
@@ -16,95 +16,19 @@
16
16
  */
17
17
  function WebsiteAnalytics(service, crisp) {
18
18
  /**
19
- * Acquire Analytics Points
19
+ * Generate Analytics
20
20
  * @memberof WebsiteAnalytics
21
21
  * @public
22
- * @method acquireAnalyticsPoints
22
+ * @method generateAnalytics
23
23
  * @param {string} websiteID
24
- * @param {string} pointType
25
- * @param {string} pointMetric
26
- * @param {string} dateFrom
27
- * @param {string} dateTo
28
- * @param {string} dateSplit
29
- * @param {string} classifier
30
- * @param {string} filterSecondary
31
- * @param {string} filterTertiary
24
+ * @param {object} query
32
25
  * @return {Promise}
33
26
  */
34
- service.acquireAnalyticsPoints = function(
35
- websiteID, pointType, pointMetric, dateFrom, dateTo, dateSplit, classifier,
36
- filterPrimary, filterSecondary, filterTertiary
37
- ) {
38
- return crisp.get(
39
- crisp._prepareRestUrl([
40
- "website", websiteID, "analytics", pointType, pointMetric, "points"
41
- ]),
27
+ service.generateAnalytics = function(websiteID, query) {
28
+ return crisp.post(
29
+ crisp._prepareRestUrl(["website", websiteID, "analytics", "generate"]),
42
30
 
43
- {
44
- date_from : dateFrom,
45
- date_to : dateTo,
46
- date_split : dateSplit,
47
- classifier : classifier,
48
- filter_primary : filterPrimary,
49
- filter_secondary : filterSecondary,
50
- filter_tertiary : filterTertiary
51
- }
52
- );
53
- };
54
-
55
- /**
56
- * List Analytics Filters
57
- * @memberof WebsiteAnalytics
58
- * @public
59
- * @method listAnalyticsFilters
60
- * @param {string} websiteID
61
- * @param {number} pageNumber
62
- * @param {string} pointType
63
- * @param {string} pointMetric
64
- * @param {string} dateFrom
65
- * @param {string} dateTo
66
- * @return {Promise}
67
- */
68
- service.listAnalyticsFilters = function(
69
- websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo
70
- ) {
71
- return crisp.get(
72
- crisp._prepareRestUrl([
73
- "website", websiteID, "analytics", pointType, pointMetric, "filters"
74
- ]),
75
-
76
- {
77
- date_from : dateFrom,
78
- date_to : dateTo
79
- }
80
- );
81
- };
82
-
83
- /**
84
- * List Analytics Classifiers
85
- * @memberof WebsiteAnalytics
86
- * @public
87
- * @method listAnalyticsClassifiers
88
- * @param {string} websiteID
89
- * @param {number} pageNumber
90
- * @param {string} pointType
91
- * @param {string} pointMetric
92
- * @param {string} dateFrom
93
- * @param {string} dateTo
94
- * @return {Promise}
95
- */
96
- service.listAnalyticsClassifiers = function(
97
- websiteID, pageNumber, pointType, pointMetric, dateFrom, dateTo
98
- ) {
99
- return crisp.get(
100
- crisp._prepareRestUrl([
101
- "website", websiteID, "analytics", pointType, pointMetric, "classifiers"
102
- ]),
103
-
104
- {
105
- date_from : dateFrom,
106
- date_to : dateTo
107
- }
31
+ null, query
108
32
  );
109
33
  };
110
34
  }
@@ -110,6 +110,64 @@ function WebsiteConversation(service, crisp) {
110
110
  );
111
111
  };
112
112
 
113
+ /**
114
+ * List Spam Conversations
115
+ * @memberof WebsiteConversation
116
+ * @public
117
+ * @method listSpamConversations
118
+ * @param {string} websiteID
119
+ * @param {number} pageNumber
120
+ * @return {Promise}
121
+ */
122
+ service.listSpamConversations = function(websiteID, pageNumber) {
123
+ return crisp.get(
124
+ crisp._prepareRestUrl([
125
+ "website", websiteID, "conversations", "spams", pageNumber
126
+ ])
127
+ );
128
+ };
129
+
130
+ /**
131
+ * Resolve Spam Conversation Content
132
+ * @memberof WebsiteConversation
133
+ * @public
134
+ * @method resolveSpamConversationContent
135
+ * @param {string} websiteID
136
+ * @param {string} spamID
137
+ * @return {Promise}
138
+ */
139
+ service.resolveSpamConversationContent = function(websiteID, spamID) {
140
+ return crisp.get(
141
+ crisp._prepareRestUrl([
142
+ "website", websiteID, "conversations", "spam", spamID, "content"
143
+ ])
144
+ );
145
+ };
146
+
147
+ /**
148
+ * Submit Spam Conversation Decision
149
+ * @memberof WebsiteConversation
150
+ * @public
151
+ * @method submitSpamConversationDecision
152
+ * @param {string} websiteID
153
+ * @param {string} spamID
154
+ * @param {string} action
155
+ * @return {Promise}
156
+ */
157
+ service.submitSpamConversationDecision = function(websiteID, spamID, action) {
158
+ return crisp.post(
159
+ crisp._prepareRestUrl([
160
+ "website", websiteID, "conversations", "spam", spamID, "decision"
161
+ ]),
162
+
163
+ null,
164
+
165
+ {
166
+ action : action
167
+ }
168
+ );
169
+ };
170
+
113
171
  /**
114
172
  * Create A New Conversation
115
173
  * @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.5.0",
4
+ "version": "9.1.0",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {