@proteos/sdk 0.91.0 → 0.92.1
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/dist/index.cjs +60 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +247 -1
- package/dist/index.d.ts +247 -1
- package/dist/index.js +60 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/auth/platform-entities.ts +2 -0
- package/src/conversation/index.ts +96 -0
- package/src/conversation/types.ts +221 -0
- package/src/index.ts +15 -1
package/package.json
CHANGED
|
@@ -108,6 +108,8 @@ export const PLATFORM_ENTITIES: readonly PlatformEntity[] = [
|
|
|
108
108
|
// their preset catalog.
|
|
109
109
|
{ slug: 'sending-rules', name: 'Sending Rules' },
|
|
110
110
|
{ slug: 'email-signatures', name: 'Email Signatures' },
|
|
111
|
+
// Reusable messages and snippets, the organisation's and each person's own.
|
|
112
|
+
{ slug: 'message-templates', name: 'Message Templates' },
|
|
111
113
|
// The channel_action ledger: acts through a connection that are neither a
|
|
112
114
|
// message nor a reaction (LinkedIn invitations, profile visits, InMail).
|
|
113
115
|
{ slug: 'channel-actions', name: 'Channel Actions' },
|
|
@@ -50,6 +50,7 @@ import type {
|
|
|
50
50
|
CreateConversationTypeRequest,
|
|
51
51
|
CreateEmailSignatureRequest,
|
|
52
52
|
CreateGlossaryTermRequest,
|
|
53
|
+
CreateMessageTemplateRequest,
|
|
53
54
|
CreateSendingRuleRequest,
|
|
54
55
|
CreateToneProfileSetupRequest,
|
|
55
56
|
CreateTranscriptionFromTextRequest,
|
|
@@ -92,7 +93,9 @@ import type {
|
|
|
92
93
|
ListGlossaryTermsQuery,
|
|
93
94
|
ListMeetingBotsQuery,
|
|
94
95
|
ListMessagesQuery,
|
|
96
|
+
ListMessageTemplatesQuery,
|
|
95
97
|
ListMistranscribedTermsQuery,
|
|
98
|
+
ListPermissionEventsResponse,
|
|
96
99
|
ListReactionsResponse,
|
|
97
100
|
ListResponse,
|
|
98
101
|
ListRoomsQuery,
|
|
@@ -107,12 +110,15 @@ import type {
|
|
|
107
110
|
Message,
|
|
108
111
|
MessageDraftVersions,
|
|
109
112
|
MessageSignature,
|
|
113
|
+
MessageTemplate,
|
|
110
114
|
MintCallTokenRequest,
|
|
111
115
|
MistranscribedTerm,
|
|
112
116
|
PerformChannelActionRequest,
|
|
113
117
|
PhoneNumber,
|
|
114
118
|
Reaction,
|
|
115
119
|
RecordPermissionEventRequest,
|
|
120
|
+
RenderedMessageTemplate,
|
|
121
|
+
RenderMessageTemplateRequest,
|
|
116
122
|
ResolveEmailSignatureQuery,
|
|
117
123
|
ResolveToneProfileQuery,
|
|
118
124
|
RespondChannelActionRequest,
|
|
@@ -146,6 +152,7 @@ import type {
|
|
|
146
152
|
UpdateDraftRequest,
|
|
147
153
|
UpdateEmailSignatureRequest,
|
|
148
154
|
UpdateGlossaryTermRequest,
|
|
155
|
+
UpdateMessageTemplateRequest,
|
|
149
156
|
UpdatePhoneNumberRequest,
|
|
150
157
|
UpdateSendingRuleRequest,
|
|
151
158
|
UpdateTranscriptionRequest,
|
|
@@ -177,6 +184,8 @@ export class ConversationClient {
|
|
|
177
184
|
/** Outbound send constraints: windows, connection limits, frequency caps + presets. */
|
|
178
185
|
readonly sendingRules: SendingRuleService
|
|
179
186
|
readonly emailSignatures: EmailSignatureService
|
|
187
|
+
/** Reusable messages and snippets, and rendering one for a recipient. */
|
|
188
|
+
readonly messageTemplates: MessageTemplateService
|
|
180
189
|
/**
|
|
181
190
|
* Channel actions: acts performed through a connection that are neither a
|
|
182
191
|
* message nor a reaction — LinkedIn invitations, profile visits, InMail.
|
|
@@ -225,6 +234,7 @@ export class ConversationClient {
|
|
|
225
234
|
this.conversationFilters = new ConversationFilterServiceImpl(client)
|
|
226
235
|
this.sendingRules = new SendingRuleServiceImpl(client)
|
|
227
236
|
this.emailSignatures = new EmailSignatureServiceImpl(client)
|
|
237
|
+
this.messageTemplates = new MessageTemplateServiceImpl(client)
|
|
228
238
|
this.channelActions = new ChannelActionServiceImpl(client)
|
|
229
239
|
this.channelEvents = new ChannelEventServiceImpl(client)
|
|
230
240
|
this.glossaryTerms = new GlossaryTermServiceImpl(client)
|
|
@@ -610,6 +620,8 @@ export interface ContactService {
|
|
|
610
620
|
unlinkRecord(linkId: string): Promise<void>
|
|
611
621
|
/** Fold source_contact_id into contactId (contactId wins). */
|
|
612
622
|
merge(contactId: string, request: MergeContactsRequest): Promise<Contact>
|
|
623
|
+
/** The contact's permission ledger, newest first, with per-purpose consent. */
|
|
624
|
+
listPermissionEvents(contactId: string): Promise<ListPermissionEventsResponse>
|
|
613
625
|
recordPermissionEvent(contactId: string, request: RecordPermissionEventRequest): Promise<Contact>
|
|
614
626
|
block(contactId: string, request?: BlockContactRequest): Promise<Contact>
|
|
615
627
|
unblock(contactId: string, request?: BlockContactRequest): Promise<Contact>
|
|
@@ -699,6 +711,13 @@ class ContactServiceImpl implements ContactService {
|
|
|
699
711
|
)
|
|
700
712
|
}
|
|
701
713
|
|
|
714
|
+
listPermissionEvents(contactId: string): Promise<ListPermissionEventsResponse> {
|
|
715
|
+
return this.client.request(
|
|
716
|
+
'GET',
|
|
717
|
+
`${CONVERSATION_BASE_PATH}/contacts/${encodeURIComponent(contactId)}/permission-events`,
|
|
718
|
+
)
|
|
719
|
+
}
|
|
720
|
+
|
|
702
721
|
recordPermissionEvent(
|
|
703
722
|
contactId: string,
|
|
704
723
|
request: RecordPermissionEventRequest,
|
|
@@ -2026,6 +2045,7 @@ class CallServiceImpl implements CallService {
|
|
|
2026
2045
|
}
|
|
2027
2046
|
|
|
2028
2047
|
export type * from './types.js'
|
|
2048
|
+
export { UNSUBSCRIBE_URL_PLACEHOLDER } from './types.js'
|
|
2029
2049
|
// Re-export voice types (the live dictation stream lives on this service now)
|
|
2030
2050
|
export type {
|
|
2031
2051
|
TranscribeStreamOptions,
|
|
@@ -2237,6 +2257,82 @@ class EmailSignatureServiceImpl implements EmailSignatureService {
|
|
|
2237
2257
|
}
|
|
2238
2258
|
}
|
|
2239
2259
|
|
|
2260
|
+
/**
|
|
2261
|
+
* Message templates: reusable messages and snippets whose subject and body are
|
|
2262
|
+
* Liquid templates. A send or a draft names one with its `template` field.
|
|
2263
|
+
*/
|
|
2264
|
+
export interface MessageTemplateService {
|
|
2265
|
+
list(query?: ListMessageTemplatesQuery): Promise<ListResponse<MessageTemplate>>
|
|
2266
|
+
/** By id or by key. */
|
|
2267
|
+
get(idOrKey: string): Promise<MessageTemplate>
|
|
2268
|
+
create(request: CreateMessageTemplateRequest): Promise<MessageTemplate>
|
|
2269
|
+
update(id: string, request: UpdateMessageTemplateRequest): Promise<MessageTemplate>
|
|
2270
|
+
/** Creates or replaces the template a key names; an equivalent body writes nothing. */
|
|
2271
|
+
upsertByKey(
|
|
2272
|
+
key: string,
|
|
2273
|
+
request: Omit<CreateMessageTemplateRequest, 'key'>,
|
|
2274
|
+
): Promise<MessageTemplate>
|
|
2275
|
+
delete(id: string): Promise<void>
|
|
2276
|
+
/**
|
|
2277
|
+
* Fills in a stored or an inline template: what a send of it would store,
|
|
2278
|
+
* with the signature the email would get.
|
|
2279
|
+
*/
|
|
2280
|
+
render(request: RenderMessageTemplateRequest): Promise<RenderedMessageTemplate>
|
|
2281
|
+
}
|
|
2282
|
+
|
|
2283
|
+
class MessageTemplateServiceImpl implements MessageTemplateService {
|
|
2284
|
+
constructor(private readonly client: ProteosClient) {}
|
|
2285
|
+
|
|
2286
|
+
list(query: ListMessageTemplatesQuery = {}): Promise<ListResponse<MessageTemplate>> {
|
|
2287
|
+
return this.client.requestWithQuery('GET', `${CONVERSATION_BASE_PATH}/message-templates`, query)
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
get(idOrKey: string): Promise<MessageTemplate> {
|
|
2291
|
+
return this.client.request(
|
|
2292
|
+
'GET',
|
|
2293
|
+
`${CONVERSATION_BASE_PATH}/message-templates/${encodeURIComponent(idOrKey)}`,
|
|
2294
|
+
)
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
create(request: CreateMessageTemplateRequest): Promise<MessageTemplate> {
|
|
2298
|
+
return this.client.request('POST', `${CONVERSATION_BASE_PATH}/message-templates`, request)
|
|
2299
|
+
}
|
|
2300
|
+
|
|
2301
|
+
update(id: string, request: UpdateMessageTemplateRequest): Promise<MessageTemplate> {
|
|
2302
|
+
return this.client.request(
|
|
2303
|
+
'PATCH',
|
|
2304
|
+
`${CONVERSATION_BASE_PATH}/message-templates/${encodeURIComponent(id)}`,
|
|
2305
|
+
request,
|
|
2306
|
+
)
|
|
2307
|
+
}
|
|
2308
|
+
|
|
2309
|
+
upsertByKey(
|
|
2310
|
+
key: string,
|
|
2311
|
+
request: Omit<CreateMessageTemplateRequest, 'key'>,
|
|
2312
|
+
): Promise<MessageTemplate> {
|
|
2313
|
+
return this.client.request(
|
|
2314
|
+
'PUT',
|
|
2315
|
+
`${CONVERSATION_BASE_PATH}/message-templates/${encodeURIComponent(key)}`,
|
|
2316
|
+
request,
|
|
2317
|
+
)
|
|
2318
|
+
}
|
|
2319
|
+
|
|
2320
|
+
async delete(id: string): Promise<void> {
|
|
2321
|
+
await this.client.request(
|
|
2322
|
+
'DELETE',
|
|
2323
|
+
`${CONVERSATION_BASE_PATH}/message-templates/${encodeURIComponent(id)}`,
|
|
2324
|
+
)
|
|
2325
|
+
}
|
|
2326
|
+
|
|
2327
|
+
render(request: RenderMessageTemplateRequest): Promise<RenderedMessageTemplate> {
|
|
2328
|
+
return this.client.request(
|
|
2329
|
+
'POST',
|
|
2330
|
+
`${CONVERSATION_BASE_PATH}/message-templates/render`,
|
|
2331
|
+
request,
|
|
2332
|
+
)
|
|
2333
|
+
}
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2240
2336
|
/**
|
|
2241
2337
|
* Channel actions — the ledger of acts performed through a connection that
|
|
2242
2338
|
* are neither a message nor a reaction (LinkedIn invitations, profile visits,
|
|
@@ -560,6 +560,20 @@ export interface Message {
|
|
|
560
560
|
* a send would add now. Never part of `content`.
|
|
561
561
|
*/
|
|
562
562
|
signature?: MessageSignature
|
|
563
|
+
/**
|
|
564
|
+
* This email is sent with an unsubscribe link of its own. The link exists
|
|
565
|
+
* only in what the recipient gets; `content` keeps `UNSUBSCRIBE_URL_PLACEHOLDER`
|
|
566
|
+
* or nothing.
|
|
567
|
+
*/
|
|
568
|
+
has_unsubscribe_link?: boolean
|
|
569
|
+
/** The layout chosen for this email (a message template of kind `layout`). Absent means none. May no longer resolve, which fails the send. */
|
|
570
|
+
layout_id?: string
|
|
571
|
+
/**
|
|
572
|
+
* The frame the email carries around its body. On a sent message, the
|
|
573
|
+
* snapshot of what went out. On a single draft read, what a send would use
|
|
574
|
+
* now. Never part of `content`.
|
|
575
|
+
*/
|
|
576
|
+
layout?: MessageLayout
|
|
563
577
|
/** The platform wrote this message (a send or a draft): its content is what the person wrote, without the quote the email carried. Absent on mail imported from the mailbox. */
|
|
564
578
|
is_sent_from_platform?: boolean
|
|
565
579
|
/** The newest entry in this draft's history; absent until its first change. */
|
|
@@ -760,6 +774,30 @@ export interface SendMessageRequest {
|
|
|
760
774
|
* never part of `content`. Ignored on every channel but email.
|
|
761
775
|
*/
|
|
762
776
|
signature?: SignatureChoice
|
|
777
|
+
/**
|
|
778
|
+
* Sends a stored message template instead of `content`: its id or key. It is
|
|
779
|
+
* rendered with `variables` at this moment and stored on the message like any
|
|
780
|
+
* content. `subject`, when omitted, is the template's.
|
|
781
|
+
*/
|
|
782
|
+
template?: string
|
|
783
|
+
/** The names the template's Liquid reads. Ignored without `template`. */
|
|
784
|
+
variables?: Record<string, unknown>
|
|
785
|
+
/**
|
|
786
|
+
* `link` gives the email an unsubscribe link of its own that records an
|
|
787
|
+
* opt-out in the contact's permission ledger; `none` (or omitted) gives it
|
|
788
|
+
* none. The link replaces every `UNSUBSCRIBE_URL_PLACEHOLDER` in the body
|
|
789
|
+
* (what `{{ unsubscribe_url }}` renders to) and goes into a footer line when
|
|
790
|
+
* the body has none. Email only, to exactly one recipient: anything else is
|
|
791
|
+
* refused with 400 `unsubscribe_not_possible`.
|
|
792
|
+
*/
|
|
793
|
+
unsubscribe?: UnsubscribeChoice
|
|
794
|
+
/**
|
|
795
|
+
* Wraps the body in a stored layout when the email is sent: the id or key
|
|
796
|
+
* of a message template of kind `layout`, `none` (or omitted) for no layout.
|
|
797
|
+
* `content` stays as written; the message keeps a snapshot of the layout
|
|
798
|
+
* that went out. Ignored on every channel but email.
|
|
799
|
+
*/
|
|
800
|
+
layout?: string
|
|
763
801
|
/** Reply mode: send into this existing conversation. */
|
|
764
802
|
conversation_id?: string
|
|
765
803
|
/**
|
|
@@ -881,6 +919,10 @@ export interface UpdateDraftRequest {
|
|
|
881
919
|
* carries the `signature` the draft now resolves to.
|
|
882
920
|
*/
|
|
883
921
|
signature?: SignatureChoice
|
|
922
|
+
/** Replaces the draft's unsubscribe choice. Omit to keep it. */
|
|
923
|
+
unsubscribe?: UnsubscribeChoice
|
|
924
|
+
/** Replaces the draft's layout: `none`, or a layout's id or key. Omit to keep it. */
|
|
925
|
+
layout?: string
|
|
884
926
|
/** What this edit is in the draft's history. Defaults to `edited`. */
|
|
885
927
|
version_kind?: Exclude<MessageDraftVersionKind, 'drafted'>
|
|
886
928
|
/** The reviewer's prompt behind a redraft. */
|
|
@@ -2489,6 +2531,11 @@ export type ContactSource = 'sync' | 'ingest' | 'manual' | 'merge'
|
|
|
2489
2531
|
export type ContactStatus = 'active' | 'merged' | 'archived' | 'erased'
|
|
2490
2532
|
export type ConsentStatus = 'unknown' | 'opted_in' | 'opted_out'
|
|
2491
2533
|
export type PermissionEventType = 'opt_in' | 'opt_out' | 'block' | 'unblock'
|
|
2534
|
+
/**
|
|
2535
|
+
* Why a message is sent — the unit a person consents to. A fixed set.
|
|
2536
|
+
* `transactional` is never consent-gated (only blocks and erasure stop it).
|
|
2537
|
+
*/
|
|
2538
|
+
export type Purpose = 'transactional' | 'service' | 'sales' | 'marketing' | 'newsletter'
|
|
2492
2539
|
/**
|
|
2493
2540
|
* Where a permission event came from. `provider` = the sending platform
|
|
2494
2541
|
* observed it (its unsubscribe link, a spam complaint relayed by the mailbox
|
|
@@ -2589,6 +2636,8 @@ export interface ContactPermissionEvent {
|
|
|
2589
2636
|
/** Scopes the event to one address; absent/empty = contact-level. */
|
|
2590
2637
|
contact_address_id?: string
|
|
2591
2638
|
event: PermissionEventType
|
|
2639
|
+
/** Narrows a consent event to one purpose; absent = all purposes. */
|
|
2640
|
+
purpose?: Purpose
|
|
2592
2641
|
basis?: string
|
|
2593
2642
|
source: PermissionEventSource
|
|
2594
2643
|
occurred_at: string
|
|
@@ -2598,6 +2647,24 @@ export interface ContactPermissionEvent {
|
|
|
2598
2647
|
created_by: UserRef
|
|
2599
2648
|
}
|
|
2600
2649
|
|
|
2650
|
+
/** A contact's consent for one purpose, derived from the ledger (not stored). */
|
|
2651
|
+
export interface ContactPurposeStatus {
|
|
2652
|
+
purpose: Exclude<Purpose, 'transactional'>
|
|
2653
|
+
status: ConsentStatus
|
|
2654
|
+
/** The ledger event that set `status`; absent when unknown. */
|
|
2655
|
+
decided_by_event_id?: string
|
|
2656
|
+
/** True when that event applies to all purposes. */
|
|
2657
|
+
is_inherited: boolean
|
|
2658
|
+
/** Addresses opted out of this purpose (or all) on their own scope. */
|
|
2659
|
+
opted_out_address_ids: string[]
|
|
2660
|
+
}
|
|
2661
|
+
|
|
2662
|
+
/** A contact's ledger, newest first, with the per-purpose consent. */
|
|
2663
|
+
export interface ListPermissionEventsResponse {
|
|
2664
|
+
data: ContactPermissionEvent[]
|
|
2665
|
+
purposes: ContactPurposeStatus[]
|
|
2666
|
+
}
|
|
2667
|
+
|
|
2601
2668
|
/** One candidate duplicate pair awaiting review. */
|
|
2602
2669
|
export interface ContactMergeProposal {
|
|
2603
2670
|
id: string
|
|
@@ -2768,7 +2835,16 @@ export interface MergeContactsRequest {
|
|
|
2768
2835
|
|
|
2769
2836
|
export interface RecordPermissionEventRequest {
|
|
2770
2837
|
contact_address_id?: string
|
|
2838
|
+
/**
|
|
2839
|
+
* Scopes the event to the contact's address with this value (an email
|
|
2840
|
+
* address, a phone number) when the caller does not know its id. Refused
|
|
2841
|
+
* with 400 when the contact has no such address. Ignored when
|
|
2842
|
+
* `contact_address_id` is set.
|
|
2843
|
+
*/
|
|
2844
|
+
address?: string
|
|
2771
2845
|
event: PermissionEventType
|
|
2846
|
+
/** One purpose; absent = all purposes. Consent events only; never `transactional`. */
|
|
2847
|
+
purpose?: Purpose
|
|
2772
2848
|
basis?: string
|
|
2773
2849
|
source?: PermissionEventSource
|
|
2774
2850
|
occurred_at?: string
|
|
@@ -3309,6 +3385,28 @@ export interface MessageSignature {
|
|
|
3309
3385
|
text: string
|
|
3310
3386
|
}
|
|
3311
3387
|
|
|
3388
|
+
/** A send's, draft's or draft edit's pick of an unsubscribe link: none, or a link of the email's own. */
|
|
3389
|
+
export type UnsubscribeChoice = 'none' | 'link'
|
|
3390
|
+
|
|
3391
|
+
/**
|
|
3392
|
+
* What `{{ unsubscribe_url }}` renders to before a message exists. A send with
|
|
3393
|
+
* `unsubscribe: 'link'` swaps every occurrence for the recipient's own link;
|
|
3394
|
+
* an email sent without one (a test send, a preview) gets the address of a
|
|
3395
|
+
* page that says so.
|
|
3396
|
+
*/
|
|
3397
|
+
export const UNSUBSCRIBE_URL_PLACEHOLDER = 'https://unsubscribe.invalid/link'
|
|
3398
|
+
|
|
3399
|
+
/** The layout an email went out in, as stored on the message: a snapshot, since the layout itself may change or go. */
|
|
3400
|
+
export interface MessageLayout {
|
|
3401
|
+
id: string
|
|
3402
|
+
key?: string
|
|
3403
|
+
name: string
|
|
3404
|
+
/** The frame, with `{{ content }}` where the body goes. */
|
|
3405
|
+
html: string
|
|
3406
|
+
/** The frame of the plain part; absent leaves the text as written. */
|
|
3407
|
+
text?: string
|
|
3408
|
+
}
|
|
3409
|
+
|
|
3312
3410
|
export interface CreateEmailSignatureRequest {
|
|
3313
3411
|
name: string
|
|
3314
3412
|
/** `html` or `text` is required. */
|
|
@@ -3343,6 +3441,129 @@ export interface ResolveEmailSignatureQuery {
|
|
|
3343
3441
|
is_reply?: boolean
|
|
3344
3442
|
}
|
|
3345
3443
|
|
|
3444
|
+
/**
|
|
3445
|
+
* What a message template holds: a whole message, a piece of a body, or a
|
|
3446
|
+
* layout. A layout is the frame of a designed email: html (and optionally
|
|
3447
|
+
* text) with `{{ content }}` where the body goes. A send names it with
|
|
3448
|
+
* `layout`; it is never sent on its own.
|
|
3449
|
+
*/
|
|
3450
|
+
export type MessageTemplateKind = 'message' | 'snippet' | 'layout'
|
|
3451
|
+
|
|
3452
|
+
/**
|
|
3453
|
+
* A reusable message, or a reusable piece of one. `subject`, `html` and `text`
|
|
3454
|
+
* are Liquid templates: `{{ contact.first_name }}` is filled in from the
|
|
3455
|
+
* variables a render or a send passes.
|
|
3456
|
+
*
|
|
3457
|
+
* A template is copied into what uses it (a sequence step, a reply), never
|
|
3458
|
+
* referenced from it. A send that names one renders it at that moment.
|
|
3459
|
+
*/
|
|
3460
|
+
export interface MessageTemplate {
|
|
3461
|
+
id: string
|
|
3462
|
+
org_id: string
|
|
3463
|
+
/** The name modules and workflows use; absent for a template nothing refers to. */
|
|
3464
|
+
key?: string
|
|
3465
|
+
name: string
|
|
3466
|
+
description?: string
|
|
3467
|
+
kind: MessageTemplateKind
|
|
3468
|
+
/** The one channel it is written for; absent for any. */
|
|
3469
|
+
channel?: Channel
|
|
3470
|
+
/** The language it is written in, such as `de` or `en-GB`. */
|
|
3471
|
+
language?: string
|
|
3472
|
+
tags: string[]
|
|
3473
|
+
/** A snippet has none. */
|
|
3474
|
+
subject?: string
|
|
3475
|
+
/** Sanitized like every stored email html, its Liquid kept as written. Empty for a text-only template. */
|
|
3476
|
+
html: string
|
|
3477
|
+
/** The plain body; derived from `html` unless `is_text_custom`. */
|
|
3478
|
+
text: string
|
|
3479
|
+
is_text_custom: boolean
|
|
3480
|
+
/** The person it belongs to; absent for the organisation. */
|
|
3481
|
+
owned_by?: UserRef
|
|
3482
|
+
/** The module that deployed it; absent for one made by hand. */
|
|
3483
|
+
module_slug?: string
|
|
3484
|
+
is_archived: boolean
|
|
3485
|
+
created_at: string
|
|
3486
|
+
created_by: UserRef
|
|
3487
|
+
updated_at: string
|
|
3488
|
+
updated_by: UserRef
|
|
3489
|
+
}
|
|
3490
|
+
|
|
3491
|
+
export interface CreateMessageTemplateRequest {
|
|
3492
|
+
key?: string
|
|
3493
|
+
name: string
|
|
3494
|
+
description?: string
|
|
3495
|
+
/** Defaults to `message`. */
|
|
3496
|
+
kind?: MessageTemplateKind
|
|
3497
|
+
/** Empty or omitted writes it for any channel. */
|
|
3498
|
+
channel?: Channel | ''
|
|
3499
|
+
language?: string
|
|
3500
|
+
tags?: string[]
|
|
3501
|
+
subject?: string
|
|
3502
|
+
/** `html` or `text` is required. */
|
|
3503
|
+
html?: string
|
|
3504
|
+
/** Left empty, it is derived from `html`. */
|
|
3505
|
+
text?: string
|
|
3506
|
+
/** Empty or omitted makes it the organisation's. */
|
|
3507
|
+
owned_by_id?: string
|
|
3508
|
+
module_slug?: string
|
|
3509
|
+
is_archived?: boolean
|
|
3510
|
+
}
|
|
3511
|
+
|
|
3512
|
+
/**
|
|
3513
|
+
* Omitted fields keep what is stored. `text` sent empty goes back to being
|
|
3514
|
+
* derived; `key` sent empty takes the name away.
|
|
3515
|
+
*/
|
|
3516
|
+
export type UpdateMessageTemplateRequest = Partial<
|
|
3517
|
+
Omit<CreateMessageTemplateRequest, 'module_slug'>
|
|
3518
|
+
>
|
|
3519
|
+
|
|
3520
|
+
export interface ListMessageTemplatesQuery extends PaginationQuery {
|
|
3521
|
+
kind?: MessageTemplateKind
|
|
3522
|
+
/** Also finds templates written for any channel. */
|
|
3523
|
+
channel?: Channel
|
|
3524
|
+
language?: string
|
|
3525
|
+
module_slug?: string
|
|
3526
|
+
tag?: string
|
|
3527
|
+
/** Matches the name, the key and the description. */
|
|
3528
|
+
search?: string
|
|
3529
|
+
owned_by_id?: string
|
|
3530
|
+
/** true: the organisation's own; false: everyone's personal ones. */
|
|
3531
|
+
is_organisation?: boolean
|
|
3532
|
+
/** Archived templates are left out unless this is true. */
|
|
3533
|
+
is_archived?: boolean
|
|
3534
|
+
}
|
|
3535
|
+
|
|
3536
|
+
/**
|
|
3537
|
+
* Fills in a template's variables. `template` names a stored template by id
|
|
3538
|
+
* or key; without it `subject`, `html` and `text` are the template itself.
|
|
3539
|
+
*/
|
|
3540
|
+
export interface RenderMessageTemplateRequest {
|
|
3541
|
+
template?: string
|
|
3542
|
+
subject?: string
|
|
3543
|
+
html?: string
|
|
3544
|
+
text?: string
|
|
3545
|
+
/** The names the Liquid reads: `{{ contact.first_name }}` reads `variables.contact.first_name`. */
|
|
3546
|
+
variables?: Record<string, unknown>
|
|
3547
|
+
/** Picked as a send picks it, for `connection_id`, `owned_by_id` and `is_reply`. */
|
|
3548
|
+
signature?: SignatureChoice
|
|
3549
|
+
connection_id?: string
|
|
3550
|
+
owned_by_id?: string
|
|
3551
|
+
is_reply?: boolean
|
|
3552
|
+
/** The layout the email would be sent in: its id or key, `none` or omitted for none. The answer carries it beside the body, which comes back without it. */
|
|
3553
|
+
layout?: string
|
|
3554
|
+
}
|
|
3555
|
+
|
|
3556
|
+
/** What a send of the template would store, and the signature that would go below it. */
|
|
3557
|
+
export interface RenderedMessageTemplate {
|
|
3558
|
+
subject: string
|
|
3559
|
+
/** Sanitized, with the editor's look. Empty for a text-only template. */
|
|
3560
|
+
html: string
|
|
3561
|
+
text: string
|
|
3562
|
+
signature: MessageSignature | null
|
|
3563
|
+
/** The frame the email would go out in, `{{ content }}` marking where the body and the signature go. Null or absent without one. */
|
|
3564
|
+
layout?: MessageLayout | null
|
|
3565
|
+
}
|
|
3566
|
+
|
|
3346
3567
|
export interface SendingRule {
|
|
3347
3568
|
id: string
|
|
3348
3569
|
org_id: string
|
package/src/index.ts
CHANGED
|
@@ -333,6 +333,8 @@ export type {
|
|
|
333
333
|
ContactGroupService,
|
|
334
334
|
ContactGroupSource,
|
|
335
335
|
ContactMergeProposal,
|
|
336
|
+
ContactPermissionEvent,
|
|
337
|
+
ContactPurposeStatus,
|
|
336
338
|
ContactRecordLink,
|
|
337
339
|
ContactRecordLinkSource,
|
|
338
340
|
ContactRef,
|
|
@@ -421,6 +423,7 @@ export type {
|
|
|
421
423
|
CreateConversationTypeRequest,
|
|
422
424
|
CreateEmailSignatureRequest,
|
|
423
425
|
CreateGlossaryTermRequest,
|
|
426
|
+
CreateMessageTemplateRequest,
|
|
424
427
|
CreateSendingRuleRequest,
|
|
425
428
|
CreateToneProfileSetupRequest,
|
|
426
429
|
CreateTranscriptionFromTextRequest,
|
|
@@ -479,7 +482,9 @@ export type {
|
|
|
479
482
|
ListGlossaryTermsQuery,
|
|
480
483
|
ListMeetingBotsQuery,
|
|
481
484
|
ListMessagesQuery,
|
|
485
|
+
ListMessageTemplatesQuery,
|
|
482
486
|
ListMistranscribedTermsQuery,
|
|
487
|
+
ListPermissionEventsResponse,
|
|
483
488
|
// Conversation-local page envelope ({meta, data}) — distinct from the
|
|
484
489
|
// PageIterator-based ListResult used by the other modules.
|
|
485
490
|
ListResponse,
|
|
@@ -503,11 +508,15 @@ export type {
|
|
|
503
508
|
MessageDraftVersion,
|
|
504
509
|
MessageDraftVersionKind,
|
|
505
510
|
MessageDraftVersions,
|
|
511
|
+
MessageLayout,
|
|
506
512
|
MessagePreview,
|
|
507
513
|
MessageRecipient,
|
|
508
514
|
MessageService,
|
|
509
515
|
MessageSignature,
|
|
510
516
|
MessageStatus,
|
|
517
|
+
MessageTemplate,
|
|
518
|
+
MessageTemplateKind,
|
|
519
|
+
MessageTemplateService,
|
|
511
520
|
MintCallTokenRequest,
|
|
512
521
|
MistranscribedTerm,
|
|
513
522
|
MistranscribedTermService,
|
|
@@ -520,6 +529,7 @@ export type {
|
|
|
520
529
|
PhoneNumberRouting,
|
|
521
530
|
PhoneNumberStatus,
|
|
522
531
|
ProfileVisitParams,
|
|
532
|
+
Purpose,
|
|
523
533
|
Reaction,
|
|
524
534
|
ReactionCapability,
|
|
525
535
|
ReactionOption,
|
|
@@ -527,6 +537,8 @@ export type {
|
|
|
527
537
|
RecipientKind,
|
|
528
538
|
RecipientRole,
|
|
529
539
|
RecordPermissionEventRequest,
|
|
540
|
+
RenderedMessageTemplate,
|
|
541
|
+
RenderMessageTemplateRequest,
|
|
530
542
|
ResolveEmailSignatureQuery,
|
|
531
543
|
ResolveToneProfileQuery,
|
|
532
544
|
RespondChannelActionRequest,
|
|
@@ -563,6 +575,7 @@ export type {
|
|
|
563
575
|
TwilioPhoneVoicemailSettings,
|
|
564
576
|
UnreadCounts,
|
|
565
577
|
UnreadCountsQuery,
|
|
578
|
+
UnsubscribeChoice,
|
|
566
579
|
UpdateAgentListenerRequest,
|
|
567
580
|
UpdateConnectionRequest,
|
|
568
581
|
UpdateContactGroupRequest,
|
|
@@ -579,6 +592,7 @@ export type {
|
|
|
579
592
|
UpdateDraftRequest,
|
|
580
593
|
UpdateEmailSignatureRequest,
|
|
581
594
|
UpdateGlossaryTermRequest,
|
|
595
|
+
UpdateMessageTemplateRequest,
|
|
582
596
|
UpdatePhoneNumberRequest,
|
|
583
597
|
UpdateSendingRuleRequest,
|
|
584
598
|
UpsertToneProfileRequest,
|
|
@@ -590,7 +604,7 @@ export type {
|
|
|
590
604
|
WindowRuleConfig,
|
|
591
605
|
} from './conversation/index.js'
|
|
592
606
|
// Conversation client (conversation-service)
|
|
593
|
-
export { ConversationClient } from './conversation/index.js'
|
|
607
|
+
export { ConversationClient, UNSUBSCRIBE_URL_PLACEHOLDER } from './conversation/index.js'
|
|
594
608
|
export type {
|
|
595
609
|
ApproveRecordDraftRequest,
|
|
596
610
|
BatchTransactionError,
|