crisp-api 10.9.2 → 10.10.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 +6 -0
- package/EXAMPLES.md +8 -0
- package/README.md +449 -310
- package/dist/crisp.d.ts +2 -2
- package/dist/crisp.js +5 -1
- package/dist/resources/WebsiteBatch.d.ts +43 -0
- package/dist/resources/WebsiteBatch.js +42 -0
- package/dist/resources/WebsiteCampaign.d.ts +1 -0
- package/dist/resources/WebsiteConnect.d.ts +34 -0
- package/dist/resources/WebsiteConnect.js +37 -0
- package/dist/resources/WebsiteConversation.d.ts +1 -1
- package/dist/resources/WebsiteConversation.js +1 -1
- package/dist/resources/index.d.ts +1 -0
- package/dist/resources/index.js +1 -0
- package/dist/services/website.d.ts +2 -1
- package/dist/services/website.js +2 -0
- package/lib/crisp.ts +8 -2
- package/lib/resources/WebsiteBatch.ts +102 -0
- package/lib/resources/WebsiteCampaign.ts +1 -0
- package/lib/resources/WebsiteConnect.ts +57 -0
- package/lib/resources/WebsiteConversation.ts +2 -2
- package/lib/resources/index.ts +1 -0
- package/lib/services/website.ts +3 -0
- package/package.json +1 -1
package/dist/crisp.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ import { WebsiteServiceInterface } from "./services/website";
|
|
|
9
9
|
* TYPES
|
|
10
10
|
***************************************************************************/
|
|
11
11
|
export type RTM_MODES = "websockets" | "webhooks";
|
|
12
|
-
export type CrispTier = "user" | "plugin";
|
|
12
|
+
export type CrispTier = "user" | "website" | "plugin";
|
|
13
13
|
/**************************************************************************
|
|
14
14
|
* INTERFACES
|
|
15
15
|
***************************************************************************/
|
|
@@ -79,7 +79,7 @@ declare class Crisp {
|
|
|
79
79
|
/**
|
|
80
80
|
* Sets the authentication tier
|
|
81
81
|
*/
|
|
82
|
-
setTier(tier: "user" | "plugin"): void;
|
|
82
|
+
setTier(tier: "user" | "website" | "plugin"): void;
|
|
83
83
|
/**
|
|
84
84
|
* Authenticates
|
|
85
85
|
*/
|
package/dist/crisp.js
CHANGED
|
@@ -46,7 +46,7 @@ const AVAILABLE_RTM_MODES = [
|
|
|
46
46
|
"websockets",
|
|
47
47
|
"webhooks"
|
|
48
48
|
];
|
|
49
|
-
const VERSION = "10.
|
|
49
|
+
const VERSION = "10.10.0";
|
|
50
50
|
// Base configuration
|
|
51
51
|
const DEFAULT_REQUEST_TIMEOUT = 10000;
|
|
52
52
|
const DEFAULT_SOCKET_TIMEOUT = 10000;
|
|
@@ -578,6 +578,10 @@ class Crisp {
|
|
|
578
578
|
// Acquire RTM API URL from remote
|
|
579
579
|
let restUrlSegments;
|
|
580
580
|
switch (this.auth.tier) {
|
|
581
|
+
case "website": {
|
|
582
|
+
restUrlSegments = ["website", "connect", "endpoints"];
|
|
583
|
+
break;
|
|
584
|
+
}
|
|
581
585
|
case "plugin": {
|
|
582
586
|
restUrlSegments = ["plugin", "connect", "endpoints"];
|
|
583
587
|
break;
|
|
@@ -9,6 +9,25 @@ export type WebsiteBatchConversationsOperation = {
|
|
|
9
9
|
inbox_id?: string;
|
|
10
10
|
sessions?: string[];
|
|
11
11
|
};
|
|
12
|
+
export type WebsiteBatchReportOperation = {
|
|
13
|
+
sessions: string[];
|
|
14
|
+
flag: string;
|
|
15
|
+
};
|
|
16
|
+
export type WebsiteBatchBlockOperation = {
|
|
17
|
+
sessions: string[];
|
|
18
|
+
blocked: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type WebsiteBatchRoutingOperationAssigned = {
|
|
21
|
+
user_id: string;
|
|
22
|
+
};
|
|
23
|
+
export type WebsiteBatchRoutingOperation = {
|
|
24
|
+
sessions: string[];
|
|
25
|
+
assigned: WebsiteBatchRoutingOperationAssigned | null;
|
|
26
|
+
};
|
|
27
|
+
export type WebsiteBatchInboxOperation = {
|
|
28
|
+
sessions: string[];
|
|
29
|
+
inbox_id: string | null;
|
|
30
|
+
};
|
|
12
31
|
export type WebsiteBatchPeopleOperationInner = {
|
|
13
32
|
profiles?: string[];
|
|
14
33
|
search?: string;
|
|
@@ -24,6 +43,10 @@ declare class WebsiteBatch extends BaseResource {
|
|
|
24
43
|
* Batch Resolve Conversations
|
|
25
44
|
*/
|
|
26
45
|
batchResolveConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
|
|
46
|
+
/**
|
|
47
|
+
* Batch Unresolve Conversations
|
|
48
|
+
*/
|
|
49
|
+
batchUnresolveConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
|
|
27
50
|
/**
|
|
28
51
|
* Batch Read Conversations
|
|
29
52
|
* @memberof WebsiteBatch
|
|
@@ -34,6 +57,10 @@ declare class WebsiteBatch extends BaseResource {
|
|
|
34
57
|
* @return {Promise}
|
|
35
58
|
*/
|
|
36
59
|
batchReadConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
|
|
60
|
+
/**
|
|
61
|
+
* Batch Unread Conversations
|
|
62
|
+
*/
|
|
63
|
+
batchUnreadConversations(websiteID: string, operation: WebsiteBatchConversationsOperation): Promise<any>;
|
|
37
64
|
/**
|
|
38
65
|
* Batch Remove Conversations
|
|
39
66
|
* @memberof WebsiteBatch
|
|
@@ -54,6 +81,22 @@ declare class WebsiteBatch extends BaseResource {
|
|
|
54
81
|
* @return {Promise}
|
|
55
82
|
*/
|
|
56
83
|
batchRemovePeople(websiteID: string, people: WebsiteBatchPeopleOperationInner): Promise<any>;
|
|
84
|
+
/**
|
|
85
|
+
* Batch Report Conversations
|
|
86
|
+
*/
|
|
87
|
+
batchReportConversations(websiteID: string, operation: WebsiteBatchReportOperation): Promise<any>;
|
|
88
|
+
/**
|
|
89
|
+
* Batch Block Conversations
|
|
90
|
+
*/
|
|
91
|
+
batchBlockConversations(websiteID: string, operation: WebsiteBatchBlockOperation): Promise<any>;
|
|
92
|
+
/**
|
|
93
|
+
* Batch Routing Conversations
|
|
94
|
+
*/
|
|
95
|
+
batchRoutingConversations(websiteID: string, operation: WebsiteBatchRoutingOperation): Promise<any>;
|
|
96
|
+
/**
|
|
97
|
+
* Batch Inbox Conversations
|
|
98
|
+
*/
|
|
99
|
+
batchInboxConversations(websiteID: string, operation: WebsiteBatchInboxOperation): Promise<any>;
|
|
57
100
|
}
|
|
58
101
|
/**************************************************************************
|
|
59
102
|
* EXPORTS
|
|
@@ -28,6 +28,13 @@ class WebsiteBatch extends BaseResource_1.default {
|
|
|
28
28
|
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "resolve"]), null, operation);
|
|
29
29
|
}
|
|
30
30
|
;
|
|
31
|
+
/**
|
|
32
|
+
* Batch Unresolve Conversations
|
|
33
|
+
*/
|
|
34
|
+
batchUnresolveConversations(websiteID, operation) {
|
|
35
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "unresolve"]), null, operation);
|
|
36
|
+
}
|
|
37
|
+
;
|
|
31
38
|
/**
|
|
32
39
|
* Batch Read Conversations
|
|
33
40
|
* @memberof WebsiteBatch
|
|
@@ -41,6 +48,13 @@ class WebsiteBatch extends BaseResource_1.default {
|
|
|
41
48
|
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "read"]), null, operation);
|
|
42
49
|
}
|
|
43
50
|
;
|
|
51
|
+
/**
|
|
52
|
+
* Batch Unread Conversations
|
|
53
|
+
*/
|
|
54
|
+
batchUnreadConversations(websiteID, operation) {
|
|
55
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "unread"]), null, operation);
|
|
56
|
+
}
|
|
57
|
+
;
|
|
44
58
|
/**
|
|
45
59
|
* Batch Remove Conversations
|
|
46
60
|
* @memberof WebsiteBatch
|
|
@@ -69,6 +83,34 @@ class WebsiteBatch extends BaseResource_1.default {
|
|
|
69
83
|
});
|
|
70
84
|
}
|
|
71
85
|
;
|
|
86
|
+
/**
|
|
87
|
+
* Batch Report Conversations
|
|
88
|
+
*/
|
|
89
|
+
batchReportConversations(websiteID, operation) {
|
|
90
|
+
return this.crisp.post(this.crisp.prepareRestUrl(["website", websiteID, "batch", "report"]), null, operation);
|
|
91
|
+
}
|
|
92
|
+
;
|
|
93
|
+
/**
|
|
94
|
+
* Batch Block Conversations
|
|
95
|
+
*/
|
|
96
|
+
batchBlockConversations(websiteID, operation) {
|
|
97
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "block"]), null, operation);
|
|
98
|
+
}
|
|
99
|
+
;
|
|
100
|
+
/**
|
|
101
|
+
* Batch Routing Conversations
|
|
102
|
+
*/
|
|
103
|
+
batchRoutingConversations(websiteID, operation) {
|
|
104
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "routing"]), null, operation);
|
|
105
|
+
}
|
|
106
|
+
;
|
|
107
|
+
/**
|
|
108
|
+
* Batch Inbox Conversations
|
|
109
|
+
*/
|
|
110
|
+
batchInboxConversations(websiteID, operation) {
|
|
111
|
+
return this.crisp.patch(this.crisp.prepareRestUrl(["website", websiteID, "batch", "inbox"]), null, operation);
|
|
112
|
+
}
|
|
113
|
+
;
|
|
72
114
|
}
|
|
73
115
|
/**************************************************************************
|
|
74
116
|
* EXPORTS
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**************************************************************************
|
|
2
|
+
* IMPORTS
|
|
3
|
+
***************************************************************************/
|
|
4
|
+
import BaseResource from "./BaseResource";
|
|
5
|
+
/**************************************************************************
|
|
6
|
+
* TYPES
|
|
7
|
+
***************************************************************************/
|
|
8
|
+
export type WebsiteConnectEndpoints = {
|
|
9
|
+
socket?: WebsiteConnectEndpointsSocket;
|
|
10
|
+
rescue?: WebsiteConnectEndpointsRescue;
|
|
11
|
+
};
|
|
12
|
+
export type WebsiteConnectEndpointsSocket = {
|
|
13
|
+
app?: string;
|
|
14
|
+
stream?: string;
|
|
15
|
+
};
|
|
16
|
+
export type WebsiteConnectEndpointsRescue = {
|
|
17
|
+
socket?: WebsiteConnectEndpointsSocket;
|
|
18
|
+
};
|
|
19
|
+
/**************************************************************************
|
|
20
|
+
* CLASSES
|
|
21
|
+
***************************************************************************/
|
|
22
|
+
/**
|
|
23
|
+
* Crisp WebsiteConnect Resource
|
|
24
|
+
*/
|
|
25
|
+
declare class WebsiteConnect extends BaseResource {
|
|
26
|
+
/**
|
|
27
|
+
* Get Connect Endpoints
|
|
28
|
+
*/
|
|
29
|
+
getConnectEndpoints(websiteID: string): Promise<WebsiteConnectEndpoints>;
|
|
30
|
+
}
|
|
31
|
+
/**************************************************************************
|
|
32
|
+
* EXPORTS
|
|
33
|
+
***************************************************************************/
|
|
34
|
+
export default WebsiteConnect;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* This file is part of node-crisp-api
|
|
4
|
+
*
|
|
5
|
+
* Copyright (c) 2026 Crisp IM SAS
|
|
6
|
+
* All rights belong to Crisp IM SAS
|
|
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
|
+
* CLASSES
|
|
19
|
+
***************************************************************************/
|
|
20
|
+
/**
|
|
21
|
+
* Crisp WebsiteConnect Resource
|
|
22
|
+
*/
|
|
23
|
+
class WebsiteConnect extends BaseResource_1.default {
|
|
24
|
+
/**
|
|
25
|
+
* Get Connect Endpoints
|
|
26
|
+
*/
|
|
27
|
+
getConnectEndpoints(websiteID) {
|
|
28
|
+
return this.crisp.get(this.crisp.prepareRestUrl([
|
|
29
|
+
"website", websiteID, "connect", "endpoints"
|
|
30
|
+
]));
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
}
|
|
34
|
+
/**************************************************************************
|
|
35
|
+
* EXPORTS
|
|
36
|
+
***************************************************************************/
|
|
37
|
+
exports.default = WebsiteConnect;
|
|
@@ -555,7 +555,7 @@ declare class WebsiteConversation extends BaseResource {
|
|
|
555
555
|
/**
|
|
556
556
|
* Update Conversation Inbox
|
|
557
557
|
*/
|
|
558
|
-
updateConversationInbox(websiteID: string, sessionID: string, inboxID
|
|
558
|
+
updateConversationInbox(websiteID: string, sessionID: string, inboxID?: string | null): Promise<any>;
|
|
559
559
|
/**
|
|
560
560
|
* Get Conversation Metas
|
|
561
561
|
*/
|
|
@@ -268,7 +268,7 @@ class WebsiteConversation extends BaseResource_1.default {
|
|
|
268
268
|
return this.crisp.patch(this.crisp.prepareRestUrl([
|
|
269
269
|
"website", websiteID, "conversation", sessionID, "inbox"
|
|
270
270
|
]), null, {
|
|
271
|
-
inbox_id: inboxID
|
|
271
|
+
inbox_id: inboxID || null
|
|
272
272
|
});
|
|
273
273
|
}
|
|
274
274
|
/**
|
|
@@ -12,6 +12,7 @@ export * from "./WebsiteAvailability";
|
|
|
12
12
|
export * from "./WebsiteBase";
|
|
13
13
|
export * from "./WebsiteBatch";
|
|
14
14
|
export * from "./WebsiteCampaign";
|
|
15
|
+
export * from "./WebsiteConnect";
|
|
15
16
|
export * from "./WebsiteConversation";
|
|
16
17
|
export * from "./WebsiteHelpdesk";
|
|
17
18
|
export * from "./WebsiteInbox";
|
package/dist/resources/index.js
CHANGED
|
@@ -34,6 +34,7 @@ __exportStar(require("./WebsiteAvailability"), exports);
|
|
|
34
34
|
__exportStar(require("./WebsiteBase"), exports);
|
|
35
35
|
__exportStar(require("./WebsiteBatch"), exports);
|
|
36
36
|
__exportStar(require("./WebsiteCampaign"), exports);
|
|
37
|
+
__exportStar(require("./WebsiteConnect"), exports);
|
|
37
38
|
__exportStar(require("./WebsiteConversation"), exports);
|
|
38
39
|
__exportStar(require("./WebsiteHelpdesk"), exports);
|
|
39
40
|
__exportStar(require("./WebsiteInbox"), exports);
|
|
@@ -6,6 +6,7 @@ import WebsiteAnalytics from "../resources/WebsiteAnalytics";
|
|
|
6
6
|
import WebsiteAvailability from "../resources/WebsiteAvailability";
|
|
7
7
|
import WebsiteBatch from "../resources/WebsiteBatch";
|
|
8
8
|
import WebsiteCampaign from "../resources/WebsiteCampaign";
|
|
9
|
+
import WebsiteConnect from "../resources/WebsiteConnect";
|
|
9
10
|
import WebsiteConversation from "../resources/WebsiteConversation";
|
|
10
11
|
import WebsiteHelpdesk from "../resources/WebsiteHelpdesk";
|
|
11
12
|
import WebsiteInbox from "../resources/WebsiteInbox";
|
|
@@ -26,6 +27,6 @@ declare class WebsiteService {
|
|
|
26
27
|
/**************************************************************************
|
|
27
28
|
* EXPORTS
|
|
28
29
|
***************************************************************************/
|
|
29
|
-
export interface WebsiteServiceInterface extends WebsiteBase, WebsiteAnalytics, WebsiteAvailability, WebsiteBatch, WebsiteCampaign, WebsiteConversation, WebsiteHelpdesk, WebsiteInbox, WebsiteOperator, WebsitePeople, WebsiteSettings, WebsiteVerify, WebsiteVisitors {
|
|
30
|
+
export interface WebsiteServiceInterface extends WebsiteBase, WebsiteAnalytics, WebsiteAvailability, WebsiteBatch, WebsiteCampaign, WebsiteConnect, WebsiteConversation, WebsiteHelpdesk, WebsiteInbox, WebsiteOperator, WebsitePeople, WebsiteSettings, WebsiteVerify, WebsiteVisitors {
|
|
30
31
|
}
|
|
31
32
|
export default WebsiteService;
|
package/dist/services/website.js
CHANGED
|
@@ -18,6 +18,7 @@ const WebsiteAnalytics_1 = __importDefault(require("../resources/WebsiteAnalytic
|
|
|
18
18
|
const WebsiteAvailability_1 = __importDefault(require("../resources/WebsiteAvailability"));
|
|
19
19
|
const WebsiteBatch_1 = __importDefault(require("../resources/WebsiteBatch"));
|
|
20
20
|
const WebsiteCampaign_1 = __importDefault(require("../resources/WebsiteCampaign"));
|
|
21
|
+
const WebsiteConnect_1 = __importDefault(require("../resources/WebsiteConnect"));
|
|
21
22
|
const WebsiteConversation_1 = __importDefault(require("../resources/WebsiteConversation"));
|
|
22
23
|
const WebsiteHelpdesk_1 = __importDefault(require("../resources/WebsiteHelpdesk"));
|
|
23
24
|
const WebsiteInbox_1 = __importDefault(require("../resources/WebsiteInbox"));
|
|
@@ -41,6 +42,7 @@ class WebsiteService {
|
|
|
41
42
|
WebsiteAvailability_1.default,
|
|
42
43
|
WebsiteBatch_1.default,
|
|
43
44
|
WebsiteCampaign_1.default,
|
|
45
|
+
WebsiteConnect_1.default,
|
|
44
46
|
WebsiteConversation_1.default,
|
|
45
47
|
WebsiteHelpdesk_1.default,
|
|
46
48
|
WebsiteInbox_1.default,
|
package/lib/crisp.ts
CHANGED
|
@@ -31,7 +31,7 @@ import Website, { WebsiteServiceInterface } from "@/services/website";
|
|
|
31
31
|
|
|
32
32
|
export type RTM_MODES = "websockets" | "webhooks";
|
|
33
33
|
|
|
34
|
-
export type CrispTier = "user" | "plugin";
|
|
34
|
+
export type CrispTier = "user" | "website" | "plugin";
|
|
35
35
|
|
|
36
36
|
/**************************************************************************
|
|
37
37
|
* CONSTANTS
|
|
@@ -322,7 +322,7 @@ class Crisp {
|
|
|
322
322
|
/**
|
|
323
323
|
* Sets the authentication tier
|
|
324
324
|
*/
|
|
325
|
-
setTier(tier: "user" | "plugin") {
|
|
325
|
+
setTier(tier: "user" | "website" | "plugin") {
|
|
326
326
|
this.auth.tier = (tier || "user");
|
|
327
327
|
}
|
|
328
328
|
|
|
@@ -753,6 +753,12 @@ class Crisp {
|
|
|
753
753
|
let restUrlSegments;
|
|
754
754
|
|
|
755
755
|
switch (this.auth.tier) {
|
|
756
|
+
case "website": {
|
|
757
|
+
restUrlSegments = ["website", "connect", "endpoints"];
|
|
758
|
+
|
|
759
|
+
break;
|
|
760
|
+
}
|
|
761
|
+
|
|
756
762
|
case "plugin": {
|
|
757
763
|
restUrlSegments = ["plugin", "connect", "endpoints"];
|
|
758
764
|
|
|
@@ -21,6 +21,30 @@ export type WebsiteBatchConversationsOperation = {
|
|
|
21
21
|
sessions?: string[];
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export type WebsiteBatchReportOperation = {
|
|
25
|
+
sessions: string[];
|
|
26
|
+
flag: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type WebsiteBatchBlockOperation = {
|
|
30
|
+
sessions: string[];
|
|
31
|
+
blocked: boolean;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type WebsiteBatchRoutingOperationAssigned = {
|
|
35
|
+
user_id: string;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type WebsiteBatchRoutingOperation = {
|
|
39
|
+
sessions: string[];
|
|
40
|
+
assigned: WebsiteBatchRoutingOperationAssigned | null;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type WebsiteBatchInboxOperation = {
|
|
44
|
+
sessions: string[];
|
|
45
|
+
inbox_id: string | null;
|
|
46
|
+
}
|
|
47
|
+
|
|
24
48
|
export type WebsiteBatchPeopleOperationInner = {
|
|
25
49
|
profiles?: string[];
|
|
26
50
|
search?: string;
|
|
@@ -47,6 +71,19 @@ class WebsiteBatch extends BaseResource {
|
|
|
47
71
|
);
|
|
48
72
|
};
|
|
49
73
|
|
|
74
|
+
/**
|
|
75
|
+
* Batch Unresolve Conversations
|
|
76
|
+
*/
|
|
77
|
+
batchUnresolveConversations(
|
|
78
|
+
websiteID: string, operation: WebsiteBatchConversationsOperation
|
|
79
|
+
) {
|
|
80
|
+
return this.crisp.patch(
|
|
81
|
+
this.crisp.prepareRestUrl(["website", websiteID, "batch", "unresolve"]),
|
|
82
|
+
|
|
83
|
+
null, operation
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
50
87
|
/**
|
|
51
88
|
* Batch Read Conversations
|
|
52
89
|
* @memberof WebsiteBatch
|
|
@@ -66,6 +103,19 @@ class WebsiteBatch extends BaseResource {
|
|
|
66
103
|
);
|
|
67
104
|
};
|
|
68
105
|
|
|
106
|
+
/**
|
|
107
|
+
* Batch Unread Conversations
|
|
108
|
+
*/
|
|
109
|
+
batchUnreadConversations(
|
|
110
|
+
websiteID: string, operation: WebsiteBatchConversationsOperation
|
|
111
|
+
) {
|
|
112
|
+
return this.crisp.patch(
|
|
113
|
+
this.crisp.prepareRestUrl(["website", websiteID, "batch", "unread"]),
|
|
114
|
+
|
|
115
|
+
null, operation
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
69
119
|
/**
|
|
70
120
|
* Batch Remove Conversations
|
|
71
121
|
* @memberof WebsiteBatch
|
|
@@ -107,6 +157,58 @@ class WebsiteBatch extends BaseResource {
|
|
|
107
157
|
}
|
|
108
158
|
);
|
|
109
159
|
};
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* Batch Report Conversations
|
|
163
|
+
*/
|
|
164
|
+
batchReportConversations(
|
|
165
|
+
websiteID: string, operation: WebsiteBatchReportOperation
|
|
166
|
+
) {
|
|
167
|
+
return this.crisp.post(
|
|
168
|
+
this.crisp.prepareRestUrl(["website", websiteID, "batch", "report"]),
|
|
169
|
+
|
|
170
|
+
null, operation
|
|
171
|
+
);
|
|
172
|
+
};
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* Batch Block Conversations
|
|
176
|
+
*/
|
|
177
|
+
batchBlockConversations(
|
|
178
|
+
websiteID: string, operation: WebsiteBatchBlockOperation
|
|
179
|
+
) {
|
|
180
|
+
return this.crisp.patch(
|
|
181
|
+
this.crisp.prepareRestUrl(["website", websiteID, "batch", "block"]),
|
|
182
|
+
|
|
183
|
+
null, operation
|
|
184
|
+
);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Batch Routing Conversations
|
|
189
|
+
*/
|
|
190
|
+
batchRoutingConversations(
|
|
191
|
+
websiteID: string, operation: WebsiteBatchRoutingOperation
|
|
192
|
+
) {
|
|
193
|
+
return this.crisp.patch(
|
|
194
|
+
this.crisp.prepareRestUrl(["website", websiteID, "batch", "routing"]),
|
|
195
|
+
|
|
196
|
+
null, operation
|
|
197
|
+
);
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Batch Inbox Conversations
|
|
202
|
+
*/
|
|
203
|
+
batchInboxConversations(
|
|
204
|
+
websiteID: string, operation: WebsiteBatchInboxOperation
|
|
205
|
+
) {
|
|
206
|
+
return this.crisp.patch(
|
|
207
|
+
this.crisp.prepareRestUrl(["website", websiteID, "batch", "inbox"]),
|
|
208
|
+
|
|
209
|
+
null, operation
|
|
210
|
+
);
|
|
211
|
+
};
|
|
110
212
|
}
|
|
111
213
|
|
|
112
214
|
/**************************************************************************
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file is part of node-crisp-api
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2026 Crisp IM SAS
|
|
5
|
+
* All rights belong to Crisp IM SAS
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**************************************************************************
|
|
9
|
+
* IMPORTS
|
|
10
|
+
***************************************************************************/
|
|
11
|
+
|
|
12
|
+
// PROJECT: RESOURCES
|
|
13
|
+
import BaseResource from "./BaseResource";
|
|
14
|
+
|
|
15
|
+
/**************************************************************************
|
|
16
|
+
* TYPES
|
|
17
|
+
***************************************************************************/
|
|
18
|
+
|
|
19
|
+
export type WebsiteConnectEndpoints = {
|
|
20
|
+
socket?: WebsiteConnectEndpointsSocket;
|
|
21
|
+
rescue?: WebsiteConnectEndpointsRescue;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type WebsiteConnectEndpointsSocket = {
|
|
25
|
+
app?: string;
|
|
26
|
+
stream?: string;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export type WebsiteConnectEndpointsRescue = {
|
|
30
|
+
socket?: WebsiteConnectEndpointsSocket;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**************************************************************************
|
|
34
|
+
* CLASSES
|
|
35
|
+
***************************************************************************/
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Crisp WebsiteConnect Resource
|
|
39
|
+
*/
|
|
40
|
+
class WebsiteConnect extends BaseResource {
|
|
41
|
+
/**
|
|
42
|
+
* Get Connect Endpoints
|
|
43
|
+
*/
|
|
44
|
+
getConnectEndpoints(websiteID: string): Promise<WebsiteConnectEndpoints> {
|
|
45
|
+
return this.crisp.get(
|
|
46
|
+
this.crisp.prepareRestUrl([
|
|
47
|
+
"website", websiteID, "connect", "endpoints"
|
|
48
|
+
])
|
|
49
|
+
);
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**************************************************************************
|
|
54
|
+
* EXPORTS
|
|
55
|
+
***************************************************************************/
|
|
56
|
+
|
|
57
|
+
export default WebsiteConnect;
|
|
@@ -947,7 +947,7 @@ class WebsiteConversation extends BaseResource {
|
|
|
947
947
|
* Update Conversation Inbox
|
|
948
948
|
*/
|
|
949
949
|
updateConversationInbox(
|
|
950
|
-
websiteID: string, sessionID: string, inboxID
|
|
950
|
+
websiteID: string, sessionID: string, inboxID?: string | null
|
|
951
951
|
) {
|
|
952
952
|
return this.crisp.patch(
|
|
953
953
|
this.crisp.prepareRestUrl([
|
|
@@ -957,7 +957,7 @@ class WebsiteConversation extends BaseResource {
|
|
|
957
957
|
null,
|
|
958
958
|
|
|
959
959
|
{
|
|
960
|
-
inbox_id: inboxID
|
|
960
|
+
inbox_id: inboxID || null
|
|
961
961
|
}
|
|
962
962
|
);
|
|
963
963
|
}
|
package/lib/resources/index.ts
CHANGED
|
@@ -20,6 +20,7 @@ export * from "./WebsiteAvailability";
|
|
|
20
20
|
export * from "./WebsiteBase";
|
|
21
21
|
export * from "./WebsiteBatch";
|
|
22
22
|
export * from "./WebsiteCampaign";
|
|
23
|
+
export * from "./WebsiteConnect";
|
|
23
24
|
export * from "./WebsiteConversation";
|
|
24
25
|
export * from "./WebsiteHelpdesk";
|
|
25
26
|
export * from "./WebsiteInbox";
|
package/lib/services/website.ts
CHANGED
|
@@ -15,6 +15,7 @@ import WebsiteAnalytics from "@/resources/WebsiteAnalytics";
|
|
|
15
15
|
import WebsiteAvailability from "@/resources/WebsiteAvailability";
|
|
16
16
|
import WebsiteBatch from "@/resources/WebsiteBatch";
|
|
17
17
|
import WebsiteCampaign from "@/resources/WebsiteCampaign";
|
|
18
|
+
import WebsiteConnect from "@/resources/WebsiteConnect";
|
|
18
19
|
import WebsiteConversation from "@/resources/WebsiteConversation";
|
|
19
20
|
import WebsiteHelpdesk from "@/resources/WebsiteHelpdesk";
|
|
20
21
|
import WebsiteInbox from "@/resources/WebsiteInbox";
|
|
@@ -39,6 +40,7 @@ class WebsiteService {
|
|
|
39
40
|
WebsiteAvailability,
|
|
40
41
|
WebsiteBatch,
|
|
41
42
|
WebsiteCampaign,
|
|
43
|
+
WebsiteConnect,
|
|
42
44
|
WebsiteConversation,
|
|
43
45
|
WebsiteHelpdesk,
|
|
44
46
|
WebsiteInbox,
|
|
@@ -60,6 +62,7 @@ export interface WebsiteServiceInterface extends
|
|
|
60
62
|
WebsiteAvailability,
|
|
61
63
|
WebsiteBatch,
|
|
62
64
|
WebsiteCampaign,
|
|
65
|
+
WebsiteConnect,
|
|
63
66
|
WebsiteConversation,
|
|
64
67
|
WebsiteHelpdesk,
|
|
65
68
|
WebsiteInbox,
|
package/package.json
CHANGED