@linqapp/sdk 0.24.2 → 0.26.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 +2 -506
- package/client.d.mts +165 -87
- package/client.d.mts.map +1 -1
- package/client.d.ts +165 -87
- package/client.d.ts.map +1 -1
- package/client.js +162 -84
- package/client.js.map +1 -1
- package/client.mjs +162 -84
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/chats/chats.d.mts +67 -63
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +67 -63
- package/resources/chats/chats.d.ts.map +1 -1
- package/resources/chats/chats.js +63 -59
- package/resources/chats/chats.js.map +1 -1
- package/resources/chats/chats.mjs +63 -59
- package/resources/chats/chats.mjs.map +1 -1
- package/resources/chats/index.d.mts +3 -2
- package/resources/chats/index.d.mts.map +1 -1
- package/resources/chats/index.d.ts +3 -2
- package/resources/chats/index.d.ts.map +1 -1
- package/resources/chats/index.js +3 -1
- package/resources/chats/index.js.map +1 -1
- package/resources/chats/index.mjs +1 -0
- package/resources/chats/index.mjs.map +1 -1
- package/resources/chats/location.d.mts +107 -0
- package/resources/chats/location.d.mts.map +1 -0
- package/resources/chats/location.d.ts +107 -0
- package/resources/chats/location.d.ts.map +1 -0
- package/resources/chats/location.js +68 -0
- package/resources/chats/location.js.map +1 -0
- package/resources/chats/location.mjs +64 -0
- package/resources/chats/location.mjs.map +1 -0
- package/resources/chats/messages.d.mts +17 -17
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +17 -17
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/chats/messages.js +16 -16
- package/resources/chats/messages.js.map +1 -1
- package/resources/chats/messages.mjs +16 -16
- package/resources/chats/messages.mjs.map +1 -1
- package/resources/contact-card.d.mts +18 -18
- package/resources/contact-card.d.mts.map +1 -1
- package/resources/contact-card.d.ts +18 -18
- package/resources/contact-card.d.ts.map +1 -1
- package/resources/contact-card.js +12 -12
- package/resources/contact-card.js.map +1 -1
- package/resources/contact-card.mjs +12 -12
- package/resources/contact-card.mjs.map +1 -1
- package/resources/index.d.mts +3 -3
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -3
- package/resources/index.d.ts.map +1 -1
- package/resources/messages.d.mts +34 -34
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +34 -34
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +29 -29
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +29 -29
- package/resources/messages.mjs.map +1 -1
- package/resources/webhook-events.d.mts +83 -44
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +83 -44
- package/resources/webhook-events.d.ts.map +1 -1
- package/resources/webhook-events.js +81 -42
- package/resources/webhook-events.js.map +1 -1
- package/resources/webhook-events.mjs +81 -42
- package/resources/webhook-events.mjs.map +1 -1
- package/resources/webhook-subscriptions.d.mts +100 -55
- package/resources/webhook-subscriptions.d.mts.map +1 -1
- package/resources/webhook-subscriptions.d.ts +100 -55
- package/resources/webhook-subscriptions.d.ts.map +1 -1
- package/resources/webhook-subscriptions.js +103 -58
- package/resources/webhook-subscriptions.js.map +1 -1
- package/resources/webhook-subscriptions.mjs +103 -58
- package/resources/webhook-subscriptions.mjs.map +1 -1
- package/resources/webhooks.d.mts +4 -4
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +4 -4
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +166 -88
- package/src/resources/chats/chats.ts +88 -78
- package/src/resources/chats/index.ts +3 -2
- package/src/resources/chats/location.ts +138 -0
- package/src/resources/chats/messages.ts +28 -28
- package/src/resources/contact-card.ts +25 -25
- package/src/resources/index.ts +4 -4
- package/src/resources/messages.ts +46 -46
- package/src/resources/webhook-events.ts +85 -44
- package/src/resources/webhook-subscriptions.ts +103 -58
- package/src/resources/webhooks.ts +6 -4
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,MAAM,oBAAiB;AACnC,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,sBAAsB,EAAE,KAAK,4BAA4B,EAAE,WAAW,EAAE,8BAA2B;AAE5G,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,KAAK,MAAM,oBAAiB;AACnC,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,sBAAsB,EAAE,KAAK,4BAA4B,EAAE,WAAW,EAAE,8BAA2B;AAE5G,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAG7D;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,CAChB,SAAS,EAAE,MAAM,EACjB,KAAK,GAAE,+BAA+B,GAAG,IAAI,GAAG,SAAc,EAC9D,OAAO,CAAC,EAAE,cAAc,GACvB,WAAW,CAAC,8BAA8B,EAAE,OAAO,CAAC;IAOvD;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,OAAO,CAAC;IAI1E;;;;;;;;;;OAUG;IACH,MAAM,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GA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I,OAAO,EACvB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,wBAAwB,IAAI,wBAAwB,EACzD,KAAK,mBAAmB,IAAI,mBAAmB,GAChD,CAAC;CACH"}
|
package/resources/messages.js
CHANGED
|
@@ -28,35 +28,42 @@ const path_1 = require("../internal/utils/path.js");
|
|
|
28
28
|
*/
|
|
29
29
|
class Messages extends resource_1.APIResource {
|
|
30
30
|
/**
|
|
31
|
-
* Retrieve
|
|
32
|
-
*
|
|
31
|
+
* Retrieve all messages in a conversation thread. Given any message ID in the
|
|
32
|
+
* thread, returns the originator message and all replies in chronological order.
|
|
33
|
+
*
|
|
34
|
+
* If the message is not part of a thread, returns just that single message.
|
|
35
|
+
*
|
|
36
|
+
* Supports pagination and configurable ordering.
|
|
33
37
|
*
|
|
34
38
|
* @example
|
|
35
39
|
* ```ts
|
|
36
|
-
*
|
|
40
|
+
* // Automatically fetches more pages as needed.
|
|
41
|
+
* for await (const message of client.messages.listMessagesThread(
|
|
37
42
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
38
|
-
* )
|
|
43
|
+
* )) {
|
|
44
|
+
* // ...
|
|
45
|
+
* }
|
|
39
46
|
* ```
|
|
40
47
|
*/
|
|
41
|
-
|
|
42
|
-
return this._client.
|
|
48
|
+
listMessagesThread(messageID, query = {}, options) {
|
|
49
|
+
return this._client.getAPIList((0, path_1.path) `/v3/messages/${messageID}/thread`, (pagination_1.ListMessagesPagination), {
|
|
50
|
+
query,
|
|
51
|
+
...options,
|
|
52
|
+
});
|
|
43
53
|
}
|
|
44
54
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* **Note:** A message can be edited up to 5 times, and only within 15 minutes of
|
|
48
|
-
* when it was originally sent.
|
|
55
|
+
* Retrieve a specific message by its ID. This endpoint returns the full message
|
|
56
|
+
* details including text, attachments, reactions, and metadata.
|
|
49
57
|
*
|
|
50
58
|
* @example
|
|
51
59
|
* ```ts
|
|
52
|
-
* const message = await client.messages.
|
|
60
|
+
* const message = await client.messages.retrieve(
|
|
53
61
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
54
|
-
* { text: 'This is the edited message content' },
|
|
55
62
|
* );
|
|
56
63
|
* ```
|
|
57
64
|
*/
|
|
58
|
-
|
|
59
|
-
return this._client.
|
|
65
|
+
retrieve(messageID, options) {
|
|
66
|
+
return this._client.get((0, path_1.path) `/v3/messages/${messageID}`, options);
|
|
60
67
|
}
|
|
61
68
|
/**
|
|
62
69
|
* Deletes a message from the Linq API only. This does NOT unsend or remove the
|
|
@@ -101,28 +108,21 @@ class Messages extends resource_1.APIResource {
|
|
|
101
108
|
return this._client.post((0, path_1.path) `/v3/messages/${messageID}/reactions`, { body, ...options });
|
|
102
109
|
}
|
|
103
110
|
/**
|
|
104
|
-
*
|
|
105
|
-
* thread, returns the originator message and all replies in chronological order.
|
|
106
|
-
*
|
|
107
|
-
* If the message is not part of a thread, returns just that single message.
|
|
111
|
+
* Edit the text content of a specific part of a previously sent message.
|
|
108
112
|
*
|
|
109
|
-
*
|
|
113
|
+
* **Note:** A message can be edited up to 5 times, and only within 15 minutes of
|
|
114
|
+
* when it was originally sent.
|
|
110
115
|
*
|
|
111
116
|
* @example
|
|
112
117
|
* ```ts
|
|
113
|
-
*
|
|
114
|
-
* for await (const message of client.messages.listMessagesThread(
|
|
118
|
+
* const message = await client.messages.update(
|
|
115
119
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
116
|
-
*
|
|
117
|
-
*
|
|
118
|
-
* }
|
|
120
|
+
* { text: 'This is the edited message content' },
|
|
121
|
+
* );
|
|
119
122
|
* ```
|
|
120
123
|
*/
|
|
121
|
-
|
|
122
|
-
return this._client.
|
|
123
|
-
query,
|
|
124
|
-
...options,
|
|
125
|
-
});
|
|
124
|
+
update(messageID, body, options) {
|
|
125
|
+
return this._client.patch((0, path_1.path) `/v3/messages/${messageID}`, { body, ...options });
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
128
|
exports.Messages = Messages;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,sDAA4G;AAC5G,oDAAmD;AAEnD,oDAA8C;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC
|
|
1
|
+
{"version":3,"file":"messages.js","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,sDAA4G;AAC5G,oDAAmD;AAEnD,oDAA8C;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAa,QAAS,SAAQ,sBAAW;IACvC;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,CAChB,SAAiB,EACjB,QAA4D,EAAE,EAC9D,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,SAAS,EAAE,CAAA,mCAA+B,CAAA,EAAE;YACtG,KAAK;YACL,GAAG,OAAO;SACX,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,SAAiB,EAAE,OAAwB;QAClD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,EAAE,EAAE,OAAO,CAAC,CAAC;IACpE,CAAC;IAED;;;;;;;;;;OAUG;IACH,MAAM,CAAC,SAAiB,EAAE,OAAwB;QAChD,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,EAAE,EAAE;YAC1D,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,WAAW,CACT,SAAiB,EACjB,IAA8B,EAC9B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,YAAY,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC5F,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,SAAiB,EAAE,IAAyB,EAAE,OAAwB;QAC3E,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAA,WAAI,EAAA,gBAAgB,SAAS,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACnF,CAAC;CACF;AA9GD,4BA8GC"}
|
package/resources/messages.mjs
CHANGED
|
@@ -25,35 +25,42 @@ import { path } from "../internal/utils/path.mjs";
|
|
|
25
25
|
*/
|
|
26
26
|
export class Messages extends APIResource {
|
|
27
27
|
/**
|
|
28
|
-
* Retrieve
|
|
29
|
-
*
|
|
28
|
+
* Retrieve all messages in a conversation thread. Given any message ID in the
|
|
29
|
+
* thread, returns the originator message and all replies in chronological order.
|
|
30
|
+
*
|
|
31
|
+
* If the message is not part of a thread, returns just that single message.
|
|
32
|
+
*
|
|
33
|
+
* Supports pagination and configurable ordering.
|
|
30
34
|
*
|
|
31
35
|
* @example
|
|
32
36
|
* ```ts
|
|
33
|
-
*
|
|
37
|
+
* // Automatically fetches more pages as needed.
|
|
38
|
+
* for await (const message of client.messages.listMessagesThread(
|
|
34
39
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
35
|
-
* )
|
|
40
|
+
* )) {
|
|
41
|
+
* // ...
|
|
42
|
+
* }
|
|
36
43
|
* ```
|
|
37
44
|
*/
|
|
38
|
-
|
|
39
|
-
return this._client.
|
|
45
|
+
listMessagesThread(messageID, query = {}, options) {
|
|
46
|
+
return this._client.getAPIList(path `/v3/messages/${messageID}/thread`, (ListMessagesPagination), {
|
|
47
|
+
query,
|
|
48
|
+
...options,
|
|
49
|
+
});
|
|
40
50
|
}
|
|
41
51
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* **Note:** A message can be edited up to 5 times, and only within 15 minutes of
|
|
45
|
-
* when it was originally sent.
|
|
52
|
+
* Retrieve a specific message by its ID. This endpoint returns the full message
|
|
53
|
+
* details including text, attachments, reactions, and metadata.
|
|
46
54
|
*
|
|
47
55
|
* @example
|
|
48
56
|
* ```ts
|
|
49
|
-
* const message = await client.messages.
|
|
57
|
+
* const message = await client.messages.retrieve(
|
|
50
58
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
51
|
-
* { text: 'This is the edited message content' },
|
|
52
59
|
* );
|
|
53
60
|
* ```
|
|
54
61
|
*/
|
|
55
|
-
|
|
56
|
-
return this._client.
|
|
62
|
+
retrieve(messageID, options) {
|
|
63
|
+
return this._client.get(path `/v3/messages/${messageID}`, options);
|
|
57
64
|
}
|
|
58
65
|
/**
|
|
59
66
|
* Deletes a message from the Linq API only. This does NOT unsend or remove the
|
|
@@ -98,28 +105,21 @@ export class Messages extends APIResource {
|
|
|
98
105
|
return this._client.post(path `/v3/messages/${messageID}/reactions`, { body, ...options });
|
|
99
106
|
}
|
|
100
107
|
/**
|
|
101
|
-
*
|
|
102
|
-
* thread, returns the originator message and all replies in chronological order.
|
|
103
|
-
*
|
|
104
|
-
* If the message is not part of a thread, returns just that single message.
|
|
108
|
+
* Edit the text content of a specific part of a previously sent message.
|
|
105
109
|
*
|
|
106
|
-
*
|
|
110
|
+
* **Note:** A message can be edited up to 5 times, and only within 15 minutes of
|
|
111
|
+
* when it was originally sent.
|
|
107
112
|
*
|
|
108
113
|
* @example
|
|
109
114
|
* ```ts
|
|
110
|
-
*
|
|
111
|
-
* for await (const message of client.messages.listMessagesThread(
|
|
115
|
+
* const message = await client.messages.update(
|
|
112
116
|
* '69a37c7d-af4f-4b5e-af42-e28e98ce873a',
|
|
113
|
-
*
|
|
114
|
-
*
|
|
115
|
-
* }
|
|
117
|
+
* { text: 'This is the edited message content' },
|
|
118
|
+
* );
|
|
116
119
|
* ```
|
|
117
120
|
*/
|
|
118
|
-
|
|
119
|
-
return this._client.
|
|
120
|
-
query,
|
|
121
|
-
...options,
|
|
122
|
-
});
|
|
121
|
+
update(messageID, body, options) {
|
|
122
|
+
return this._client.patch(path `/v3/messages/${messageID}`, { body, ...options });
|
|
123
123
|
}
|
|
124
124
|
}
|
|
125
125
|
//# sourceMappingURL=messages.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAAE,sBAAsB,EAAkD,+BAA2B;AAC5G,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC
|
|
1
|
+
{"version":3,"file":"messages.mjs","sourceRoot":"","sources":["../src/resources/messages.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAG/C,OAAO,EAAE,sBAAsB,EAAkD,+BAA2B;AAC5G,OAAO,EAAE,YAAY,EAAE,gCAA4B;AAEnD,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,OAAO,QAAS,SAAQ,WAAW;IACvC;;;;;;;;;;;;;;;;;OAiBG;IACH,kBAAkB,C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
|
* ## Webhook Headers
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* All webhook requests include two sets of headers. **If you have an existing integration
|
|
18
|
+
* using the `X-Webhook-*` headers, nothing changes** — those headers are still sent on
|
|
19
|
+
* every delivery and work exactly as before. The new `webhook-*` headers follow the
|
|
20
|
+
* [Standard Webhooks](https://github.com/standard-webhooks/standard-webhooks) specification.
|
|
21
|
+
* You can safely ignore them if your current verification code works and you don't want to use this convention.
|
|
22
|
+
*
|
|
23
|
+
* ### Standard Webhooks Headers (Recommended)
|
|
24
|
+
*
|
|
25
|
+
* Used by [our SDK](https://github.com/linq-team/linq-node) and any [Standard Webhooks library](https://github.com/standard-webhooks/standard-webhooks).
|
|
18
26
|
*
|
|
19
27
|
* | Header | Description |
|
|
20
28
|
* |--------|-------------|
|
|
21
|
-
* | `
|
|
22
|
-
* | `
|
|
23
|
-
* | `
|
|
24
|
-
* | `X-Webhook-Signature` | HMAC-SHA256 signature for verification |
|
|
29
|
+
* | `webhook-id` | Unique event identifier (use as idempotency key) |
|
|
30
|
+
* | `webhook-timestamp` | Unix timestamp (seconds) when the webhook was sent |
|
|
31
|
+
* | `webhook-signature` | Standard Webhooks signature (`v1,{base64}` format) |
|
|
25
32
|
*
|
|
26
|
-
*
|
|
33
|
+
* ### Legacy Headers (Deprecated)
|
|
34
|
+
*
|
|
35
|
+
* Still sent on every delivery for backwards compatibility. Existing verification code
|
|
36
|
+
* using these headers continues to work — no changes required.
|
|
27
37
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
38
|
+
* | Header | Description |
|
|
39
|
+
* |--------|-------------|
|
|
40
|
+
* | `X-Webhook-Event` | *(deprecated)* Event type (e.g., `message.sent`) |
|
|
41
|
+
* | `X-Webhook-Subscription-ID` | *(deprecated)* Webhook subscription ID |
|
|
42
|
+
* | `X-Webhook-Timestamp` | *(deprecated)* Unix timestamp (seconds) |
|
|
43
|
+
* | `X-Webhook-Signature` | *(deprecated)* HMAC-SHA256 signature (hex-encoded) |
|
|
30
44
|
*
|
|
31
|
-
*
|
|
45
|
+
* ## Signing Secrets
|
|
32
46
|
*
|
|
33
|
-
*
|
|
47
|
+
* Signing secrets use the Standard Webhooks format: a `whsec_` prefix followed
|
|
48
|
+
* by base64-encoded random bytes (e.g., `whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw7Jxx2Oll+OE=`).
|
|
34
49
|
*
|
|
35
|
-
*
|
|
36
|
-
* {timestamp}.{payload}
|
|
37
|
-
* ```
|
|
50
|
+
* Strip the `whsec_` prefix and base64-decode the remainder to get the raw key bytes.
|
|
38
51
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
52
|
+
* ## Verifying Webhook Signatures
|
|
53
|
+
*
|
|
54
|
+
* Webhooks are signed following the [Standard Webhooks specification](https://github.com/standard-webhooks/standard-webhooks).
|
|
55
|
+
* You can use any [Standard Webhooks library](https://github.com/standard-webhooks/standard-webhooks) to verify
|
|
56
|
+
* signatures, or implement verification manually:
|
|
57
|
+
*
|
|
58
|
+
* **Signed content:** `{webhook-id}.{webhook-timestamp}.{body}`
|
|
42
59
|
*
|
|
43
60
|
* **Verification Steps:**
|
|
44
61
|
*
|
|
45
|
-
* 1. Extract the `
|
|
46
|
-
* 2.
|
|
47
|
-
* 3.
|
|
48
|
-
* 4.
|
|
49
|
-
* 5.
|
|
50
|
-
* 6.
|
|
62
|
+
* 1. Extract the `webhook-id`, `webhook-timestamp`, and `webhook-signature` headers
|
|
63
|
+
* 2. Reject if the timestamp is more than 5 minutes old (replay protection)
|
|
64
|
+
* 3. Get the raw request body bytes (do not parse and re-serialize)
|
|
65
|
+
* 4. Construct signed content: `"{webhook-id}.{webhook-timestamp}.{body}"`
|
|
66
|
+
* 5. Strip the `whsec_` prefix from your secret and base64-decode to get key bytes
|
|
67
|
+
* 6. Compute HMAC-SHA256 using the key bytes over the signed content
|
|
68
|
+
* 7. Base64-encode the result and compare with the value after `v1,` in `webhook-signature`
|
|
69
|
+
* 8. Use constant-time comparison to prevent timing attacks
|
|
51
70
|
*
|
|
52
71
|
* **Example (Python):**
|
|
53
72
|
*
|
|
54
73
|
* ```python
|
|
55
|
-
* import hmac
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
74
|
+
* import base64, hmac, hashlib
|
|
75
|
+
*
|
|
76
|
+
* def verify_webhook(secret, body, headers):
|
|
77
|
+
* msg_id = headers['webhook-id']
|
|
78
|
+
* timestamp = headers['webhook-timestamp']
|
|
79
|
+
* signature = headers['webhook-signature']
|
|
80
|
+
*
|
|
81
|
+
* secret_str = secret.removeprefix('whsec_')
|
|
82
|
+
* key = base64.b64decode(secret_str)
|
|
83
|
+
*
|
|
84
|
+
* signed_content = f"{msg_id}.{timestamp}.{body}"
|
|
85
|
+
* expected = base64.b64encode(
|
|
86
|
+
* hmac.new(key, signed_content.encode(), hashlib.sha256).digest()
|
|
87
|
+
* ).decode()
|
|
88
|
+
*
|
|
89
|
+
* for sig in signature.split(' '):
|
|
90
|
+
* if sig.startswith('v1,') and hmac.compare_digest(expected, sig[3:]):
|
|
91
|
+
* return True
|
|
92
|
+
* return False
|
|
66
93
|
* ```
|
|
67
94
|
*
|
|
68
95
|
* **Example (Node.js):**
|
|
@@ -70,16 +97,28 @@ import { RequestOptions } from "../internal/request-options.mjs";
|
|
|
70
97
|
* ```javascript
|
|
71
98
|
* const crypto = require('crypto');
|
|
72
99
|
*
|
|
73
|
-
* function verifyWebhook(
|
|
74
|
-
* const
|
|
100
|
+
* function verifyWebhook(secret, rawBody, headers) {
|
|
101
|
+
* const msgId = headers['webhook-id'];
|
|
102
|
+
* const timestamp = headers['webhook-timestamp'];
|
|
103
|
+
* const signature = headers['webhook-signature'];
|
|
104
|
+
*
|
|
105
|
+
* const secretStr = secret.startsWith('whsec_') ? secret.slice(6) : secret;
|
|
106
|
+
* const keyBytes = Buffer.from(secretStr, 'base64');
|
|
107
|
+
* const signedContent = `${msgId}.${timestamp}.${rawBody}`;
|
|
75
108
|
* const expected = crypto
|
|
76
|
-
* .createHmac('sha256',
|
|
77
|
-
* .update(
|
|
78
|
-
* .digest('
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
109
|
+
* .createHmac('sha256', keyBytes)
|
|
110
|
+
* .update(signedContent)
|
|
111
|
+
* .digest('base64');
|
|
112
|
+
*
|
|
113
|
+
* return signature.split(' ').some(sig => {
|
|
114
|
+
* if (!sig.startsWith('v1,')) return false;
|
|
115
|
+
* try {
|
|
116
|
+
* return crypto.timingSafeEqual(
|
|
117
|
+
* Buffer.from(expected, 'base64'),
|
|
118
|
+
* Buffer.from(sig.slice(3), 'base64')
|
|
119
|
+
* );
|
|
120
|
+
* } catch { return false; }
|
|
121
|
+
* });
|
|
83
122
|
* }
|
|
84
123
|
* ```
|
|
85
124
|
*
|
|
@@ -105,12 +144,12 @@ export declare class WebhookEvents extends APIResource {
|
|
|
105
144
|
* `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
106
145
|
* subscription will not produce any deliveries.
|
|
107
146
|
*/
|
|
108
|
-
export type WebhookEventType = 'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'message.edited' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated' | 'call.initiated' | 'call.ringing' | 'call.answered' | 'call.ended' | 'call.failed' | 'call.declined' | 'call.no_answer';
|
|
147
|
+
export type WebhookEventType = 'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'message.edited' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated' | 'call.initiated' | 'call.ringing' | 'call.answered' | 'call.ended' | 'call.failed' | 'call.declined' | 'call.no_answer' | 'location.sharing.started' | 'location.sharing.stopped';
|
|
109
148
|
export interface WebhookEventListResponse {
|
|
110
149
|
/**
|
|
111
150
|
* URL to the webhook events documentation
|
|
112
151
|
*/
|
|
113
|
-
doc_url: 'https://
|
|
152
|
+
doc_url: 'https://docs.linqapp.com/guides/webhooks/events';
|
|
114
153
|
/**
|
|
115
154
|
* List of all available webhook event types
|
|
116
155
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-events.d.mts","sourceRoot":"","sources":["../src/resources/webhook-events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAE7D
|
|
1
|
+
{"version":3,"file":"webhook-events.d.mts","sourceRoot":"","sources":["../src/resources/webhook-events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+HG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;CAGrE;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,cAAc,GACd,yBAAyB,GACzB,yBAAyB,GACzB,+BAA+B,GAC/B,+BAA+B,GAC/B,+BAA+B,GAC/B,+BAA+B,GAC/B,6BAA6B,GAC7B,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,YAAY,GACZ,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,0BAA0B,GAC1B,0BAA0B,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,OAAO,EAAE,iDAAiD,CAAC;IAE3D;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACjC;AAED,MAAM,CAAC,OAAO,WAAW,aAAa,CAAC;IACrC,OAAO,EACL,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,wBAAwB,IAAI,wBAAwB,GAC1D,CAAC;CACH"}
|
|
@@ -14,55 +14,82 @@ import { RequestOptions } from "../internal/request-options.js";
|
|
|
14
14
|
*
|
|
15
15
|
* ## Webhook Headers
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* All webhook requests include two sets of headers. **If you have an existing integration
|
|
18
|
+
* using the `X-Webhook-*` headers, nothing changes** — those headers are still sent on
|
|
19
|
+
* every delivery and work exactly as before. The new `webhook-*` headers follow the
|
|
20
|
+
* [Standard Webhooks](https://github.com/standard-webhooks/standard-webhooks) specification.
|
|
21
|
+
* You can safely ignore them if your current verification code works and you don't want to use this convention.
|
|
22
|
+
*
|
|
23
|
+
* ### Standard Webhooks Headers (Recommended)
|
|
24
|
+
*
|
|
25
|
+
* Used by [our SDK](https://github.com/linq-team/linq-node) and any [Standard Webhooks library](https://github.com/standard-webhooks/standard-webhooks).
|
|
18
26
|
*
|
|
19
27
|
* | Header | Description |
|
|
20
28
|
* |--------|-------------|
|
|
21
|
-
* | `
|
|
22
|
-
* | `
|
|
23
|
-
* | `
|
|
24
|
-
* | `X-Webhook-Signature` | HMAC-SHA256 signature for verification |
|
|
29
|
+
* | `webhook-id` | Unique event identifier (use as idempotency key) |
|
|
30
|
+
* | `webhook-timestamp` | Unix timestamp (seconds) when the webhook was sent |
|
|
31
|
+
* | `webhook-signature` | Standard Webhooks signature (`v1,{base64}` format) |
|
|
25
32
|
*
|
|
26
|
-
*
|
|
33
|
+
* ### Legacy Headers (Deprecated)
|
|
34
|
+
*
|
|
35
|
+
* Still sent on every delivery for backwards compatibility. Existing verification code
|
|
36
|
+
* using these headers continues to work — no changes required.
|
|
27
37
|
*
|
|
28
|
-
*
|
|
29
|
-
*
|
|
38
|
+
* | Header | Description |
|
|
39
|
+
* |--------|-------------|
|
|
40
|
+
* | `X-Webhook-Event` | *(deprecated)* Event type (e.g., `message.sent`) |
|
|
41
|
+
* | `X-Webhook-Subscription-ID` | *(deprecated)* Webhook subscription ID |
|
|
42
|
+
* | `X-Webhook-Timestamp` | *(deprecated)* Unix timestamp (seconds) |
|
|
43
|
+
* | `X-Webhook-Signature` | *(deprecated)* HMAC-SHA256 signature (hex-encoded) |
|
|
30
44
|
*
|
|
31
|
-
*
|
|
45
|
+
* ## Signing Secrets
|
|
32
46
|
*
|
|
33
|
-
*
|
|
47
|
+
* Signing secrets use the Standard Webhooks format: a `whsec_` prefix followed
|
|
48
|
+
* by base64-encoded random bytes (e.g., `whsec_MfKQ9r8GKYqrTwjUPD8ILPZIo2LaLaSw7Jxx2Oll+OE=`).
|
|
34
49
|
*
|
|
35
|
-
*
|
|
36
|
-
* {timestamp}.{payload}
|
|
37
|
-
* ```
|
|
50
|
+
* Strip the `whsec_` prefix and base64-decode the remainder to get the raw key bytes.
|
|
38
51
|
*
|
|
39
|
-
*
|
|
40
|
-
*
|
|
41
|
-
*
|
|
52
|
+
* ## Verifying Webhook Signatures
|
|
53
|
+
*
|
|
54
|
+
* Webhooks are signed following the [Standard Webhooks specification](https://github.com/standard-webhooks/standard-webhooks).
|
|
55
|
+
* You can use any [Standard Webhooks library](https://github.com/standard-webhooks/standard-webhooks) to verify
|
|
56
|
+
* signatures, or implement verification manually:
|
|
57
|
+
*
|
|
58
|
+
* **Signed content:** `{webhook-id}.{webhook-timestamp}.{body}`
|
|
42
59
|
*
|
|
43
60
|
* **Verification Steps:**
|
|
44
61
|
*
|
|
45
|
-
* 1. Extract the `
|
|
46
|
-
* 2.
|
|
47
|
-
* 3.
|
|
48
|
-
* 4.
|
|
49
|
-
* 5.
|
|
50
|
-
* 6.
|
|
62
|
+
* 1. Extract the `webhook-id`, `webhook-timestamp`, and `webhook-signature` headers
|
|
63
|
+
* 2. Reject if the timestamp is more than 5 minutes old (replay protection)
|
|
64
|
+
* 3. Get the raw request body bytes (do not parse and re-serialize)
|
|
65
|
+
* 4. Construct signed content: `"{webhook-id}.{webhook-timestamp}.{body}"`
|
|
66
|
+
* 5. Strip the `whsec_` prefix from your secret and base64-decode to get key bytes
|
|
67
|
+
* 6. Compute HMAC-SHA256 using the key bytes over the signed content
|
|
68
|
+
* 7. Base64-encode the result and compare with the value after `v1,` in `webhook-signature`
|
|
69
|
+
* 8. Use constant-time comparison to prevent timing attacks
|
|
51
70
|
*
|
|
52
71
|
* **Example (Python):**
|
|
53
72
|
*
|
|
54
73
|
* ```python
|
|
55
|
-
* import hmac
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
74
|
+
* import base64, hmac, hashlib
|
|
75
|
+
*
|
|
76
|
+
* def verify_webhook(secret, body, headers):
|
|
77
|
+
* msg_id = headers['webhook-id']
|
|
78
|
+
* timestamp = headers['webhook-timestamp']
|
|
79
|
+
* signature = headers['webhook-signature']
|
|
80
|
+
*
|
|
81
|
+
* secret_str = secret.removeprefix('whsec_')
|
|
82
|
+
* key = base64.b64decode(secret_str)
|
|
83
|
+
*
|
|
84
|
+
* signed_content = f"{msg_id}.{timestamp}.{body}"
|
|
85
|
+
* expected = base64.b64encode(
|
|
86
|
+
* hmac.new(key, signed_content.encode(), hashlib.sha256).digest()
|
|
87
|
+
* ).decode()
|
|
88
|
+
*
|
|
89
|
+
* for sig in signature.split(' '):
|
|
90
|
+
* if sig.startswith('v1,') and hmac.compare_digest(expected, sig[3:]):
|
|
91
|
+
* return True
|
|
92
|
+
* return False
|
|
66
93
|
* ```
|
|
67
94
|
*
|
|
68
95
|
* **Example (Node.js):**
|
|
@@ -70,16 +97,28 @@ import { RequestOptions } from "../internal/request-options.js";
|
|
|
70
97
|
* ```javascript
|
|
71
98
|
* const crypto = require('crypto');
|
|
72
99
|
*
|
|
73
|
-
* function verifyWebhook(
|
|
74
|
-
* const
|
|
100
|
+
* function verifyWebhook(secret, rawBody, headers) {
|
|
101
|
+
* const msgId = headers['webhook-id'];
|
|
102
|
+
* const timestamp = headers['webhook-timestamp'];
|
|
103
|
+
* const signature = headers['webhook-signature'];
|
|
104
|
+
*
|
|
105
|
+
* const secretStr = secret.startsWith('whsec_') ? secret.slice(6) : secret;
|
|
106
|
+
* const keyBytes = Buffer.from(secretStr, 'base64');
|
|
107
|
+
* const signedContent = `${msgId}.${timestamp}.${rawBody}`;
|
|
75
108
|
* const expected = crypto
|
|
76
|
-
* .createHmac('sha256',
|
|
77
|
-
* .update(
|
|
78
|
-
* .digest('
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
109
|
+
* .createHmac('sha256', keyBytes)
|
|
110
|
+
* .update(signedContent)
|
|
111
|
+
* .digest('base64');
|
|
112
|
+
*
|
|
113
|
+
* return signature.split(' ').some(sig => {
|
|
114
|
+
* if (!sig.startsWith('v1,')) return false;
|
|
115
|
+
* try {
|
|
116
|
+
* return crypto.timingSafeEqual(
|
|
117
|
+
* Buffer.from(expected, 'base64'),
|
|
118
|
+
* Buffer.from(sig.slice(3), 'base64')
|
|
119
|
+
* );
|
|
120
|
+
* } catch { return false; }
|
|
121
|
+
* });
|
|
83
122
|
* }
|
|
84
123
|
* ```
|
|
85
124
|
*
|
|
@@ -105,12 +144,12 @@ export declare class WebhookEvents extends APIResource {
|
|
|
105
144
|
* `webhook_version: "2026-02-03"`. Subscribing to this event on a v2025
|
|
106
145
|
* subscription will not produce any deliveries.
|
|
107
146
|
*/
|
|
108
|
-
export type WebhookEventType = 'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'message.edited' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated' | 'call.initiated' | 'call.ringing' | 'call.answered' | 'call.ended' | 'call.failed' | 'call.declined' | 'call.no_answer';
|
|
147
|
+
export type WebhookEventType = 'message.sent' | 'message.received' | 'message.read' | 'message.delivered' | 'message.failed' | 'message.edited' | 'reaction.added' | 'reaction.removed' | 'participant.added' | 'participant.removed' | 'chat.created' | 'chat.group_name_updated' | 'chat.group_icon_updated' | 'chat.group_name_update_failed' | 'chat.group_icon_update_failed' | 'chat.typing_indicator.started' | 'chat.typing_indicator.stopped' | 'phone_number.status_updated' | 'call.initiated' | 'call.ringing' | 'call.answered' | 'call.ended' | 'call.failed' | 'call.declined' | 'call.no_answer' | 'location.sharing.started' | 'location.sharing.stopped';
|
|
109
148
|
export interface WebhookEventListResponse {
|
|
110
149
|
/**
|
|
111
150
|
* URL to the webhook events documentation
|
|
112
151
|
*/
|
|
113
|
-
doc_url: 'https://
|
|
152
|
+
doc_url: 'https://docs.linqapp.com/guides/webhooks/events';
|
|
114
153
|
/**
|
|
115
154
|
* List of all available webhook event types
|
|
116
155
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-events.d.ts","sourceRoot":"","sources":["../src/resources/webhook-events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAE7D
|
|
1
|
+
{"version":3,"file":"webhook-events.d.ts","sourceRoot":"","sources":["../src/resources/webhook-events.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,+BAA4B;AACjD,OAAO,EAAE,cAAc,EAAE,uCAAoC;AAE7D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+HG;AACH,qBAAa,aAAc,SAAQ,WAAW;IAC5C;;;;OAIG;IACH,IAAI,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,wBAAwB,CAAC;CAGrE;AAED;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GACxB,cAAc,GACd,kBAAkB,GAClB,cAAc,GACd,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,gBAAgB,GAChB,kBAAkB,GAClB,mBAAmB,GACnB,qBAAqB,GACrB,cAAc,GACd,yBAAyB,GACzB,yBAAyB,GACzB,+BAA+B,GAC/B,+BAA+B,GAC/B,+BAA+B,GAC/B,+BAA+B,GAC/B,6BAA6B,GAC7B,gBAAgB,GAChB,cAAc,GACd,eAAe,GACf,YAAY,GACZ,aAAa,GACb,eAAe,GACf,gBAAgB,GAChB,0BAA0B,GAC1B,0BAA0B,CAAC;AAE/B,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,OAAO,EAAE,iDAAiD,CAAC;IAE3D;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CACjC;AAED,M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