crisp-api 10.0.15 → 10.0.18
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 +12 -0
- package/README.md +1 -1
- package/dist/crisp.d.ts +8 -2
- package/dist/crisp.js +15 -6
- package/dist/resources/PluginConnect.d.ts +4 -0
- package/dist/resources/WebsiteConversation.d.ts +6 -3
- package/lib/crisp.ts +18 -3
- package/lib/resources/PluginConnect.ts +5 -0
- package/lib/resources/WebsiteConversation.ts +8 -3
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
Changelog
|
|
2
2
|
=========
|
|
3
3
|
|
|
4
|
+
## v10.0.18
|
|
5
|
+
|
|
6
|
+
* Added the new `CrispClient.setCustomHeaders` method to set custom headers for all API requests.
|
|
7
|
+
|
|
8
|
+
## v10.0.17
|
|
9
|
+
|
|
10
|
+
* Add `stamped` to `ConversationMessage`.
|
|
11
|
+
|
|
12
|
+
## v10.0.16
|
|
13
|
+
|
|
14
|
+
* Harden types on `ConversationVerifyIdentityRequest` and `ConversationVerifyIdentityRedeem`.
|
|
15
|
+
|
|
4
16
|
## v10.0.15
|
|
5
17
|
|
|
6
18
|
### Changes
|
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ The Crisp API Node wrapper. Authenticate, send messages, fetch conversations, ac
|
|
|
6
6
|
|
|
7
7
|
Copyright 2025 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:
|
|
9
|
+
* **📝 Implements**: [REST API Reference (V1)](https://docs.crisp.chat/references/rest-api/v1/) at revision: 22/11/2025
|
|
10
10
|
* **😘 Maintainers**: [@baptistejamin](https://github.com/baptistejamin), [@eliottvincent](https://github.com/eliottvincent), [@valeriansaliou](https://github.com/valeriansaliou)
|
|
11
11
|
|
|
12
12
|
## Installation
|
package/dist/crisp.d.ts
CHANGED
|
@@ -22,9 +22,9 @@ interface CrispAuth {
|
|
|
22
22
|
* CLASSES
|
|
23
23
|
***************************************************************************/
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
25
|
+
* Crisp
|
|
26
26
|
*/
|
|
27
|
-
|
|
27
|
+
declare class Crisp {
|
|
28
28
|
bucket: BucketServiceInterface;
|
|
29
29
|
media: MediaServiceInterface;
|
|
30
30
|
plugin: PluginServiceInterface;
|
|
@@ -46,6 +46,7 @@ export declare class Crisp {
|
|
|
46
46
|
mode: RTM_MODES;
|
|
47
47
|
};
|
|
48
48
|
protected _useragent: string;
|
|
49
|
+
protected _customHeaders: Record<string, string>;
|
|
49
50
|
protected _emitter: Emitter<Record<import("mitt").EventType, unknown>>;
|
|
50
51
|
protected _socket: Socket | null;
|
|
51
52
|
protected _loopback: Emitter<Record<string, unknown>> | null;
|
|
@@ -69,6 +70,10 @@ export declare class Crisp {
|
|
|
69
70
|
* Sets the RTM channel mode (ie. WebSockets or Web Hooks)
|
|
70
71
|
*/
|
|
71
72
|
setRtmMode(mode: "websockets" | "webhooks"): void;
|
|
73
|
+
/**
|
|
74
|
+
* Sets custom headers to be included in all API requests
|
|
75
|
+
*/
|
|
76
|
+
setCustomHeaders(headers: Record<string, string>): void;
|
|
72
77
|
/**
|
|
73
78
|
* Sets the authentication tier
|
|
74
79
|
*/
|
|
@@ -176,4 +181,5 @@ export declare class Crisp {
|
|
|
176
181
|
* EXPORTS
|
|
177
182
|
***************************************************************************/
|
|
178
183
|
export * from "./resources";
|
|
184
|
+
export { Crisp };
|
|
179
185
|
export default Crisp;
|
package/dist/crisp.js
CHANGED
|
@@ -45,7 +45,7 @@ const AVAILABLE_RTM_MODES = [
|
|
|
45
45
|
"websockets",
|
|
46
46
|
"webhooks"
|
|
47
47
|
];
|
|
48
|
-
const VERSION = "10.0.
|
|
48
|
+
const VERSION = "10.0.18";
|
|
49
49
|
// Base configuration
|
|
50
50
|
const DEFAULT_REQUEST_TIMEOUT = 10000;
|
|
51
51
|
const DEFAULT_SOCKET_TIMEOUT = 10000;
|
|
@@ -167,7 +167,7 @@ const services = {
|
|
|
167
167
|
* CLASSES
|
|
168
168
|
***************************************************************************/
|
|
169
169
|
/**
|
|
170
|
-
*
|
|
170
|
+
* Crisp
|
|
171
171
|
*/
|
|
172
172
|
class Crisp {
|
|
173
173
|
/**
|
|
@@ -193,6 +193,7 @@ class Crisp {
|
|
|
193
193
|
mode: DEFAULT_RTM_MODE
|
|
194
194
|
};
|
|
195
195
|
this._useragent = (DEFAULT_USERAGENT_PREFIX + VERSION);
|
|
196
|
+
this._customHeaders = {};
|
|
196
197
|
this._emitter = (0, mitt_1.default)();
|
|
197
198
|
this._socket = null;
|
|
198
199
|
this._loopback = null;
|
|
@@ -237,6 +238,17 @@ class Crisp {
|
|
|
237
238
|
AVAILABLE_RTM_MODES.join(", "));
|
|
238
239
|
}
|
|
239
240
|
}
|
|
241
|
+
/**
|
|
242
|
+
* Sets custom headers to be included in all API requests
|
|
243
|
+
*/
|
|
244
|
+
setCustomHeaders(headers) {
|
|
245
|
+
if (typeof headers === "object" && headers !== null) {
|
|
246
|
+
this._customHeaders = headers;
|
|
247
|
+
}
|
|
248
|
+
else {
|
|
249
|
+
throw new Error("[Crisp] setCustomHeaders: parameter headers should be an object");
|
|
250
|
+
}
|
|
251
|
+
}
|
|
240
252
|
/**
|
|
241
253
|
* Sets the authentication tier
|
|
242
254
|
*/
|
|
@@ -658,10 +670,7 @@ class Crisp {
|
|
|
658
670
|
let requestParameters = {
|
|
659
671
|
responseType: "json",
|
|
660
672
|
timeout: DEFAULT_REQUEST_TIMEOUT,
|
|
661
|
-
headers: {
|
|
662
|
-
"User-Agent": this._useragent,
|
|
663
|
-
"X-Crisp-Tier": this.auth.tier
|
|
664
|
-
},
|
|
673
|
+
headers: Object.assign({ "User-Agent": this._useragent, "X-Crisp-Tier": this.auth.tier }, this._customHeaders),
|
|
665
674
|
throwHttpErrors: false
|
|
666
675
|
};
|
|
667
676
|
// Add authorization?
|
|
@@ -21,10 +21,14 @@ export type PluginConnectWebsitesSince = {
|
|
|
21
21
|
};
|
|
22
22
|
export type PluginConnectEndpoints = {
|
|
23
23
|
socket?: PluginConnectEndpointsSocket;
|
|
24
|
+
rescue?: PluginConnectEndpointsRescue;
|
|
24
25
|
};
|
|
25
26
|
export type PluginConnectEndpointsSocket = {
|
|
26
27
|
app?: string;
|
|
27
28
|
};
|
|
29
|
+
export type PluginConnectEndpointsRescue = {
|
|
30
|
+
socket?: PluginConnectEndpointsSocket;
|
|
31
|
+
};
|
|
28
32
|
/**************************************************************************
|
|
29
33
|
* CLASSES
|
|
30
34
|
***************************************************************************/
|
|
@@ -153,6 +153,7 @@ export interface ConversationMessage {
|
|
|
153
153
|
edited?: boolean;
|
|
154
154
|
translated?: boolean;
|
|
155
155
|
automated?: boolean;
|
|
156
|
+
stamped?: boolean;
|
|
156
157
|
fingerprint?: number;
|
|
157
158
|
timestamp?: number;
|
|
158
159
|
user?: ConversationMessageUser;
|
|
@@ -375,13 +376,15 @@ export interface ConversationVerify {
|
|
|
375
376
|
verified?: boolean;
|
|
376
377
|
verifications?: ConversationVerification[];
|
|
377
378
|
}
|
|
379
|
+
export type ConversationVerifyIdentity = "email" | "phone" | `urn:${string}`;
|
|
380
|
+
export type ConversationVerifyMethod = "link";
|
|
378
381
|
export interface ConversationVerifyIdentityRequest {
|
|
379
|
-
identity?:
|
|
380
|
-
method?:
|
|
382
|
+
identity?: ConversationVerifyIdentity;
|
|
383
|
+
method?: ConversationVerifyMethod;
|
|
381
384
|
recipient?: string;
|
|
382
385
|
}
|
|
383
386
|
export interface ConversationVerifyIdentityRedeem {
|
|
384
|
-
identity?:
|
|
387
|
+
identity?: ConversationVerifyIdentity;
|
|
385
388
|
token?: string;
|
|
386
389
|
recipient?: string;
|
|
387
390
|
}
|
package/lib/crisp.ts
CHANGED
|
@@ -194,9 +194,9 @@ interface CrispAuth {
|
|
|
194
194
|
***************************************************************************/
|
|
195
195
|
|
|
196
196
|
/**
|
|
197
|
-
*
|
|
197
|
+
* Crisp
|
|
198
198
|
*/
|
|
199
|
-
|
|
199
|
+
class Crisp {
|
|
200
200
|
public bucket: BucketServiceInterface = (
|
|
201
201
|
new Bucket() as unknown as BucketServiceInterface
|
|
202
202
|
);
|
|
@@ -240,6 +240,8 @@ export class Crisp {
|
|
|
240
240
|
|
|
241
241
|
protected _useragent = (DEFAULT_USERAGENT_PREFIX + VERSION);
|
|
242
242
|
|
|
243
|
+
protected _customHeaders: Record<string, string> = {};
|
|
244
|
+
|
|
243
245
|
protected _emitter = mitt();
|
|
244
246
|
|
|
245
247
|
protected _socket: Socket | null = null;
|
|
@@ -297,6 +299,17 @@ export class Crisp {
|
|
|
297
299
|
}
|
|
298
300
|
}
|
|
299
301
|
|
|
302
|
+
/**
|
|
303
|
+
* Sets custom headers to be included in all API requests
|
|
304
|
+
*/
|
|
305
|
+
setCustomHeaders(headers: Record<string, string>) {
|
|
306
|
+
if (typeof headers === "object" && headers !== null) {
|
|
307
|
+
this._customHeaders = headers;
|
|
308
|
+
} else {
|
|
309
|
+
throw new Error("[Crisp] setCustomHeaders: parameter headers should be an object");
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
300
313
|
/**
|
|
301
314
|
* Sets the authentication tier
|
|
302
315
|
*/
|
|
@@ -866,7 +879,8 @@ export class Crisp {
|
|
|
866
879
|
|
|
867
880
|
headers: {
|
|
868
881
|
"User-Agent": this._useragent,
|
|
869
|
-
"X-Crisp-Tier": this.auth.tier
|
|
882
|
+
"X-Crisp-Tier": this.auth.tier,
|
|
883
|
+
...this._customHeaders
|
|
870
884
|
},
|
|
871
885
|
|
|
872
886
|
throwHttpErrors: false
|
|
@@ -1003,4 +1017,5 @@ export class Crisp {
|
|
|
1003
1017
|
***************************************************************************/
|
|
1004
1018
|
|
|
1005
1019
|
export * from "@/resources";
|
|
1020
|
+
export { Crisp };
|
|
1006
1021
|
export default Crisp;
|
|
@@ -35,12 +35,17 @@ export type PluginConnectWebsitesSince = {
|
|
|
35
35
|
|
|
36
36
|
export type PluginConnectEndpoints = {
|
|
37
37
|
socket?: PluginConnectEndpointsSocket;
|
|
38
|
+
rescue?: PluginConnectEndpointsRescue;
|
|
38
39
|
}
|
|
39
40
|
|
|
40
41
|
export type PluginConnectEndpointsSocket = {
|
|
41
42
|
app?: string;
|
|
42
43
|
}
|
|
43
44
|
|
|
45
|
+
export type PluginConnectEndpointsRescue = {
|
|
46
|
+
socket?: PluginConnectEndpointsSocket;
|
|
47
|
+
}
|
|
48
|
+
|
|
44
49
|
/**************************************************************************
|
|
45
50
|
* CLASSES
|
|
46
51
|
***************************************************************************/
|
|
@@ -207,6 +207,7 @@ export interface ConversationMessage {
|
|
|
207
207
|
edited?: boolean;
|
|
208
208
|
translated?: boolean;
|
|
209
209
|
automated?: boolean;
|
|
210
|
+
stamped?: boolean;
|
|
210
211
|
fingerprint?: number;
|
|
211
212
|
timestamp?: number;
|
|
212
213
|
user?: ConversationMessageUser;
|
|
@@ -484,14 +485,18 @@ export interface ConversationVerify {
|
|
|
484
485
|
verifications?: ConversationVerification[];
|
|
485
486
|
}
|
|
486
487
|
|
|
488
|
+
export type ConversationVerifyIdentity = "email" | "phone" | `urn:${string}`;
|
|
489
|
+
|
|
490
|
+
export type ConversationVerifyMethod = "link";
|
|
491
|
+
|
|
487
492
|
export interface ConversationVerifyIdentityRequest {
|
|
488
|
-
identity?:
|
|
489
|
-
method?:
|
|
493
|
+
identity?: ConversationVerifyIdentity;
|
|
494
|
+
method?: ConversationVerifyMethod;
|
|
490
495
|
recipient?: string;
|
|
491
496
|
}
|
|
492
497
|
|
|
493
498
|
export interface ConversationVerifyIdentityRedeem {
|
|
494
|
-
identity?:
|
|
499
|
+
identity?: ConversationVerifyIdentity;
|
|
495
500
|
token?: string;
|
|
496
501
|
recipient?: string;
|
|
497
502
|
}
|
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": "10.0.
|
|
4
|
+
"version": "10.0.18",
|
|
5
5
|
"homepage": "https://github.com/crisp-im/node-crisp-api",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": {
|
|
@@ -53,9 +53,9 @@
|
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@typescript-eslint/eslint-plugin": "8.39.1",
|
|
55
55
|
"tsc-alias": "1.8.16",
|
|
56
|
-
"typescript": "5.9.
|
|
56
|
+
"typescript": "5.9.3",
|
|
57
57
|
"eslint": "9.29.0",
|
|
58
|
-
"eslint-plugin-crisp": "1.
|
|
58
|
+
"eslint-plugin-crisp": "1.2.12",
|
|
59
59
|
"eslint-plugin-jsdoc": "50.8.0",
|
|
60
60
|
"globals": "15.15.0"
|
|
61
61
|
},
|