crisp-api 9.13.0 → 10.0.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 +8 -0
- package/README.md +2 -2
- package/dist/crisp.d.ts +167 -0
- package/dist/crisp.js +764 -0
- package/dist/resources/BaseResource.d.ts +15 -0
- package/dist/resources/BaseResource.js +20 -0
- package/dist/resources/BucketURL.d.ts +28 -0
- package/dist/resources/BucketURL.js +29 -0
- package/dist/resources/MediaAnimation.d.ts +14 -0
- package/dist/resources/MediaAnimation.js +32 -0
- package/dist/resources/PluginConnect.d.ts +50 -0
- package/dist/resources/PluginConnect.js +73 -0
- package/dist/resources/PluginSubscription.d.ts +103 -0
- package/dist/resources/PluginSubscription.js +122 -0
- package/dist/resources/WebsiteAnalytics.d.ts +14 -0
- package/dist/resources/WebsiteAnalytics.js +29 -0
- package/dist/resources/WebsiteAvailability.d.ts +31 -0
- package/dist/resources/WebsiteAvailability.js +36 -0
- package/dist/resources/WebsiteBase.d.ts +60 -0
- package/dist/resources/WebsiteBase.js +71 -0
- package/dist/resources/WebsiteBatch.d.ts +52 -0
- package/dist/resources/WebsiteBatch.js +70 -0
- package/dist/resources/WebsiteCampaign.d.ts +199 -0
- package/dist/resources/WebsiteCampaign.js +194 -0
- package/dist/resources/WebsiteConversation.d.ts +701 -0
- package/dist/resources/WebsiteConversation.js +595 -0
- package/dist/resources/WebsiteHelpdesk.d.ts +347 -0
- package/dist/resources/WebsiteHelpdesk.js +587 -0
- package/dist/resources/WebsiteOperator.d.ts +79 -0
- package/dist/resources/WebsiteOperator.js +93 -0
- package/dist/resources/WebsitePeople.d.ts +248 -0
- package/dist/resources/WebsitePeople.js +276 -0
- package/dist/resources/WebsiteSettings.d.ts +159 -0
- package/dist/resources/WebsiteSettings.js +36 -0
- package/dist/resources/WebsiteVerify.d.ts +38 -0
- package/dist/resources/WebsiteVerify.js +50 -0
- package/dist/resources/WebsiteVisitors.d.ts +113 -0
- package/dist/resources/WebsiteVisitors.js +88 -0
- package/dist/resources/index.d.ts +17 -0
- package/dist/resources/index.js +40 -0
- package/dist/services/bucket.d.ts +13 -0
- package/dist/services/bucket.js +28 -0
- package/dist/services/media.d.ts +13 -0
- package/dist/services/media.js +28 -0
- package/dist/services/plugin.d.ts +14 -0
- package/dist/services/plugin.js +30 -0
- package/dist/services/website.d.ts +24 -0
- package/dist/services/website.js +50 -0
- package/eslint.config.mjs +208 -0
- package/lib/crisp.ts +957 -0
- package/lib/resources/BaseResource.ts +29 -0
- package/lib/resources/BucketURL.ts +49 -0
- package/lib/resources/MediaAnimation.ts +34 -0
- package/lib/resources/PluginConnect.ts +128 -0
- package/lib/resources/PluginSubscription.ts +208 -0
- package/lib/resources/WebsiteAnalytics.ts +31 -0
- package/lib/resources/WebsiteAvailability.ts +54 -0
- package/lib/resources/WebsiteBase.ts +108 -0
- package/lib/resources/WebsiteBatch.ts +96 -0
- package/lib/resources/WebsiteCampaign.ts +399 -0
- package/lib/resources/WebsiteConversation.ts +1416 -0
- package/lib/resources/WebsiteHelpdesk.ts +982 -0
- package/lib/resources/WebsiteOperator.ts +161 -0
- package/lib/resources/WebsitePeople.ts +527 -0
- package/lib/resources/WebsiteSettings.ts +192 -0
- package/lib/resources/WebsiteVerify.ts +76 -0
- package/lib/resources/WebsiteVisitors.ts +196 -0
- package/lib/resources/index.ts +25 -0
- package/lib/services/bucket.ts +28 -0
- package/lib/services/media.ts +28 -0
- package/lib/services/plugin.ts +32 -0
- package/lib/services/website.ts +62 -0
- package/package.json +16 -11
- package/tsconfig.json +12 -5
- package/lib/crisp.js +0 -1171
- package/lib/resources/BucketURL.js +0 -34
- package/lib/resources/MediaAnimation.js +0 -41
- package/lib/resources/PluginConnect.js +0 -119
- package/lib/resources/PluginSubscription.js +0 -234
- package/lib/resources/WebsiteAnalytics.js +0 -37
- package/lib/resources/WebsiteAvailability.js +0 -48
- package/lib/resources/WebsiteBase.js +0 -100
- package/lib/resources/WebsiteBatch.js +0 -92
- package/lib/resources/WebsiteCampaign.js +0 -396
- package/lib/resources/WebsiteConversation.js +0 -1261
- package/lib/resources/WebsiteHelpdesk.js +0 -1198
- package/lib/resources/WebsiteOperator.js +0 -167
- package/lib/resources/WebsitePeople.js +0 -516
- package/lib/resources/WebsiteSettings.js +0 -50
- package/lib/resources/WebsiteVerify.js +0 -79
- package/lib/resources/WebsiteVisitors.js +0 -148
- package/lib/services/Bucket.js +0 -28
- package/lib/services/Media.js +0 -28
- package/lib/services/Plugin.js +0 -29
- package/lib/services/Website.js +0 -39
- package/types/crisp.d.ts +0 -151
- package/types/resources/BucketURL.d.ts +0 -15
- package/types/resources/MediaAnimation.d.ts +0 -15
- package/types/resources/PluginConnect.d.ts +0 -15
- package/types/resources/PluginSubscription.d.ts +0 -15
- package/types/resources/WebsiteAnalytics.d.ts +0 -15
- package/types/resources/WebsiteAvailability.d.ts +0 -15
- package/types/resources/WebsiteBase.d.ts +0 -15
- package/types/resources/WebsiteBatch.d.ts +0 -15
- package/types/resources/WebsiteCampaign.d.ts +0 -15
- package/types/resources/WebsiteConversation.d.ts +0 -15
- package/types/resources/WebsiteHelpdesk.d.ts +0 -15
- package/types/resources/WebsiteOperator.d.ts +0 -15
- package/types/resources/WebsitePeople.d.ts +0 -15
- package/types/resources/WebsiteSettings.d.ts +0 -15
- package/types/resources/WebsiteVerify.d.ts +0 -15
- package/types/resources/WebsiteVisitors.d.ts +0 -15
- package/types/services/Bucket.d.ts +0 -14
- package/types/services/Media.d.ts +0 -14
- package/types/services/Plugin.d.ts +0 -14
- package/types/services/Website.d.ts +0 -14
|
@@ -0,0 +1,595 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* node-crisp-api
|
|
4
|
+
*
|
|
5
|
+
* Copyright 2022, Crisp IM SAS
|
|
6
|
+
* Author: Baptiste Jamin <baptiste@crisp.chat>
|
|
7
|
+
*/
|
|
8
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
9
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
/**************************************************************************
|
|
13
|
+
* IMPORTS
|
|
14
|
+
***************************************************************************/
|
|
15
|
+
// PROJECT: RESOURCES
|
|
16
|
+
const BaseResource_1 = __importDefault(require("./BaseResource"));
|
|
17
|
+
/**
|
|
18
|
+
* Crisp WebsiteConversation Resource
|
|
19
|
+
* @class
|
|
20
|
+
*/
|
|
21
|
+
class WebsiteConversation extends BaseResource_1.default {
|
|
22
|
+
/**
|
|
23
|
+
* List Conversations
|
|
24
|
+
*/
|
|
25
|
+
listConversations(websiteID, pageNumber = 1) {
|
|
26
|
+
return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID, "conversations", String(pageNumber)]));
|
|
27
|
+
}
|
|
28
|
+
;
|
|
29
|
+
/**
|
|
30
|
+
* List Suggested Conversation Segments
|
|
31
|
+
*/
|
|
32
|
+
listSuggestedConversationSegments(websiteID, pageNumber = 1) {
|
|
33
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
34
|
+
"website", websiteID, "conversations", "suggest", "segments", String(pageNumber)
|
|
35
|
+
]));
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
/**
|
|
39
|
+
* Delete Suggested Conversation Segment
|
|
40
|
+
*/
|
|
41
|
+
deleteSuggestedConversationSegment(websiteID, segment) {
|
|
42
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
43
|
+
"website", websiteID, "conversations", "suggest", "segment"
|
|
44
|
+
]), null, {
|
|
45
|
+
segment: segment
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
;
|
|
49
|
+
/**
|
|
50
|
+
* List Suggested Conversation Data Keys
|
|
51
|
+
*/
|
|
52
|
+
listSuggestedConversationDataKeys(websiteID, pageNumber = 1) {
|
|
53
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
54
|
+
"website", websiteID, "conversations", "suggest", "data", String(pageNumber)
|
|
55
|
+
]));
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
/**
|
|
59
|
+
* Delete Suggested Conversation Data Key
|
|
60
|
+
*/
|
|
61
|
+
deleteSuggestedConversationDataKey(websiteID, key) {
|
|
62
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
63
|
+
"website", websiteID, "conversations", "suggest", "data"
|
|
64
|
+
]), null, {
|
|
65
|
+
key: key
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
;
|
|
69
|
+
/**
|
|
70
|
+
* List Spam Conversations
|
|
71
|
+
*/
|
|
72
|
+
listSpamConversations(websiteID, pageNumber = 1) {
|
|
73
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
74
|
+
"website", websiteID, "conversations", "spams", String(pageNumber)
|
|
75
|
+
]));
|
|
76
|
+
}
|
|
77
|
+
;
|
|
78
|
+
/**
|
|
79
|
+
* Resolve Spam Conversation Content
|
|
80
|
+
*/
|
|
81
|
+
resolveSpamConversationContent(websiteID, spamID) {
|
|
82
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
83
|
+
"website", websiteID, "conversations", "spam", spamID, "content"
|
|
84
|
+
]));
|
|
85
|
+
}
|
|
86
|
+
;
|
|
87
|
+
/**
|
|
88
|
+
* Submit Spam Conversation Decision
|
|
89
|
+
*/
|
|
90
|
+
submitSpamConversationDecision(websiteID, spamID, action) {
|
|
91
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
92
|
+
"website", websiteID, "conversations", "spam", spamID, "decision"
|
|
93
|
+
]), null, {
|
|
94
|
+
action: action
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
;
|
|
98
|
+
/**
|
|
99
|
+
* Create A New Conversation
|
|
100
|
+
*/
|
|
101
|
+
createNewConversation(websiteID) {
|
|
102
|
+
return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "conversation"]), null, null);
|
|
103
|
+
}
|
|
104
|
+
;
|
|
105
|
+
/**
|
|
106
|
+
* Check If Conversation Exists
|
|
107
|
+
*/
|
|
108
|
+
checkConversationExists(websiteID, sessionID) {
|
|
109
|
+
return this.crisp.head(this.crisp.prepareRestUrl(["website", websiteID, "conversation", sessionID]));
|
|
110
|
+
}
|
|
111
|
+
;
|
|
112
|
+
/**
|
|
113
|
+
* Get A Conversation
|
|
114
|
+
*/
|
|
115
|
+
getConversation(websiteID, sessionID) {
|
|
116
|
+
return this.crisp.get(this.crisp.prepareRestUrl(["website", websiteID, "conversation", sessionID]));
|
|
117
|
+
}
|
|
118
|
+
;
|
|
119
|
+
/**
|
|
120
|
+
* Remove A Conversation
|
|
121
|
+
*/
|
|
122
|
+
removeConversation(websiteID, sessionID) {
|
|
123
|
+
return this.crisp.delete(this.crisp.prepareRestUrl(["website", websiteID, "conversation", sessionID]));
|
|
124
|
+
}
|
|
125
|
+
;
|
|
126
|
+
/**
|
|
127
|
+
* Initiate A Conversation With Existing Session
|
|
128
|
+
*/
|
|
129
|
+
initiateConversationWithExistingSession(websiteID, sessionID) {
|
|
130
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
131
|
+
"website", websiteID, "conversation", sessionID, "initiate"
|
|
132
|
+
]), null, null);
|
|
133
|
+
}
|
|
134
|
+
;
|
|
135
|
+
/**
|
|
136
|
+
* Get Messages In Conversation
|
|
137
|
+
*/
|
|
138
|
+
getMessagesInConversation(websiteID, sessionID, timestampBefore) {
|
|
139
|
+
// Generate query
|
|
140
|
+
let query = {};
|
|
141
|
+
if (timestampBefore) {
|
|
142
|
+
// @ts-ignore
|
|
143
|
+
query.timestamp_before = String(timestampBefore);
|
|
144
|
+
}
|
|
145
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
146
|
+
"website", websiteID, "conversation", sessionID, "messages"
|
|
147
|
+
]), query);
|
|
148
|
+
}
|
|
149
|
+
;
|
|
150
|
+
/**
|
|
151
|
+
* Send A Message In Conversation
|
|
152
|
+
*/
|
|
153
|
+
sendMessageInConversation(websiteID, sessionID, message) {
|
|
154
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
155
|
+
"website", websiteID, "conversation", sessionID, "message"
|
|
156
|
+
]), null, message);
|
|
157
|
+
}
|
|
158
|
+
;
|
|
159
|
+
/**
|
|
160
|
+
* Get A Message In Conversation
|
|
161
|
+
*/
|
|
162
|
+
getMessageInConversation(websiteID, sessionID, fingerprint) {
|
|
163
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
164
|
+
"website", websiteID, "conversation", sessionID, "message", String(fingerprint)
|
|
165
|
+
]));
|
|
166
|
+
}
|
|
167
|
+
;
|
|
168
|
+
/**
|
|
169
|
+
* Update A Message In Conversation
|
|
170
|
+
*/
|
|
171
|
+
updateMessageInConversation(websiteID, sessionID, fingerprint, content) {
|
|
172
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
173
|
+
"website", websiteID, "conversation", sessionID, "message", String(fingerprint)
|
|
174
|
+
]), null, {
|
|
175
|
+
content: content
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
;
|
|
179
|
+
/**
|
|
180
|
+
* Remove A Message In Conversation
|
|
181
|
+
*/
|
|
182
|
+
removeMessageInConversation(websiteID, sessionID, fingerprint) {
|
|
183
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
184
|
+
"website", websiteID, "conversation", sessionID, "message", String(fingerprint)
|
|
185
|
+
]));
|
|
186
|
+
}
|
|
187
|
+
;
|
|
188
|
+
/**
|
|
189
|
+
* Compose A Message In Conversation
|
|
190
|
+
*/
|
|
191
|
+
composeMessageInConversation(websiteID, sessionID, compose) {
|
|
192
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
193
|
+
"website", websiteID, "conversation", sessionID, "compose"
|
|
194
|
+
]), null, compose);
|
|
195
|
+
}
|
|
196
|
+
;
|
|
197
|
+
/**
|
|
198
|
+
* Mark Messages As Read In Conversation
|
|
199
|
+
*/
|
|
200
|
+
markMessagesReadInConversation(websiteID, sessionID, read) {
|
|
201
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
202
|
+
"website", websiteID, "conversation", sessionID, "read"
|
|
203
|
+
]), null, read);
|
|
204
|
+
}
|
|
205
|
+
;
|
|
206
|
+
/**
|
|
207
|
+
* Mark Conversation As Unread
|
|
208
|
+
*/
|
|
209
|
+
markConversationAsUnread(websiteID, sessionID, unread) {
|
|
210
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
211
|
+
"website", websiteID, "conversation", sessionID, "unread"
|
|
212
|
+
]), null, unread);
|
|
213
|
+
}
|
|
214
|
+
;
|
|
215
|
+
/**
|
|
216
|
+
* Mark Messages As Delivered In Conversation
|
|
217
|
+
*/
|
|
218
|
+
markMessagesDeliveredInConversation(websiteID, sessionID, delivered) {
|
|
219
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
220
|
+
"website", websiteID, "conversation", sessionID, "delivered"
|
|
221
|
+
]), null, delivered);
|
|
222
|
+
}
|
|
223
|
+
;
|
|
224
|
+
/**
|
|
225
|
+
* Update Conversation Open State
|
|
226
|
+
*/
|
|
227
|
+
updateConversationOpenState(websiteID, sessionID, opened) {
|
|
228
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
229
|
+
"website", websiteID, "conversation", sessionID, "open"
|
|
230
|
+
]), null, {
|
|
231
|
+
opened: (opened || false)
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
;
|
|
235
|
+
/**
|
|
236
|
+
* Get Conversation Routing Assign
|
|
237
|
+
*/
|
|
238
|
+
getConversationRoutingAssign(websiteID, sessionID) {
|
|
239
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
240
|
+
"website", websiteID, "conversation", sessionID, "routing"
|
|
241
|
+
]));
|
|
242
|
+
}
|
|
243
|
+
;
|
|
244
|
+
/**
|
|
245
|
+
* Assign Conversation Routing
|
|
246
|
+
*/
|
|
247
|
+
assignConversationRouting(websiteID, sessionID, assign) {
|
|
248
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
249
|
+
"website", websiteID, "conversation", sessionID, "routing"
|
|
250
|
+
]), null, assign);
|
|
251
|
+
}
|
|
252
|
+
;
|
|
253
|
+
/**
|
|
254
|
+
* Update Conversation Inbox
|
|
255
|
+
*/
|
|
256
|
+
updateConversationInbox(websiteID, sessionID, inboxID) {
|
|
257
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
258
|
+
"website", websiteID, "conversation", sessionID, "inbox"
|
|
259
|
+
]), null, {
|
|
260
|
+
inbox_id: inboxID
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* Get Conversation Metas
|
|
265
|
+
*/
|
|
266
|
+
getConversationMetas(websiteID, sessionID) {
|
|
267
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
268
|
+
"website", websiteID, "conversation", sessionID, "meta"
|
|
269
|
+
]));
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* Update Conversation Metas
|
|
273
|
+
*/
|
|
274
|
+
updateConversationMetas(websiteID, sessionID, metas) {
|
|
275
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
276
|
+
"website", websiteID, "conversation", sessionID, "meta"
|
|
277
|
+
]), null, metas);
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Get An Original Message In Conversation
|
|
281
|
+
*/
|
|
282
|
+
getOriginalMessageInConversation(websiteID, sessionID, originalID) {
|
|
283
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
284
|
+
"website", websiteID, "conversation", sessionID, "original", originalID
|
|
285
|
+
]));
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* List Conversation Pages
|
|
289
|
+
*/
|
|
290
|
+
listConversationPages(websiteID, sessionID, pageNumber = 1) {
|
|
291
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
292
|
+
"website", websiteID, "conversation", sessionID, "pages", String(pageNumber)
|
|
293
|
+
]));
|
|
294
|
+
}
|
|
295
|
+
;
|
|
296
|
+
/**
|
|
297
|
+
* List Conversation Events
|
|
298
|
+
*/
|
|
299
|
+
listConversationEvents(websiteID, sessionID, pageNumber = 1) {
|
|
300
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
301
|
+
"website", websiteID, "conversation", sessionID, "events", String(pageNumber)
|
|
302
|
+
]));
|
|
303
|
+
}
|
|
304
|
+
;
|
|
305
|
+
/**
|
|
306
|
+
* List Conversation Files
|
|
307
|
+
*/
|
|
308
|
+
listConversationFiles(websiteID, sessionID, pageNumber = 1) {
|
|
309
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
310
|
+
"website", websiteID, "conversation", sessionID, "files", String(pageNumber)
|
|
311
|
+
]));
|
|
312
|
+
}
|
|
313
|
+
;
|
|
314
|
+
/**
|
|
315
|
+
* Get Conversation State
|
|
316
|
+
*/
|
|
317
|
+
getConversationState(websiteID, sessionID) {
|
|
318
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
319
|
+
"website", websiteID, "conversation", sessionID, "state"
|
|
320
|
+
]));
|
|
321
|
+
}
|
|
322
|
+
;
|
|
323
|
+
/**
|
|
324
|
+
* Change Conversation State
|
|
325
|
+
*/
|
|
326
|
+
changeConversationState(websiteID, sessionID, state) {
|
|
327
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
328
|
+
"website", websiteID, "conversation", sessionID, "state"
|
|
329
|
+
]), null, {
|
|
330
|
+
state: state
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
;
|
|
334
|
+
/**
|
|
335
|
+
* Get Conversation Participants
|
|
336
|
+
*/
|
|
337
|
+
getConversationParticipants(websiteID, sessionID) {
|
|
338
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
339
|
+
"website", websiteID, "conversation", sessionID, "participants"
|
|
340
|
+
]));
|
|
341
|
+
}
|
|
342
|
+
;
|
|
343
|
+
/**
|
|
344
|
+
* Save Conversation Participants
|
|
345
|
+
*/
|
|
346
|
+
saveConversationParticipants(websiteID, sessionID, participants) {
|
|
347
|
+
return this.crisp.put(this.crisp.prepareRestUrl([
|
|
348
|
+
"website", websiteID, "conversation", sessionID, "participants"
|
|
349
|
+
]), null, participants);
|
|
350
|
+
}
|
|
351
|
+
;
|
|
352
|
+
/**
|
|
353
|
+
* Get Block Status For Conversation
|
|
354
|
+
*/
|
|
355
|
+
getBlockStatusForConversation(websiteID, sessionID) {
|
|
356
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
357
|
+
"website", websiteID, "conversation", sessionID, "block"
|
|
358
|
+
]));
|
|
359
|
+
}
|
|
360
|
+
;
|
|
361
|
+
/**
|
|
362
|
+
* Block Incoming Messages For Conversation
|
|
363
|
+
*/
|
|
364
|
+
blockIncomingMessagesForConversation(websiteID, sessionID, blocked) {
|
|
365
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
366
|
+
"website", websiteID, "conversation", sessionID, "block"
|
|
367
|
+
]), null, {
|
|
368
|
+
blocked: (blocked || false)
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
;
|
|
372
|
+
/**
|
|
373
|
+
* Get Verify Status For Conversation
|
|
374
|
+
*/
|
|
375
|
+
getVerifyStatusForConversation(websiteID, sessionID) {
|
|
376
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
377
|
+
"website", websiteID, "conversation", sessionID, "verify"
|
|
378
|
+
]));
|
|
379
|
+
}
|
|
380
|
+
;
|
|
381
|
+
/**
|
|
382
|
+
* Update Verify Status For Conversation
|
|
383
|
+
*/
|
|
384
|
+
updateVerifyStatusForConversation(websiteID, sessionID, verified) {
|
|
385
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
386
|
+
"website", websiteID, "conversation", sessionID, "verify"
|
|
387
|
+
]), null, {
|
|
388
|
+
verified: (verified || false)
|
|
389
|
+
});
|
|
390
|
+
}
|
|
391
|
+
;
|
|
392
|
+
/**
|
|
393
|
+
* Request Identity Verification For Conversation
|
|
394
|
+
*/
|
|
395
|
+
requestIdentityVerificationForConversation(websiteID, sessionID, verification) {
|
|
396
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
397
|
+
"website", websiteID, "conversation", sessionID, "verify", "identity"
|
|
398
|
+
]), null, verification);
|
|
399
|
+
}
|
|
400
|
+
;
|
|
401
|
+
/**
|
|
402
|
+
* Redeem Identity Verification Link For Conversation
|
|
403
|
+
*/
|
|
404
|
+
redeemIdentityVerificationLinkForConversation(websiteID, sessionID, verification) {
|
|
405
|
+
return this.crisp.put(this.crisp.prepareRestUrl([
|
|
406
|
+
"website", websiteID, "conversation", sessionID, "verify", "identity",
|
|
407
|
+
"link"
|
|
408
|
+
]), null, verification);
|
|
409
|
+
}
|
|
410
|
+
;
|
|
411
|
+
/**
|
|
412
|
+
* Request Email Transcript For Conversation
|
|
413
|
+
*/
|
|
414
|
+
requestEmailTranscriptForConversation(websiteID, sessionID, to, email) {
|
|
415
|
+
// Generate body
|
|
416
|
+
let body = {
|
|
417
|
+
to: to
|
|
418
|
+
};
|
|
419
|
+
if (email) {
|
|
420
|
+
// @ts-ignore
|
|
421
|
+
body.email = email;
|
|
422
|
+
}
|
|
423
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
424
|
+
"website", websiteID, "conversation", sessionID, "transcript"
|
|
425
|
+
]), null, body);
|
|
426
|
+
}
|
|
427
|
+
;
|
|
428
|
+
/**
|
|
429
|
+
* Request Chatbox Binding Purge For Conversation
|
|
430
|
+
*/
|
|
431
|
+
requestChatboxBindingPurgeForConversation(websiteID, sessionID) {
|
|
432
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
433
|
+
"website", websiteID, "conversation", sessionID, "purge"
|
|
434
|
+
]), null, null);
|
|
435
|
+
}
|
|
436
|
+
;
|
|
437
|
+
/**
|
|
438
|
+
* Request User Feedback For Conversation
|
|
439
|
+
*/
|
|
440
|
+
requestUserFeedbackForConversation(websiteID, sessionID) {
|
|
441
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
442
|
+
"website", websiteID, "conversation", sessionID, "feedback"
|
|
443
|
+
]), null, null);
|
|
444
|
+
}
|
|
445
|
+
;
|
|
446
|
+
/**
|
|
447
|
+
* List Browsing Sessions For Conversation
|
|
448
|
+
*/
|
|
449
|
+
listBrowsingSessionsForConversation(websiteID, sessionID) {
|
|
450
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
451
|
+
"website", websiteID, "conversation", sessionID, "browsing"
|
|
452
|
+
]));
|
|
453
|
+
}
|
|
454
|
+
;
|
|
455
|
+
/**
|
|
456
|
+
* Initiate Browsing Session For Conversation
|
|
457
|
+
*/
|
|
458
|
+
initiateBrowsingSessionForConversation(websiteID, sessionID) {
|
|
459
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
460
|
+
"website", websiteID, "conversation", sessionID, "browsing"
|
|
461
|
+
]), null, null);
|
|
462
|
+
}
|
|
463
|
+
;
|
|
464
|
+
/**
|
|
465
|
+
* Send Action To An Existing Browsing Session
|
|
466
|
+
*/
|
|
467
|
+
sendActionToExistingBrowsingSession(websiteID, sessionID, browsingID, action) {
|
|
468
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
469
|
+
"website", websiteID, "conversation", sessionID, "browsing", browsingID
|
|
470
|
+
]), null, {
|
|
471
|
+
action: action
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
;
|
|
475
|
+
/**
|
|
476
|
+
* Assist Existing Browsing Session
|
|
477
|
+
*/
|
|
478
|
+
assistExistingBrowsingSession(websiteID, sessionID, browsingID, assist) {
|
|
479
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
480
|
+
"website", websiteID, "conversation", sessionID, "browsing", browsingID,
|
|
481
|
+
"assist"
|
|
482
|
+
]), null, assist);
|
|
483
|
+
}
|
|
484
|
+
;
|
|
485
|
+
/**
|
|
486
|
+
* Initiate New Call Session For Conversation
|
|
487
|
+
*/
|
|
488
|
+
initiateNewCallSessionForConversation(websiteID, sessionID, mode) {
|
|
489
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
490
|
+
"website", websiteID, "conversation", sessionID, "call"
|
|
491
|
+
]), null, {
|
|
492
|
+
mode: (mode || "audio")
|
|
493
|
+
});
|
|
494
|
+
}
|
|
495
|
+
;
|
|
496
|
+
/**
|
|
497
|
+
* Get Ongoing Call Session For Conversation
|
|
498
|
+
*/
|
|
499
|
+
getOngoingCallSessionForConversation(websiteID, sessionID) {
|
|
500
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
501
|
+
"website", websiteID, "conversation", sessionID, "call"
|
|
502
|
+
]));
|
|
503
|
+
}
|
|
504
|
+
;
|
|
505
|
+
/**
|
|
506
|
+
* Abort Ongoing Call Session For Conversation
|
|
507
|
+
*/
|
|
508
|
+
abortOngoingCallSessionForConversation(websiteID, sessionID, callID) {
|
|
509
|
+
return this.crisp.delete(this.crisp.prepareRestUrl([
|
|
510
|
+
"website", websiteID, "conversation", sessionID, "call", callID
|
|
511
|
+
]));
|
|
512
|
+
}
|
|
513
|
+
;
|
|
514
|
+
/**
|
|
515
|
+
* Transmit Signaling On Ongoing Call Session
|
|
516
|
+
*/
|
|
517
|
+
transmitSignalingOnOngoingCallSession(websiteID, sessionID, callID, payload) {
|
|
518
|
+
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
519
|
+
"website", websiteID, "conversation", sessionID, "call", callID
|
|
520
|
+
]), null, payload);
|
|
521
|
+
}
|
|
522
|
+
;
|
|
523
|
+
/**
|
|
524
|
+
* Deliver Widget Button Action For Conversation
|
|
525
|
+
*/
|
|
526
|
+
deliverWidgetButtonActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data, value) {
|
|
527
|
+
// Generate body
|
|
528
|
+
let body = {
|
|
529
|
+
section_id: sectionID,
|
|
530
|
+
item_id: itemID,
|
|
531
|
+
data: data
|
|
532
|
+
};
|
|
533
|
+
if (typeof value !== "undefined") {
|
|
534
|
+
// @ts-ignore
|
|
535
|
+
body.value = value;
|
|
536
|
+
}
|
|
537
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
538
|
+
"website", websiteID, "conversation", sessionID, "widget", pluginID,
|
|
539
|
+
"button"
|
|
540
|
+
]), null, body);
|
|
541
|
+
}
|
|
542
|
+
;
|
|
543
|
+
/**
|
|
544
|
+
* Deliver Widget Data Fetch Action For Conversation
|
|
545
|
+
*/
|
|
546
|
+
deliverWidgetDataFetchActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, data) {
|
|
547
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
548
|
+
"website", websiteID, "conversation", sessionID, "widget", pluginID,
|
|
549
|
+
"data"
|
|
550
|
+
]), null, {
|
|
551
|
+
section_id: sectionID,
|
|
552
|
+
item_id: itemID,
|
|
553
|
+
data: data
|
|
554
|
+
});
|
|
555
|
+
}
|
|
556
|
+
;
|
|
557
|
+
/**
|
|
558
|
+
* Deliver Widget Data Edit Action For Conversation
|
|
559
|
+
*/
|
|
560
|
+
deliverWidgetDataEditActionForConversation(websiteID, sessionID, pluginID, sectionID, itemID, value) {
|
|
561
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
562
|
+
"website", websiteID, "conversation", sessionID, "widget", pluginID,
|
|
563
|
+
"data"
|
|
564
|
+
]), null, {
|
|
565
|
+
section_id: sectionID,
|
|
566
|
+
item_id: itemID,
|
|
567
|
+
value: value
|
|
568
|
+
});
|
|
569
|
+
}
|
|
570
|
+
;
|
|
571
|
+
/**
|
|
572
|
+
* Schedule A Reminder For Conversation
|
|
573
|
+
*/
|
|
574
|
+
scheduleReminderForConversation(websiteID, sessionID, date, note) {
|
|
575
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
576
|
+
"website", websiteID, "conversation", sessionID, "reminder"
|
|
577
|
+
]), null, {
|
|
578
|
+
date: date,
|
|
579
|
+
note: note
|
|
580
|
+
});
|
|
581
|
+
}
|
|
582
|
+
;
|
|
583
|
+
/**
|
|
584
|
+
* Report Conversation
|
|
585
|
+
*/
|
|
586
|
+
reportConversation(websiteID, sessionID, flag) {
|
|
587
|
+
return this.crisp.post(this.crisp.prepareRestUrl([
|
|
588
|
+
"website", websiteID, "conversation", sessionID, "report"
|
|
589
|
+
]), null, {
|
|
590
|
+
flag: flag
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
;
|
|
594
|
+
}
|
|
595
|
+
exports.default = WebsiteConversation;
|