crisp-api 10.8.2 → 10.8.4

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/README.md CHANGED
@@ -680,7 +680,7 @@ All methods that you will most likely need when building a Crisp integration are
680
680
  </details>
681
681
 
682
682
  * **⭐ Change Conversation State** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#change-conversation-state)
683
- * `CrispClient.website.changeConversationState(websiteID, sessionID, state)`
683
+ * `CrispClient.website.changeConversationState(websiteID, sessionID, state, user, origin)`
684
684
  * <details>
685
685
  <summary>See Example</summary>
686
686
 
@@ -756,7 +756,7 @@ All methods that you will most likely need when building a Crisp integration are
756
756
  </details>
757
757
 
758
758
  * **Block Incoming Messages For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#block-incoming-messages-for-conversation)
759
- * `CrispClient.website.blockIncomingMessagesForConversation(websiteID, sessionID, blocked)`
759
+ * `CrispClient.website.blockIncomingMessagesForConversation(websiteID, sessionID, blocked, user, origin)`
760
760
  * <details>
761
761
  <summary>See Example</summary>
762
762
 
@@ -942,7 +942,7 @@ All methods that you will most likely need when building a Crisp integration are
942
942
  </details>
943
943
 
944
944
  * **Initiate New Call Session For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#initiate-new-call-session-for-conversation)
945
- * `CrispClient.website.initiateNewCallSessionForConversation(websiteID, sessionID, mode)`
945
+ * `CrispClient.website.initiateNewCallSessionForConversation(websiteID, sessionID, mode, user, origin)`
946
946
  * <details>
947
947
  <summary>See Example</summary>
948
948
 
@@ -970,7 +970,7 @@ All methods that you will most likely need when building a Crisp integration are
970
970
  </details>
971
971
 
972
972
  * **Abort Ongoing Call Session For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#abort-ongoing-call-session-for-conversation)
973
- * `CrispClient.website.abortOngoingCallSessionForConversation(websiteID, sessionID, callID)`
973
+ * `CrispClient.website.abortOngoingCallSessionForConversation(websiteID, sessionID, callID, user, origin)`
974
974
  * <details>
975
975
  <summary>See Example</summary>
976
976
 
@@ -1073,7 +1073,7 @@ All methods that you will most likely need when building a Crisp integration are
1073
1073
  </details>
1074
1074
 
1075
1075
  * **Schedule A Reminder For Conversation** [`user`, `plugin`]: [Reference](https://docs.crisp.chat/references/rest-api/v1/#schedule-a-reminder-for-conversation)
1076
- * `CrispClient.website.scheduleReminderForConversation(websiteID, sessionID, date, note)`
1076
+ * `CrispClient.website.scheduleReminderForConversation(websiteID, sessionID, date, note, user, origin)`
1077
1077
  * <details>
1078
1078
  <summary>See Example</summary>
1079
1079
 
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.8.2";
49
+ const VERSION = "10.8.4";
50
50
  // Base configuration
51
51
  const DEFAULT_REQUEST_TIMEOUT = 10000;
52
52
  const DEFAULT_SOCKET_TIMEOUT = 10000;
@@ -87,6 +87,8 @@ export interface ConversationParticipants {
87
87
  }
88
88
  export interface ConversationParticipantsSave {
89
89
  participants?: ConversationParticipant[];
90
+ user?: ConversationMessageUser;
91
+ origin?: string;
90
92
  }
91
93
  export interface ConversationMeta {
92
94
  nickname?: string;
@@ -585,7 +587,7 @@ declare class WebsiteConversation extends BaseResource {
585
587
  /**
586
588
  * Change Conversation State
587
589
  */
588
- changeConversationState(websiteID: string, sessionID: string, state: ConversationState): Promise<any>;
590
+ changeConversationState(websiteID: string, sessionID: string, state: ConversationState, user?: ConversationMessageUser, origin?: string): Promise<any>;
589
591
  /**
590
592
  * Get Conversation Relations
591
593
  */
@@ -605,7 +607,7 @@ declare class WebsiteConversation extends BaseResource {
605
607
  /**
606
608
  * Block Incoming Messages For Conversation
607
609
  */
608
- blockIncomingMessagesForConversation(websiteID: string, sessionID: string, blocked: boolean): Promise<any>;
610
+ blockIncomingMessagesForConversation(websiteID: string, sessionID: string, blocked: boolean, user?: ConversationMessageUser, origin?: string): Promise<any>;
609
611
  /**
610
612
  * Get Verify Status For Conversation
611
613
  */
@@ -653,7 +655,7 @@ declare class WebsiteConversation extends BaseResource {
653
655
  /**
654
656
  * Initiate New Call Session For Conversation
655
657
  */
656
- initiateNewCallSessionForConversation(websiteID: string, sessionID: string, mode: string): Promise<any>;
658
+ initiateNewCallSessionForConversation(websiteID: string, sessionID: string, mode: string, user?: ConversationMessageUser, origin?: string): Promise<any>;
657
659
  /**
658
660
  * Get Ongoing Call Session For Conversation
659
661
  */
@@ -661,7 +663,7 @@ declare class WebsiteConversation extends BaseResource {
661
663
  /**
662
664
  * Abort Ongoing Call Session For Conversation
663
665
  */
664
- abortOngoingCallSessionForConversation(websiteID: string, sessionID: string, callID: string): Promise<any>;
666
+ abortOngoingCallSessionForConversation(websiteID: string, sessionID: string, callID: string, user?: ConversationMessageUser, origin?: string): Promise<any>;
665
667
  /**
666
668
  * Transmit Signaling On Ongoing Call Session
667
669
  */
@@ -681,7 +683,7 @@ declare class WebsiteConversation extends BaseResource {
681
683
  /**
682
684
  * Schedule A Reminder For Conversation
683
685
  */
684
- scheduleReminderForConversation(websiteID: string, sessionID: string, date: string, note: string): Promise<any>;
686
+ scheduleReminderForConversation(websiteID: string, sessionID: string, date: string, note: string, user?: ConversationMessageUser, origin?: string): Promise<any>;
685
687
  /**
686
688
  * Report Conversation
687
689
  */
@@ -334,12 +334,19 @@ class WebsiteConversation extends BaseResource_1.default {
334
334
  /**
335
335
  * Change Conversation State
336
336
  */
337
- changeConversationState(websiteID, sessionID, state) {
337
+ changeConversationState(websiteID, sessionID, state, user, origin) {
338
+ // Generate body
339
+ let body = {
340
+ state: state,
341
+ user: user
342
+ };
343
+ if (origin) {
344
+ // @ts-ignore
345
+ body.origin = origin;
346
+ }
338
347
  return this.crisp.patch(this.crisp.prepareRestUrl([
339
348
  "website", websiteID, "conversation", sessionID, "state"
340
- ]), null, {
341
- state: state
342
- });
349
+ ]), null, body);
343
350
  }
344
351
  ;
345
352
  /**
@@ -381,12 +388,19 @@ class WebsiteConversation extends BaseResource_1.default {
381
388
  /**
382
389
  * Block Incoming Messages For Conversation
383
390
  */
384
- blockIncomingMessagesForConversation(websiteID, sessionID, blocked) {
391
+ blockIncomingMessagesForConversation(websiteID, sessionID, blocked, user, origin) {
392
+ // Generate body
393
+ let body = {
394
+ blocked: (blocked || false),
395
+ user: user
396
+ };
397
+ if (origin) {
398
+ // @ts-ignore
399
+ body.origin = origin;
400
+ }
385
401
  return this.crisp.patch(this.crisp.prepareRestUrl([
386
402
  "website", websiteID, "conversation", sessionID, "block"
387
- ]), null, {
388
- blocked: (blocked || false)
389
- });
403
+ ]), null, body);
390
404
  }
391
405
  ;
392
406
  /**
@@ -505,12 +519,19 @@ class WebsiteConversation extends BaseResource_1.default {
505
519
  /**
506
520
  * Initiate New Call Session For Conversation
507
521
  */
508
- initiateNewCallSessionForConversation(websiteID, sessionID, mode) {
522
+ initiateNewCallSessionForConversation(websiteID, sessionID, mode, user, origin) {
523
+ // Generate body
524
+ let body = {
525
+ mode: (mode || "audio"),
526
+ user: user
527
+ };
528
+ if (origin) {
529
+ // @ts-ignore
530
+ body.origin = origin;
531
+ }
509
532
  return this.crisp.post(this.crisp.prepareRestUrl([
510
533
  "website", websiteID, "conversation", sessionID, "call"
511
- ]), null, {
512
- mode: (mode || "audio")
513
- });
534
+ ]), null, body);
514
535
  }
515
536
  ;
516
537
  /**
@@ -525,10 +546,18 @@ class WebsiteConversation extends BaseResource_1.default {
525
546
  /**
526
547
  * Abort Ongoing Call Session For Conversation
527
548
  */
528
- abortOngoingCallSessionForConversation(websiteID, sessionID, callID) {
549
+ abortOngoingCallSessionForConversation(websiteID, sessionID, callID, user, origin) {
550
+ // Generate body
551
+ let body = {
552
+ user: user
553
+ };
554
+ if (origin) {
555
+ // @ts-ignore
556
+ body.origin = origin;
557
+ }
529
558
  return this.crisp.delete(this.crisp.prepareRestUrl([
530
559
  "website", websiteID, "conversation", sessionID, "call", callID
531
- ]));
560
+ ]), null, body);
532
561
  }
533
562
  ;
534
563
  /**
@@ -591,13 +620,20 @@ class WebsiteConversation extends BaseResource_1.default {
591
620
  /**
592
621
  * Schedule A Reminder For Conversation
593
622
  */
594
- scheduleReminderForConversation(websiteID, sessionID, date, note) {
623
+ scheduleReminderForConversation(websiteID, sessionID, date, note, user, origin) {
624
+ // Generate body
625
+ let body = {
626
+ date: date,
627
+ note: note,
628
+ user: user
629
+ };
630
+ if (origin) {
631
+ // @ts-ignore
632
+ body.origin = origin;
633
+ }
595
634
  return this.crisp.post(this.crisp.prepareRestUrl([
596
635
  "website", websiteID, "conversation", sessionID, "reminder"
597
- ]), null, {
598
- date: date,
599
- note: note
600
- });
636
+ ]), null, body);
601
637
  }
602
638
  ;
603
639
  /**
@@ -112,6 +112,8 @@ export interface ConversationParticipants {
112
112
 
113
113
  export interface ConversationParticipantsSave {
114
114
  participants?: ConversationParticipant[];
115
+ user?: ConversationMessageUser;
116
+ origin?: string;
115
117
  }
116
118
 
117
119
  export interface ConversationMeta {
@@ -1057,18 +1059,26 @@ class WebsiteConversation extends BaseResource {
1057
1059
  * Change Conversation State
1058
1060
  */
1059
1061
  changeConversationState(
1060
- websiteID: string, sessionID: string, state: ConversationState
1062
+ websiteID: string, sessionID: string, state: ConversationState,
1063
+ user?: ConversationMessageUser, origin?: string
1061
1064
  ) {
1065
+ // Generate body
1066
+ let body = {
1067
+ state: state,
1068
+ user: user
1069
+ };
1070
+
1071
+ if (origin) {
1072
+ // @ts-ignore
1073
+ body.origin = origin;
1074
+ }
1075
+
1062
1076
  return this.crisp.patch(
1063
1077
  this.crisp.prepareRestUrl([
1064
1078
  "website", websiteID, "conversation", sessionID, "state"
1065
1079
  ]),
1066
1080
 
1067
- null,
1068
-
1069
- {
1070
- state: state
1071
- }
1081
+ null, body
1072
1082
  );
1073
1083
  };
1074
1084
 
@@ -1130,18 +1140,26 @@ class WebsiteConversation extends BaseResource {
1130
1140
  * Block Incoming Messages For Conversation
1131
1141
  */
1132
1142
  blockIncomingMessagesForConversation(
1133
- websiteID: string, sessionID: string, blocked: boolean
1143
+ websiteID: string, sessionID: string, blocked: boolean,
1144
+ user?: ConversationMessageUser, origin?: string
1134
1145
  ) {
1146
+ // Generate body
1147
+ let body = {
1148
+ blocked: (blocked || false),
1149
+ user: user
1150
+ };
1151
+
1152
+ if (origin) {
1153
+ // @ts-ignore
1154
+ body.origin = origin;
1155
+ }
1156
+
1135
1157
  return this.crisp.patch(
1136
1158
  this.crisp.prepareRestUrl([
1137
1159
  "website", websiteID, "conversation", sessionID, "block"
1138
1160
  ]),
1139
1161
 
1140
- null,
1141
-
1142
- {
1143
- blocked: (blocked || false)
1144
- }
1162
+ null, body
1145
1163
  );
1146
1164
  };
1147
1165
 
@@ -1334,18 +1352,26 @@ class WebsiteConversation extends BaseResource {
1334
1352
  * Initiate New Call Session For Conversation
1335
1353
  */
1336
1354
  initiateNewCallSessionForConversation(
1337
- websiteID: string, sessionID: string, mode: string
1355
+ websiteID: string, sessionID: string, mode: string,
1356
+ user?: ConversationMessageUser, origin?: string
1338
1357
  ) {
1358
+ // Generate body
1359
+ let body = {
1360
+ mode: (mode || "audio"),
1361
+ user: user
1362
+ };
1363
+
1364
+ if (origin) {
1365
+ // @ts-ignore
1366
+ body.origin = origin;
1367
+ }
1368
+
1339
1369
  return this.crisp.post(
1340
1370
  this.crisp.prepareRestUrl([
1341
1371
  "website", websiteID, "conversation", sessionID, "call"
1342
1372
  ]),
1343
1373
 
1344
- null,
1345
-
1346
- {
1347
- mode: (mode || "audio")
1348
- }
1374
+ null, body
1349
1375
  );
1350
1376
  };
1351
1377
 
@@ -1366,12 +1392,25 @@ class WebsiteConversation extends BaseResource {
1366
1392
  * Abort Ongoing Call Session For Conversation
1367
1393
  */
1368
1394
  abortOngoingCallSessionForConversation(
1369
- websiteID: string, sessionID: string, callID: string
1395
+ websiteID: string, sessionID: string, callID: string,
1396
+ user?: ConversationMessageUser, origin?: string
1370
1397
  ) {
1398
+ // Generate body
1399
+ let body = {
1400
+ user: user
1401
+ };
1402
+
1403
+ if (origin) {
1404
+ // @ts-ignore
1405
+ body.origin = origin;
1406
+ }
1407
+
1371
1408
  return this.crisp.delete(
1372
1409
  this.crisp.prepareRestUrl([
1373
1410
  "website", websiteID, "conversation", sessionID, "call", callID
1374
- ])
1411
+ ]),
1412
+
1413
+ null, body
1375
1414
  );
1376
1415
  };
1377
1416
 
@@ -1469,19 +1508,27 @@ class WebsiteConversation extends BaseResource {
1469
1508
  * Schedule A Reminder For Conversation
1470
1509
  */
1471
1510
  scheduleReminderForConversation(
1472
- websiteID: string, sessionID: string, date: string, note: string
1511
+ websiteID: string, sessionID: string, date: string, note: string,
1512
+ user?: ConversationMessageUser, origin?: string
1473
1513
  ) {
1514
+ // Generate body
1515
+ let body = {
1516
+ date: date,
1517
+ note: note,
1518
+ user: user
1519
+ };
1520
+
1521
+ if (origin) {
1522
+ // @ts-ignore
1523
+ body.origin = origin;
1524
+ }
1525
+
1474
1526
  return this.crisp.post(
1475
1527
  this.crisp.prepareRestUrl([
1476
1528
  "website", websiteID, "conversation", sessionID, "reminder"
1477
1529
  ]),
1478
1530
 
1479
- null,
1480
-
1481
- {
1482
- date: date,
1483
- note: note
1484
- }
1531
+ null, body
1485
1532
  );
1486
1533
  };
1487
1534
 
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.8.2",
4
+ "version": "10.8.4",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {