Skip to content

Commit b7d97a8

Browse files
Add new website.listSpamConversations() methods (et al)
1 parent 4f86ad2 commit b7d97a8

File tree

3 files changed

+128
-0
lines changed

3 files changed

+128
-0
lines changed

EXAMPLES.md

+29
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,35 @@ CrispClient.website.deleteSuggestedConversationDataKey(websiteID, key);
4545

4646
=========================
4747

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+
4877
https://docs.crisp.chat/references/rest-api/v1/#create-a-new-conversation
4978

5079
var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";

README.md

+41
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,47 @@ All methods that you will most likely need when building a Crisp integration are
234234
```
235235
</details>
236236

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+
237278

238279
* #### **Website Conversation**
239280
* **⭐ Create A New Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#create-a-new-conversation)

lib/resources/WebsiteConversation.js

+58
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,64 @@ function WebsiteConversation(service, crisp) {
110110
);
111111
};
112112

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+
113171
/**
114172
* Create A New Conversation
115173
* @memberof WebsiteConversation

0 commit comments

Comments
 (0)