crisp-api 10.10.2 → 10.10.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/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  Changelog
2
2
  =========
3
3
 
4
+ ## v10.10.4
5
+
6
+ ### Changes
7
+
8
+ * Added `timestampAfter` and `timestampAround` parameters on `CrispClient.website.getMessagesInConversation` method.
9
+
10
+ ## v10.10.3
11
+
12
+ ### Changes
13
+
14
+ * Added types for new `verified` and `institutional` field on `Website` payload.
15
+
4
16
  ## v10.10.2
5
17
 
6
18
  ### Changes
package/EXAMPLES.md CHANGED
@@ -122,6 +122,8 @@ https://docs.crisp.chat/references/rest-api/v1/#get-messages-in-conversation
122
122
 
123
123
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
124
124
  var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
125
+
126
+ // Either 'timestampBefore', 'timestampAfter' or 'timestampAround'
125
127
  var timestampBefore = 1641206011000;
126
128
 
127
129
  CrispClient.website.getMessagesInConversation(websiteID, sessionID, timestampBefore);
package/README.md CHANGED
@@ -356,13 +356,15 @@ All methods that you will most likely need when building a Crisp integration are
356
356
  </details>
357
357
 
358
358
  * **⭐ Get Messages In Conversation**: [Reference](https://docs.crisp.chat/references/rest-api/v1/#get-messages-in-conversation)
359
- * `CrispClient.website.getMessagesInConversation(websiteID, sessionID, timestampBefore)`
359
+ * `CrispClient.website.getMessagesInConversation(websiteID, sessionID, timestampBefore, timestampAfter, timestampAround)`
360
360
  * <details>
361
361
  <summary>See Example</summary>
362
362
 
363
363
  ```javascript
364
364
  var websiteID = "8c842203-7ed8-4e29-a608-7cf78a7d2fcc";
365
365
  var sessionID = "session_700c65e1-85e2-465a-b9ac-ecb5ec2c9881";
366
+
367
+ // Either 'timestampBefore', 'timestampAfter' or 'timestampAround'
366
368
  var timestampBefore = 1641206011000;
367
369
 
368
370
  CrispClient.website.getMessagesInConversation(websiteID, sessionID, timestampBefore);
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.10.2";
49
+ const VERSION = "10.10.4";
50
50
  // Base configuration
51
51
  const DEFAULT_REQUEST_TIMEOUT = 10000;
52
52
  const DEFAULT_SOCKET_TIMEOUT = 10000;
@@ -10,6 +10,8 @@ export type Website = {
10
10
  name?: string;
11
11
  domain?: string;
12
12
  logo?: string;
13
+ verified?: boolean;
14
+ institutional?: boolean;
13
15
  };
14
16
  export type WebsiteCreate = {
15
17
  name?: string;
@@ -507,7 +507,7 @@ declare class WebsiteConversation extends BaseResource {
507
507
  /**
508
508
  * Get Messages In Conversation
509
509
  */
510
- getMessagesInConversation(websiteID: string, sessionID: string, timestampBefore?: string | number): Promise<ConversationMessage[]>;
510
+ getMessagesInConversation(websiteID: string, sessionID: string, timestampBefore?: string | number, timestampAfter?: string | number, timestampAround?: string | number): Promise<ConversationMessage[]>;
511
511
  /**
512
512
  * Send A Message In Conversation
513
513
  */
@@ -146,13 +146,21 @@ class WebsiteConversation extends BaseResource_1.default {
146
146
  /**
147
147
  * Get Messages In Conversation
148
148
  */
149
- getMessagesInConversation(websiteID, sessionID, timestampBefore) {
149
+ getMessagesInConversation(websiteID, sessionID, timestampBefore, timestampAfter, timestampAround) {
150
150
  // Generate query
151
151
  let query = {};
152
152
  if (timestampBefore) {
153
153
  // @ts-ignore
154
154
  query.timestamp_before = String(timestampBefore);
155
155
  }
156
+ if (timestampAfter) {
157
+ // @ts-ignore
158
+ query.timestamp_after = String(timestampAfter);
159
+ }
160
+ if (timestampAround) {
161
+ // @ts-ignore
162
+ query.timestamp_around = String(timestampAround);
163
+ }
156
164
  return this.crisp.get(this.crisp.prepareRestUrl([
157
165
  "website", websiteID, "conversation", sessionID, "messages"
158
166
  ]), query);
@@ -21,6 +21,8 @@ export type Website = {
21
21
  name?: string;
22
22
  domain?: string;
23
23
  logo?: string;
24
+ verified?: boolean;
25
+ institutional?: boolean;
24
26
  }
25
27
 
26
28
  export type WebsiteCreate = {
@@ -759,7 +759,8 @@ class WebsiteConversation extends BaseResource {
759
759
  * Get Messages In Conversation
760
760
  */
761
761
  getMessagesInConversation(
762
- websiteID: string, sessionID: string, timestampBefore?: string|number
762
+ websiteID: string, sessionID: string, timestampBefore?: string|number,
763
+ timestampAfter?: string|number, timestampAround?: string|number
763
764
  ): Promise<ConversationMessage[]> {
764
765
  // Generate query
765
766
  let query = {};
@@ -769,6 +770,16 @@ class WebsiteConversation extends BaseResource {
769
770
  query.timestamp_before = String(timestampBefore);
770
771
  }
771
772
 
773
+ if (timestampAfter) {
774
+ // @ts-ignore
775
+ query.timestamp_after = String(timestampAfter);
776
+ }
777
+
778
+ if (timestampAround) {
779
+ // @ts-ignore
780
+ query.timestamp_around = String(timestampAround);
781
+ }
782
+
772
783
  return this.crisp.get(
773
784
  this.crisp.prepareRestUrl([
774
785
  "website", websiteID, "conversation", sessionID, "messages"
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.10.2",
4
+ "version": "10.10.4",
5
5
  "homepage": "https://github.com/crisp-im/node-crisp-api",
6
6
  "license": "MIT",
7
7
  "author": {