crisp-api 9.0.0 → 9.2.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,21 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v9.2.0
5
+
6
+ ### New Features
7
+
8
+ * Added support for the `spam:message` RTM API event.
9
+ * Added support for the `spam:decision` RTM API event.
10
+
11
+ ## v9.1.0
12
+
13
+ ### New Features
14
+
15
+ * Added the new `CrispClient.website.listSpamConversation` method.
16
+ * Added the new `CrispClient.website.resolveSpamConversationContent` method.
17
+ * Added the new `CrispClient.website.submitSpamConversationDecision` method.
18
+
4
19
  ## v9.0.0
5
20
 
6
21
  ### 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"
package/README.md CHANGED
@@ -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"
@@ -3479,6 +3523,12 @@ Available events are listed below:
3479
3523
  * **Message Notify Unread Received** [`user`, `plugin`]:
3480
3524
  * `message:notify:unread:received`
3481
3525
 
3526
+ * #### **Spam Events**: [Reference](https://docs.crisp.chat/references/rtm-api/v1/#spam-events)
3527
+ * **Spam Message** [`user`]:
3528
+ * `spam:message`
3529
+ * **Spam Decision** [`user`]:
3530
+ * `spam:decision`
3531
+
3482
3532
  * #### **People Events**: [Reference](https://docs.crisp.chat/references/rtm-api/v1/#people-events)
3483
3533
  * **People Profile Created** [`user`, `plugin`]:
3484
3534
  * `people:profile:created`
package/lib/crisp.js CHANGED
@@ -95,6 +95,10 @@ Crisp.DEFAULT_RTM_EVENTS = [
95
95
  "message:notify:unread:send",
96
96
  "message:notify:unread:received",
97
97
 
98
+ // Spam Events
99
+ "spam:message",
100
+ "spam:decision",
101
+
98
102
  // People Events
99
103
  "people:profile:created",
100
104
  "people:profile:updated",
@@ -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": "9.0.0",
4
+ "version": "9.2.0",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {