@linqapp/sdk 0.33.0 → 0.34.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 +14 -0
- package/client.d.mts +1 -1
- package/client.d.mts.map +1 -1
- package/client.d.ts +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +1 -1
- package/client.js.map +1 -1
- package/client.mjs +1 -1
- package/client.mjs.map +1 -1
- package/core/error.d.mts +13 -0
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +13 -0
- package/core/error.d.ts.map +1 -1
- package/core/error.js +5 -1
- package/core/error.js.map +1 -1
- package/core/error.mjs +5 -1
- package/core/error.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/chats/chats.d.mts +68 -24
- package/resources/chats/chats.d.mts.map +1 -1
- package/resources/chats/chats.d.ts +68 -24
- package/resources/chats/chats.d.ts.map +1 -1
- package/resources/chats/chats.js +6 -2
- package/resources/chats/chats.js.map +1 -1
- package/resources/chats/chats.mjs +6 -2
- package/resources/chats/chats.mjs.map +1 -1
- package/resources/chats/index.d.mts +1 -0
- package/resources/chats/index.d.mts.map +1 -1
- package/resources/chats/index.d.ts +1 -0
- 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/messages.d.mts +12 -5
- package/resources/chats/messages.d.mts.map +1 -1
- package/resources/chats/messages.d.ts +12 -5
- package/resources/chats/messages.d.ts.map +1 -1
- package/resources/chats/messages.js.map +1 -1
- package/resources/chats/messages.mjs.map +1 -1
- package/resources/chats/polls.d.mts +171 -0
- package/resources/chats/polls.d.mts.map +1 -0
- package/resources/chats/polls.d.ts +171 -0
- package/resources/chats/polls.d.ts.map +1 -0
- package/resources/chats/polls.js +95 -0
- package/resources/chats/polls.js.map +1 -0
- package/resources/chats/polls.mjs +91 -0
- package/resources/chats/polls.mjs.map +1 -0
- package/resources/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/messages/index.d.mts +3 -0
- package/resources/messages/index.d.mts.map +1 -0
- package/resources/messages/index.d.ts +3 -0
- package/resources/messages/index.d.ts.map +1 -0
- package/resources/messages/index.js +9 -0
- package/resources/messages/index.js.map +1 -0
- package/resources/messages/index.mjs +4 -0
- package/resources/messages/index.mjs.map +1 -0
- package/resources/messages/messages.d.mts +795 -0
- package/resources/messages/messages.d.mts.map +1 -0
- package/resources/messages/messages.d.ts +795 -0
- package/resources/messages/messages.d.ts.map +1 -0
- package/resources/messages/messages.js +298 -0
- package/resources/messages/messages.js.map +1 -0
- package/resources/messages/messages.mjs +293 -0
- package/resources/messages/messages.mjs.map +1 -0
- package/resources/messages/poll.d.mts +131 -0
- package/resources/messages/poll.d.mts.map +1 -0
- package/resources/messages/poll.d.ts +131 -0
- package/resources/messages/poll.d.ts.map +1 -0
- package/resources/messages/poll.js +119 -0
- package/resources/messages/poll.js.map +1 -0
- package/resources/messages/poll.mjs +115 -0
- package/resources/messages/poll.mjs.map +1 -0
- package/resources/messages.d.mts +1 -783
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +1 -783
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +2 -286
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +1 -284
- package/resources/messages.mjs.map +1 -1
- package/resources/webhook-events.d.mts +1 -1
- package/resources/webhook-events.d.mts.map +1 -1
- package/resources/webhook-events.d.ts +1 -1
- package/resources/webhook-events.d.ts.map +1 -1
- package/resources/webhooks.d.mts +40 -28
- package/resources/webhooks.d.mts.map +1 -1
- package/resources/webhooks.d.ts +40 -28
- package/resources/webhooks.d.ts.map +1 -1
- package/src/client.ts +15 -15
- package/src/core/error.ts +20 -1
- package/src/resources/chats/chats.ts +79 -24
- package/src/resources/chats/index.ts +1 -0
- package/src/resources/chats/messages.ts +14 -6
- package/src/resources/chats/polls.ts +196 -0
- package/src/resources/index.ts +1 -1
- package/src/resources/messages/index.ts +18 -0
- package/src/resources/messages/messages.ts +958 -0
- package/src/resources/messages/poll.ts +151 -0
- package/src/resources/messages.ts +1 -932
- package/src/resources/webhook-events.ts +9 -0
- package/src/resources/webhooks.ts +48 -27
- 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,11 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as MessagesAPI from '../messages';
|
|
5
4
|
import * as Shared from '../shared';
|
|
6
5
|
import * as LocationAPI from './location';
|
|
7
6
|
import { GetChatLocationResponse, Location, LocationRequestResponse } from './location';
|
|
8
|
-
import * as
|
|
7
|
+
import * as MessagesAPI from './messages';
|
|
9
8
|
import { MessageListParams, MessageSendParams, MessageSendResponse, Messages, SentMessage } from './messages';
|
|
10
9
|
import * as ParticipantsAPI from './participants';
|
|
11
10
|
import {
|
|
@@ -15,8 +14,11 @@ import {
|
|
|
15
14
|
ParticipantRemoveResponse,
|
|
16
15
|
Participants,
|
|
17
16
|
} from './participants';
|
|
17
|
+
import * as PollsAPI from './polls';
|
|
18
|
+
import { Poll, PollCreateParams, PollEnvelope, Polls } from './polls';
|
|
18
19
|
import * as TypingAPI from './typing';
|
|
19
20
|
import { Typing } from './typing';
|
|
21
|
+
import * as ResourcesMessagesAPI from '../messages/messages';
|
|
20
22
|
import { APIPromise } from '../../core/api-promise';
|
|
21
23
|
import { ListChatsPagination, type ListChatsPaginationParams, PagePromise } from '../../core/pagination';
|
|
22
24
|
import { buildHeaders } from '../../internal/headers';
|
|
@@ -26,8 +28,9 @@ import { path } from '../../internal/utils/path';
|
|
|
26
28
|
export class Chats extends APIResource {
|
|
27
29
|
participants: ParticipantsAPI.Participants = new ParticipantsAPI.Participants(this._client);
|
|
28
30
|
typing: TypingAPI.Typing = new TypingAPI.Typing(this._client);
|
|
29
|
-
messages:
|
|
31
|
+
messages: MessagesAPI.Messages = new MessagesAPI.Messages(this._client);
|
|
30
32
|
location: LocationAPI.Location = new LocationAPI.Location(this._client);
|
|
33
|
+
polls: PollsAPI.Polls = new PollsAPI.Polls(this._client);
|
|
31
34
|
|
|
32
35
|
/**
|
|
33
36
|
* Create a new chat with specified participants and send an initial message. The
|
|
@@ -385,15 +388,19 @@ export namespace Chat {
|
|
|
385
388
|
* to react. `doc_url` deep-links to the relevant section.
|
|
386
389
|
*
|
|
387
390
|
* `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
|
|
388
|
-
* `CANCEL`, `END`, or `QUIT
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
*
|
|
391
|
+
* `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
|
|
392
|
+
* part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
|
|
393
|
+
* match exactly, including case. `OPT OUT` is the exception — it matches in any
|
|
394
|
+
* casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
|
|
395
|
+
* `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
|
|
396
|
+
* or if they keep replying on the chat — sustained two-way conversation is treated
|
|
397
|
+
* as a sign the stop keyword was a false positive.
|
|
398
|
+
*
|
|
399
|
+
* Linq enforces this: while a recipient is opted out, every send to them is
|
|
400
|
+
* rejected with `403` (error code `2024`) before the message is queued, across
|
|
401
|
+
* every chat and every line on your account. Nothing is delivered, including a
|
|
402
|
+
* final courtesy message — to send one, set `override_optout: true` on that single
|
|
403
|
+
* request.
|
|
397
404
|
*/
|
|
398
405
|
status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
|
|
399
406
|
|
|
@@ -492,7 +499,7 @@ export interface MessageContent {
|
|
|
492
499
|
/**
|
|
493
500
|
* iMessage effect to apply to this message (screen or bubble effect)
|
|
494
501
|
*/
|
|
495
|
-
effect?:
|
|
502
|
+
effect?: ResourcesMessagesAPI.MessageEffect;
|
|
496
503
|
|
|
497
504
|
/**
|
|
498
505
|
* Optional idempotency key for this message. Use this to prevent duplicate sends
|
|
@@ -551,7 +558,7 @@ export interface MessageContent {
|
|
|
551
558
|
/**
|
|
552
559
|
* Reply to another message to create a threaded conversation
|
|
553
560
|
*/
|
|
554
|
-
reply_to?:
|
|
561
|
+
reply_to?: ResourcesMessagesAPI.ReplyTo;
|
|
555
562
|
}
|
|
556
563
|
|
|
557
564
|
export namespace MessageContent {
|
|
@@ -744,6 +751,26 @@ export interface TextPart {
|
|
|
744
751
|
*/
|
|
745
752
|
value: string;
|
|
746
753
|
|
|
754
|
+
/**
|
|
755
|
+
* @mention a chat participant (iMessage group chats only). Set to their handle —
|
|
756
|
+
* E.164 phone number or Apple ID email. `value` is the display text; use the bare
|
|
757
|
+
* name (`"Juan"`, not `"@Juan"`). The mentioned participant is notified even if
|
|
758
|
+
* the chat is muted. Falls back to plain text over SMS/RCS.
|
|
759
|
+
*
|
|
760
|
+
* By default the entire `value` renders as the mention; use `mention_range` to
|
|
761
|
+
* highlight only part of it.
|
|
762
|
+
*/
|
|
763
|
+
mention?: string;
|
|
764
|
+
|
|
765
|
+
/**
|
|
766
|
+
* Optional character range `[start, end)` in `value` that renders as the `mention`
|
|
767
|
+
* highlight (e.g. just the name in `"Hey Kevin, can you look at this?"`). Requires
|
|
768
|
+
* `mention`. Without it, the entire `value` is highlighted. `start` is inclusive,
|
|
769
|
+
* `end` is exclusive. _Characters are measured as UTF-16 code units. Most
|
|
770
|
+
* characters count as 1; some emoji count as 2._
|
|
771
|
+
*/
|
|
772
|
+
mention_range?: Array<number>;
|
|
773
|
+
|
|
747
774
|
/**
|
|
748
775
|
* Optional array of text decorations applied to character ranges in the `value`
|
|
749
776
|
* field (iMessage only).
|
|
@@ -815,7 +842,7 @@ export namespace ChatCreateResponse {
|
|
|
815
842
|
/**
|
|
816
843
|
* A message that was sent (used in CreateChat and SendMessage responses)
|
|
817
844
|
*/
|
|
818
|
-
message:
|
|
845
|
+
message: MessagesAPI.SentMessage;
|
|
819
846
|
|
|
820
847
|
/**
|
|
821
848
|
* Messaging service type
|
|
@@ -849,15 +876,19 @@ export namespace ChatCreateResponse {
|
|
|
849
876
|
* to react. `doc_url` deep-links to the relevant section.
|
|
850
877
|
*
|
|
851
878
|
* `OPTED_OUT` is terminal — the recipient sent `STOP`, `UNSUBSCRIBE`, `OPTOUT`,
|
|
852
|
-
* `CANCEL`, `END`, or `QUIT
|
|
853
|
-
*
|
|
854
|
-
*
|
|
855
|
-
*
|
|
856
|
-
*
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
879
|
+
* `CANCEL`, `END`, or `QUIT`. The keyword must be the whole trimmed message, never
|
|
880
|
+
* part of a longer one: `STOP` counts, `please stop` does not. Most keywords must
|
|
881
|
+
* match exactly, including case. `OPT OUT` is the exception — it matches in any
|
|
882
|
+
* casing, with or without the space or a hyphen, so `opt out`, `Opt-Out` and
|
|
883
|
+
* `optout` all count. It clears if they later send `START`, `OPTIN`, or `UNSTOP`,
|
|
884
|
+
* or if they keep replying on the chat — sustained two-way conversation is treated
|
|
885
|
+
* as a sign the stop keyword was a false positive.
|
|
886
|
+
*
|
|
887
|
+
* Linq enforces this: while a recipient is opted out, every send to them is
|
|
888
|
+
* rejected with `403` (error code `2024`) before the message is queued, across
|
|
889
|
+
* every chat and every line on your account. Nothing is delivered, including a
|
|
890
|
+
* final courtesy message — to send one, set `override_optout: true` on that single
|
|
891
|
+
* request.
|
|
861
892
|
*/
|
|
862
893
|
status: 'HEALTHY' | 'AT_RISK' | 'CRITICAL' | 'OPTED_OUT';
|
|
863
894
|
|
|
@@ -1013,6 +1044,14 @@ export interface ChatCreateParams {
|
|
|
1013
1044
|
* For individual chats, provide one recipient. For group chats, provide multiple.
|
|
1014
1045
|
*/
|
|
1015
1046
|
to: Array<string>;
|
|
1047
|
+
|
|
1048
|
+
/**
|
|
1049
|
+
* Send even though the recipient asked you to stop (`403`, error code `2024`).
|
|
1050
|
+
* Applies to this request only: the opt-out stays in place, so the next send
|
|
1051
|
+
* without this flag is rejected again. Every override is recorded against your API
|
|
1052
|
+
* key.
|
|
1053
|
+
*/
|
|
1054
|
+
override_optout?: boolean;
|
|
1016
1055
|
}
|
|
1017
1056
|
|
|
1018
1057
|
export interface ChatUpdateParams {
|
|
@@ -1054,6 +1093,14 @@ export interface ChatSendVoicememoParams {
|
|
|
1054
1093
|
*/
|
|
1055
1094
|
attachment_id?: string;
|
|
1056
1095
|
|
|
1096
|
+
/**
|
|
1097
|
+
* Send even though the recipient asked you to stop (`403`, error code `2024`).
|
|
1098
|
+
* Applies to this request only: the opt-out stays in place, so the next send
|
|
1099
|
+
* without this flag is rejected again. Every override is recorded against your API
|
|
1100
|
+
* key.
|
|
1101
|
+
*/
|
|
1102
|
+
override_optout?: boolean;
|
|
1103
|
+
|
|
1057
1104
|
/**
|
|
1058
1105
|
* URL of the voice memo audio file. Must be a publicly accessible HTTPS URL.
|
|
1059
1106
|
*
|
|
@@ -1066,6 +1113,7 @@ Chats.Participants = Participants;
|
|
|
1066
1113
|
Chats.Typing = Typing;
|
|
1067
1114
|
Chats.Messages = Messages;
|
|
1068
1115
|
Chats.Location = Location;
|
|
1116
|
+
Chats.Polls = Polls;
|
|
1069
1117
|
|
|
1070
1118
|
export declare namespace Chats {
|
|
1071
1119
|
export {
|
|
@@ -1108,4 +1156,11 @@ export declare namespace Chats {
|
|
|
1108
1156
|
type GetChatLocationResponse as GetChatLocationResponse,
|
|
1109
1157
|
type LocationRequestResponse as LocationRequestResponse,
|
|
1110
1158
|
};
|
|
1159
|
+
|
|
1160
|
+
export {
|
|
1161
|
+
Polls as Polls,
|
|
1162
|
+
type Poll as Poll,
|
|
1163
|
+
type PollEnvelope as PollEnvelope,
|
|
1164
|
+
type PollCreateParams as PollCreateParams,
|
|
1165
|
+
};
|
|
1111
1166
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../core/resource';
|
|
4
|
-
import * as MessagesAPI from '../messages';
|
|
5
|
-
import { MessagesListMessagesPagination } from '../messages';
|
|
6
4
|
import * as Shared from '../shared';
|
|
7
5
|
import * as ChatsAPI from './chats';
|
|
6
|
+
import * as ResourcesMessagesAPI from '../messages/messages';
|
|
7
|
+
import { MessagesListMessagesPagination } from '../messages/messages';
|
|
8
8
|
import { APIPromise } from '../../core/api-promise';
|
|
9
9
|
import {
|
|
10
10
|
ListMessagesPagination,
|
|
@@ -92,10 +92,10 @@ export class Messages extends APIResource {
|
|
|
92
92
|
chatID: string,
|
|
93
93
|
query: MessageListParams | null | undefined = {},
|
|
94
94
|
options?: RequestOptions,
|
|
95
|
-
): PagePromise<MessagesListMessagesPagination,
|
|
95
|
+
): PagePromise<MessagesListMessagesPagination, ResourcesMessagesAPI.Message> {
|
|
96
96
|
return this._client.getAPIList(
|
|
97
97
|
path`/v3/chats/${chatID}/messages`,
|
|
98
|
-
ListMessagesPagination<
|
|
98
|
+
ListMessagesPagination<ResourcesMessagesAPI.Message>,
|
|
99
99
|
{ query, ...options },
|
|
100
100
|
);
|
|
101
101
|
}
|
|
@@ -209,7 +209,7 @@ export interface SentMessage {
|
|
|
209
209
|
/**
|
|
210
210
|
* iMessage effect applied to a message (screen or bubble effect)
|
|
211
211
|
*/
|
|
212
|
-
effect?:
|
|
212
|
+
effect?: ResourcesMessagesAPI.MessageEffect | null;
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
215
|
* The sender of this message as a full handle object
|
|
@@ -224,7 +224,7 @@ export interface SentMessage {
|
|
|
224
224
|
/**
|
|
225
225
|
* Indicates this message is a threaded reply to another message
|
|
226
226
|
*/
|
|
227
|
-
reply_to?:
|
|
227
|
+
reply_to?: ResourcesMessagesAPI.ReplyTo | null;
|
|
228
228
|
|
|
229
229
|
/**
|
|
230
230
|
* Messaging service type
|
|
@@ -398,6 +398,14 @@ export interface MessageSendParams {
|
|
|
398
398
|
* cannot coexist with text), so copy and a card are two sends, not one.
|
|
399
399
|
*/
|
|
400
400
|
message: ChatsAPI.MessageContent;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Send even though the recipient asked you to stop (`403`, error code `2024`).
|
|
404
|
+
* Applies to this request only: the opt-out stays in place, so the next send
|
|
405
|
+
* without this flag is rejected again. Every override is recorded against your API
|
|
406
|
+
* key.
|
|
407
|
+
*/
|
|
408
|
+
override_optout?: boolean;
|
|
401
409
|
}
|
|
402
410
|
|
|
403
411
|
export declare namespace Messages {
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
import { APIResource } from '../../core/resource';
|
|
4
|
+
import * as Shared from '../shared';
|
|
5
|
+
import { APIPromise } from '../../core/api-promise';
|
|
6
|
+
import { RequestOptions } from '../../internal/request-options';
|
|
7
|
+
import { path } from '../../internal/utils/path';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Messages are individual communications within a chat thread.
|
|
11
|
+
*
|
|
12
|
+
* Messages can include text, media attachments, rich link previews, special effects
|
|
13
|
+
* (like confetti or fireworks), and reactions. All messages are associated with a
|
|
14
|
+
* specific chat and sent from a phone number you own.
|
|
15
|
+
*
|
|
16
|
+
* Messages support delivery status tracking, read receipts, and editing capabilities.
|
|
17
|
+
*
|
|
18
|
+
* ## Rich Link Previews
|
|
19
|
+
*
|
|
20
|
+
* Send a URL as a `link` part to deliver it with a rich preview card showing the
|
|
21
|
+
* page's title, description, and image (when available). A `link` part must be the
|
|
22
|
+
* **only** part in the message — it cannot be combined with text or media parts.
|
|
23
|
+
* To send a URL without a preview card, include it in a `text` part instead.
|
|
24
|
+
*
|
|
25
|
+
* **Limitations:**
|
|
26
|
+
* - A `link` part cannot be combined with other parts in the same message.
|
|
27
|
+
* - Maximum URL length: 2,048 characters.
|
|
28
|
+
*
|
|
29
|
+
* ## Ephemeral Messages (Privacy Tier)
|
|
30
|
+
*
|
|
31
|
+
* For regulated or sensitive conversations, opt in to the **ephemeral messages** tier by contacting your Linq support contact. When enabled, every message on the covered phone numbers is automatically given a fixed **24-hour retention window** — after that window the platform permanently deletes the message from Linq storage. There is no per-message flag; ephemerality is applied automatically based on your configuration.
|
|
32
|
+
*
|
|
33
|
+
* You can request it at two scopes:
|
|
34
|
+
*
|
|
35
|
+
* | Scope | Effect |
|
|
36
|
+
* |---|---|
|
|
37
|
+
* | **Partner-wide** | Every outbound and inbound message on every phone number under your account is retained for 24 hours, then deleted. |
|
|
38
|
+
* | **Per phone number** | Only the specified phone numbers have their messages auto-deleted. The rest follow the standard message-retention policy. |
|
|
39
|
+
*
|
|
40
|
+
* **Behavioral differences vs the standard default:**
|
|
41
|
+
*
|
|
42
|
+
* | Aspect | Standard | Ephemeral |
|
|
43
|
+
* |---|---|---|
|
|
44
|
+
* | Retention | Retained per the standard message-retention policy | **Hard backstop: 24 hours** from when the message is created |
|
|
45
|
+
* | After expiry | Message stays retrievable | Message is permanently deleted — `GET /v3/messages/{messageId}` returns `404` and it no longer appears in `GET /v3/chats/{chatId}/messages` |
|
|
46
|
+
* | Content on expiry | N/A | Text, formatting, and attachment references are scrubbed; the message is gone, not blanked out |
|
|
47
|
+
* | Cross-partner isolation | Enforced | Enforced |
|
|
48
|
+
*
|
|
49
|
+
* **How the 24-hour window works:**
|
|
50
|
+
*
|
|
51
|
+
* - The window is fixed at **24 hours from message creation** (`created_at`) and cannot be configured per message.
|
|
52
|
+
* - It mirrors the ephemeral *attachments* 1-day backstop, so a message and any media it carries expire together.
|
|
53
|
+
* - Expiry is delivery-independent — the clock starts when the message is created, not when it is delivered or read.
|
|
54
|
+
*
|
|
55
|
+
* **What you observe:**
|
|
56
|
+
*
|
|
57
|
+
* - **No expiry timestamp is exposed.** API responses and webhook payloads do not include the deletion time. If you need it, compute `created_at + 24h` yourself.
|
|
58
|
+
* - **No deletion webhook is sent.** There is no `message.deleted` event — a message simply stops being retrievable once its window passes.
|
|
59
|
+
* - **Delivery is unaffected.** Ephemeral messages send, deliver, and fire the usual `message.sent` / `message.received` and status webhooks exactly like standard messages. Only retention changes.
|
|
60
|
+
*
|
|
61
|
+
* **When to choose ephemeral:**
|
|
62
|
+
*
|
|
63
|
+
* - You have a compliance requirement that the platform must not retain message content beyond a short window.
|
|
64
|
+
* - The conversation is high-sensitivity (PHI, financial, identity verification) and you do not want it sitting in storage long-term.
|
|
65
|
+
* - Your application is the system of record — you capture what you need from the delivery webhook in real time and do not rely on reading message history back from Linq later.
|
|
66
|
+
*
|
|
67
|
+
* **Important:** ephemeral applies in *both directions* — messages you send **and** messages received by the phone numbers in that scope. Because Linq can no longer return the message after 24 hours, persist anything you need to keep from the webhook payload at the time it is delivered.
|
|
68
|
+
*/
|
|
69
|
+
export class Polls extends APIResource {
|
|
70
|
+
/**
|
|
71
|
+
* Create an iMessage poll in an existing chat and send it. Polls are
|
|
72
|
+
* iMessage-only.
|
|
73
|
+
*
|
|
74
|
+
* The chat must already exist — **a poll cannot be the first message of a new
|
|
75
|
+
* chat** (use `POST /v3/chats` for that). Options are **add-only and immutable**:
|
|
76
|
+
* you can add options later via `POST /v3/messages/{messageId}/poll/options`, but
|
|
77
|
+
* never edit or remove them.
|
|
78
|
+
*
|
|
79
|
+
* @example
|
|
80
|
+
* ```ts
|
|
81
|
+
* const pollEnvelope = await client.chats.polls.create(
|
|
82
|
+
* '550e8400-e29b-41d4-a716-446655440000',
|
|
83
|
+
* {
|
|
84
|
+
* poll: {
|
|
85
|
+
* options: [{ text: 'Tacos' }, { text: 'Sushi' }],
|
|
86
|
+
* idempotency_key: 'poll-abc123',
|
|
87
|
+
* },
|
|
88
|
+
* },
|
|
89
|
+
* );
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
create(chatID: string, body: PollCreateParams, options?: RequestOptions): APIPromise<PollEnvelope> {
|
|
93
|
+
return this._client.post(path`/v3/chats/${chatID}/polls`, { body, ...options });
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Poll content — options and the aggregate voter count.
|
|
99
|
+
*/
|
|
100
|
+
export interface Poll {
|
|
101
|
+
options: Array<Poll.Option>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Distinct participants across the whole poll (a voter picking two options counts
|
|
105
|
+
* once).
|
|
106
|
+
*/
|
|
107
|
+
total_voters: number;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export namespace Poll {
|
|
111
|
+
export interface Option {
|
|
112
|
+
can_be_edited: boolean;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The participant who added this option (poll creator for the initial options;
|
|
116
|
+
* whoever added later ones).
|
|
117
|
+
*/
|
|
118
|
+
creator_handle: Shared.ChatHandle;
|
|
119
|
+
|
|
120
|
+
option_id: string;
|
|
121
|
+
|
|
122
|
+
text: string;
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Participants who voted for this option (vote_count = voters.length).
|
|
126
|
+
*/
|
|
127
|
+
voters: Array<Option.Voter>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export namespace Option {
|
|
131
|
+
export interface Voter {
|
|
132
|
+
handle: string;
|
|
133
|
+
|
|
134
|
+
voted_at: string;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Message-level envelope returned by every poll endpoint.
|
|
141
|
+
*/
|
|
142
|
+
export interface PollEnvelope {
|
|
143
|
+
chat_id: string;
|
|
144
|
+
|
|
145
|
+
created_at: string;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* The poll-definition message's ID — reference this poll by it.
|
|
149
|
+
*/
|
|
150
|
+
message_id: string;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Poll content — options and the aggregate voter count.
|
|
154
|
+
*/
|
|
155
|
+
poll: Poll;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Tapbacks/stickers on the whole poll (message part 0).
|
|
159
|
+
*/
|
|
160
|
+
reactions: Array<Shared.Reaction>;
|
|
161
|
+
|
|
162
|
+
updated_at: string;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export interface PollCreateParams {
|
|
166
|
+
/**
|
|
167
|
+
* Poll content to create. A poll needs at least two options. Options are add-only
|
|
168
|
+
* and immutable — there is no title/question (send that as a normal text message).
|
|
169
|
+
*/
|
|
170
|
+
poll: PollCreateParams.Poll;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export namespace PollCreateParams {
|
|
174
|
+
/**
|
|
175
|
+
* Poll content to create. A poll needs at least two options. Options are add-only
|
|
176
|
+
* and immutable — there is no title/question (send that as a normal text message).
|
|
177
|
+
*/
|
|
178
|
+
export interface Poll {
|
|
179
|
+
options: Array<Poll.Option>;
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* Optional key to deduplicate the poll creation.
|
|
183
|
+
*/
|
|
184
|
+
idempotency_key?: string;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export namespace Poll {
|
|
188
|
+
export interface Option {
|
|
189
|
+
text: string;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export declare namespace Polls {
|
|
195
|
+
export { type Poll as Poll, type PollEnvelope as PollEnvelope, type PollCreateParams as PollCreateParams };
|
|
196
|
+
}
|
package/src/resources/index.ts
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
export {
|
|
4
|
+
Messages,
|
|
5
|
+
type Message,
|
|
6
|
+
type MessageEffect,
|
|
7
|
+
type ReplyTo,
|
|
8
|
+
type MessageCreateResponse,
|
|
9
|
+
type MessageAddReactionResponse,
|
|
10
|
+
type MessageUpdateAppCardResponse,
|
|
11
|
+
type MessageCreateParams,
|
|
12
|
+
type MessageUpdateParams,
|
|
13
|
+
type MessageAddReactionParams,
|
|
14
|
+
type MessageListMessagesThreadParams,
|
|
15
|
+
type MessageUpdateAppCardParams,
|
|
16
|
+
type MessagesListMessagesPagination,
|
|
17
|
+
} from './messages';
|
|
18
|
+
export { Poll, type PollAddOptionsParams, type PollVoteParams } from './poll';
|