@gpt-platform/client 0.11.0 → 0.11.2
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/_internal/sdk.gen.d.ts +1101 -8
- package/dist/_internal/sdk.gen.d.ts.map +1 -1
- package/dist/_internal/types.gen.d.ts +38447 -64456
- package/dist/_internal/types.gen.d.ts.map +1 -1
- package/dist/gpt-client.d.ts +341 -73
- package/dist/gpt-client.d.ts.map +1 -1
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8005 -417
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8004 -417
- package/dist/index.mjs.map +1 -1
- package/dist/namespaces/agents.d.ts +125 -1
- package/dist/namespaces/agents.d.ts.map +1 -1
- package/dist/namespaces/ai.d.ts +144 -0
- package/dist/namespaces/ai.d.ts.map +1 -1
- package/dist/namespaces/billing.d.ts +36 -0
- package/dist/namespaces/billing.d.ts.map +1 -1
- package/dist/namespaces/campaigns.d.ts +410 -15
- package/dist/namespaces/campaigns.d.ts.map +1 -1
- package/dist/namespaces/channels.d.ts +4 -0
- package/dist/namespaces/channels.d.ts.map +1 -1
- package/dist/namespaces/clinical.d.ts +40 -8
- package/dist/namespaces/clinical.d.ts.map +1 -1
- package/dist/namespaces/crm.d.ts +299 -10
- package/dist/namespaces/crm.d.ts.map +1 -1
- package/dist/namespaces/email.d.ts +534 -257
- package/dist/namespaces/email.d.ts.map +1 -1
- package/dist/namespaces/extraction.d.ts +369 -1
- package/dist/namespaces/extraction.d.ts.map +1 -1
- package/dist/namespaces/imports.d.ts +12 -25
- package/dist/namespaces/imports.d.ts.map +1 -1
- package/dist/namespaces/index.d.ts +9 -4
- package/dist/namespaces/index.d.ts.map +1 -1
- package/dist/namespaces/invoices.d.ts +1055 -0
- package/dist/namespaces/invoices.d.ts.map +1 -0
- package/dist/namespaces/recipes.d.ts +478 -0
- package/dist/namespaces/recipes.d.ts.map +1 -0
- package/dist/namespaces/scheduling.d.ts.map +1 -1
- package/dist/namespaces/threads.d.ts.map +1 -1
- package/dist/request-builder.d.ts +7 -0
- package/dist/request-builder.d.ts.map +1 -1
- package/dist/version.d.ts +1 -1
- package/llms.txt +283 -0
- package/package.json +1 -1
|
@@ -1,89 +1,213 @@
|
|
|
1
1
|
import type { EmailOutboundEmail, EmailMarketingSenderProfile, EmailTrackingEvent, EmailUnsubscriber, EmailRecipient, EmailInclusion, EmailInboundAddress, EmailInboundEmail } from "../_internal/types.gen";
|
|
2
|
-
/**
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
/** Context reference type — links an email to a domain entity for history tracking. */
|
|
3
|
+
export type ContextRefType = "custom" | "deal" | "session" | "ticket";
|
|
4
|
+
/** Inclusion content category. */
|
|
5
|
+
export type InclusionType = "chart" | "custom" | "goal" | "metric" | "resource" | "supplement";
|
|
6
|
+
/** Recipient role on an outbound email. */
|
|
7
|
+
export type RecipientType = "to" | "cc" | "bcc";
|
|
8
|
+
/** Inbound email routing target. */
|
|
9
|
+
export type InboundRoutingTarget = "extraction" | "agent" | "invoices" | "crm";
|
|
10
|
+
/**
|
|
11
|
+
* A file attachment on an outbound email.
|
|
12
|
+
*
|
|
13
|
+
* Upload the file to platform storage first, then reference its
|
|
14
|
+
* `storage_key` here. Maximum 10 attachments per email.
|
|
15
|
+
*/
|
|
16
|
+
export interface EmailAttachment {
|
|
17
|
+
/** Platform storage key returned by the upload API. */
|
|
18
|
+
storage_key: string;
|
|
19
|
+
/** Display filename shown to the recipient (e.g. `"report.pdf"`). */
|
|
20
|
+
filename: string;
|
|
21
|
+
/** MIME type (e.g. `"application/pdf"`, `"image/png"`). */
|
|
22
|
+
content_type: string;
|
|
15
23
|
}
|
|
16
|
-
/**
|
|
17
|
-
|
|
18
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Attributes accepted when creating an outbound email draft.
|
|
26
|
+
*
|
|
27
|
+
* `workspace_id` is resolved from the authenticated actor's workspace
|
|
28
|
+
* context — do not pass it explicitly.
|
|
29
|
+
*/
|
|
30
|
+
export interface CreateOutboundEmailAttributes {
|
|
31
|
+
/** Email subject line. Required. */
|
|
19
32
|
subject: string;
|
|
33
|
+
/** HTML body content. */
|
|
20
34
|
body_html?: string;
|
|
35
|
+
/** Plain-text body (fallback for non-HTML clients). */
|
|
21
36
|
body_text?: string;
|
|
37
|
+
/** Sender profile to use. Falls back to workspace default if omitted. */
|
|
22
38
|
sender_profile_id?: string;
|
|
39
|
+
/** CRM contact reference for tracking. */
|
|
23
40
|
contact_ref_id?: string;
|
|
41
|
+
/** ID of the linked domain entity (deal, session, ticket). */
|
|
24
42
|
context_ref_id?: string;
|
|
25
|
-
|
|
43
|
+
/** Type of the linked domain entity. */
|
|
44
|
+
context_ref_type?: ContextRefType;
|
|
45
|
+
/** Append a CAN-SPAM unsubscribe link to the email footer. */
|
|
26
46
|
include_unsubscribe_link?: boolean;
|
|
27
|
-
attachments
|
|
28
|
-
[
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
|
|
47
|
+
/** File attachments (max 10). Upload files first, then reference storage keys. */
|
|
48
|
+
attachments?: EmailAttachment[];
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Attributes accepted when updating an outbound email (PATCH semantics).
|
|
52
|
+
*
|
|
53
|
+
* Only emails in `draft` status can be updated.
|
|
54
|
+
*/
|
|
55
|
+
export interface UpdateOutboundEmailAttributes {
|
|
56
|
+
/** Updated subject line. */
|
|
32
57
|
subject?: string;
|
|
58
|
+
/** Updated HTML body. */
|
|
33
59
|
body_html?: string;
|
|
60
|
+
/** Updated plain-text body. */
|
|
34
61
|
body_text?: string;
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
|
|
39
|
-
|
|
62
|
+
/** Change the sender profile. */
|
|
63
|
+
sender_profile_id?: string;
|
|
64
|
+
/** Toggle unsubscribe link. */
|
|
65
|
+
include_unsubscribe_link?: boolean;
|
|
66
|
+
/** Replace the attachment list. */
|
|
67
|
+
attachments?: EmailAttachment[];
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Attributes accepted when creating a sender profile.
|
|
71
|
+
*
|
|
72
|
+
* `workspace_id` is resolved from the authenticated actor's workspace
|
|
73
|
+
* context — do not pass it explicitly.
|
|
74
|
+
*/
|
|
75
|
+
export interface CreateSenderProfileAttributes {
|
|
76
|
+
/** Sender email address. Must be unique per workspace. */
|
|
40
77
|
email: string;
|
|
78
|
+
/** Display name shown in the From header. */
|
|
41
79
|
name: string;
|
|
80
|
+
/** Physical mailing address (CAN-SPAM compliance). */
|
|
42
81
|
address?: string;
|
|
82
|
+
/** Company name for the email footer. */
|
|
43
83
|
company?: string;
|
|
84
|
+
/** Set as the workspace default sender profile on creation. */
|
|
44
85
|
is_default?: boolean;
|
|
86
|
+
/** Contact phone number. */
|
|
45
87
|
phone?: string;
|
|
88
|
+
/** HTML signature block appended to outgoing emails. */
|
|
46
89
|
signature?: string;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Attributes accepted when updating a sender profile (PATCH semantics).
|
|
93
|
+
*/
|
|
94
|
+
export interface UpdateSenderProfileAttributes {
|
|
95
|
+
/** Updated display name. */
|
|
51
96
|
name?: string;
|
|
97
|
+
/** Updated mailing address. */
|
|
52
98
|
address?: string;
|
|
99
|
+
/** Updated company name. */
|
|
53
100
|
company?: string;
|
|
101
|
+
/** DKIM selector override (advanced — leave blank unless you manage DNS manually). */
|
|
54
102
|
dkim_selector?: string;
|
|
103
|
+
/** Change default status. */
|
|
55
104
|
is_default?: boolean;
|
|
105
|
+
/** Updated phone number. */
|
|
56
106
|
phone?: string;
|
|
107
|
+
/** Updated HTML signature. */
|
|
57
108
|
signature?: string;
|
|
58
|
-
|
|
59
|
-
|
|
109
|
+
}
|
|
110
|
+
/** Attributes accepted when adding a recipient to an outbound email. */
|
|
111
|
+
export interface CreateRecipientAttributes {
|
|
112
|
+
/** ID of the outbound email to attach this recipient to. */
|
|
113
|
+
outbound_email_id: string;
|
|
114
|
+
/** Recipient email address. */
|
|
115
|
+
email: string;
|
|
116
|
+
/** Recipient display name. */
|
|
117
|
+
name?: string;
|
|
118
|
+
/** Role: primary (`to`), carbon copy (`cc`), or blind copy (`bcc`). Defaults to `to`. */
|
|
119
|
+
recipient_type?: RecipientType;
|
|
120
|
+
}
|
|
121
|
+
/** Attributes accepted when attaching a structured data inclusion to a draft email. */
|
|
122
|
+
export interface CreateInclusionAttributes {
|
|
123
|
+
/** ID of the outbound email to attach this inclusion to. */
|
|
124
|
+
outbound_email_id: string;
|
|
125
|
+
/** Content category (goal, metric, chart, etc.). */
|
|
126
|
+
inclusion_type: InclusionType;
|
|
127
|
+
/** Platform object ID referenced by this inclusion. */
|
|
128
|
+
ref_id?: string;
|
|
129
|
+
/** Display title rendered in the email body. */
|
|
130
|
+
title?: string;
|
|
131
|
+
/** Structured payload (shape depends on `inclusion_type`). */
|
|
132
|
+
data?: Record<string, unknown>;
|
|
133
|
+
/** Ordering position within the email body (0-indexed). */
|
|
134
|
+
position?: number;
|
|
135
|
+
}
|
|
136
|
+
/** Attributes accepted when updating an inclusion (PATCH semantics). */
|
|
137
|
+
export interface UpdateInclusionAttributes {
|
|
138
|
+
/** Updated display title. */
|
|
139
|
+
title?: string;
|
|
140
|
+
/** Pre-rendered HTML for this inclusion block. */
|
|
141
|
+
rendered_html?: string;
|
|
142
|
+
/** Updated structured payload. */
|
|
143
|
+
data?: Record<string, unknown>;
|
|
144
|
+
/** Updated ordering position. */
|
|
145
|
+
position?: number;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Attributes accepted when creating an inbound address.
|
|
149
|
+
*
|
|
150
|
+
* Unlike outbound resources, `workspace_id` is an explicit argument here.
|
|
151
|
+
*/
|
|
152
|
+
export interface CreateInboundAddressAttributes {
|
|
153
|
+
/** Workspace to create the address in. */
|
|
154
|
+
workspace_id: string;
|
|
155
|
+
/** Human-readable label for this address. */
|
|
156
|
+
name: string;
|
|
157
|
+
/** Where received emails are routed for processing. */
|
|
158
|
+
routing_target: InboundRoutingTarget;
|
|
159
|
+
/** Routing-target-specific configuration. */
|
|
160
|
+
handler_config?: Record<string, unknown>;
|
|
161
|
+
/** Maximum attachment size in MB (1–100, default 25). */
|
|
162
|
+
max_attachment_size_mb?: number;
|
|
163
|
+
/** Restrict accepted MIME types. `null` allows all types. */
|
|
164
|
+
allowed_mime_types?: string[] | null;
|
|
165
|
+
/** Maximum emails accepted per day (1–10,000, default 100). */
|
|
166
|
+
daily_receive_limit?: number;
|
|
167
|
+
}
|
|
60
168
|
/** Attributes accepted when updating an inbound address (PATCH semantics). */
|
|
61
|
-
export
|
|
62
|
-
label
|
|
169
|
+
export interface UpdateInboundAddressAttributes {
|
|
170
|
+
/** Updated human-readable label. */
|
|
171
|
+
name?: string;
|
|
172
|
+
/** Change the routing target. */
|
|
173
|
+
routing_target?: InboundRoutingTarget;
|
|
174
|
+
/** Updated routing configuration. */
|
|
63
175
|
handler_config?: Record<string, unknown>;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
/**
|
|
176
|
+
/** Updated max attachment size in MB. */
|
|
177
|
+
max_attachment_size_mb?: number;
|
|
178
|
+
/** Updated MIME type restrictions. */
|
|
179
|
+
allowed_mime_types?: string[] | null;
|
|
180
|
+
/** Updated daily receive limit. */
|
|
181
|
+
daily_receive_limit?: number;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Parameters for AI-assisted email composition.
|
|
185
|
+
*
|
|
186
|
+
* The platform LLM generates a personalised subject and HTML body from your
|
|
187
|
+
* prompt and any structured context you provide. The result is saved as a
|
|
188
|
+
* draft for review before sending.
|
|
189
|
+
*
|
|
190
|
+
* `workspace_id` is resolved from the authenticated actor — do not pass it.
|
|
191
|
+
*/
|
|
67
192
|
export interface ComposeWithAiAttributes {
|
|
68
193
|
/** Email addresses of primary recipients. */
|
|
69
194
|
to: string[];
|
|
70
|
-
/** AI drafting instructions (e.g
|
|
195
|
+
/** AI drafting instructions (e.g. "Write a warm follow-up after our nutrition session"). */
|
|
71
196
|
prompt: string;
|
|
72
|
-
/** Workspace context for multi-tenancy routing. */
|
|
73
|
-
workspace_id: string;
|
|
74
197
|
/** Structured context data passed to the AI (session notes, goals, health metrics, etc.). */
|
|
75
198
|
context?: Record<string, unknown>;
|
|
76
199
|
/** Sender profile ID — uses workspace default if omitted. */
|
|
77
200
|
sender_profile_id?: string;
|
|
78
|
-
/**
|
|
201
|
+
/** CRM contact reference. */
|
|
79
202
|
contact_ref_id?: string;
|
|
80
|
-
/**
|
|
81
|
-
context_ref_type?:
|
|
203
|
+
/** Link the composed email to a domain entity. */
|
|
204
|
+
context_ref_type?: ContextRefType;
|
|
205
|
+
/** ID of the linked domain entity. */
|
|
82
206
|
context_ref_id?: string;
|
|
83
207
|
/** Include a CAN-SPAM unsubscribe link in the email footer. */
|
|
84
208
|
include_unsubscribe_link?: boolean;
|
|
85
209
|
}
|
|
86
|
-
/**
|
|
210
|
+
/** Result of a stateless MJML compilation. */
|
|
87
211
|
export interface MjmlCompileResult {
|
|
88
212
|
/** Compiled HTML output. Empty string if errors present. */
|
|
89
213
|
html: string;
|
|
@@ -92,7 +216,7 @@ export interface MjmlCompileResult {
|
|
|
92
216
|
/** MJML parser errors. */
|
|
93
217
|
errors: string[];
|
|
94
218
|
}
|
|
95
|
-
/**
|
|
219
|
+
/** A single entry in a template's variable schema. */
|
|
96
220
|
export interface TemplateVariableSchema {
|
|
97
221
|
/** Variable name (matches {{variable}} syntax in MJML). */
|
|
98
222
|
name: string;
|
|
@@ -101,7 +225,7 @@ export interface TemplateVariableSchema {
|
|
|
101
225
|
/** Default value shown in builder UI when no override is provided. */
|
|
102
226
|
default: string;
|
|
103
227
|
}
|
|
104
|
-
/**
|
|
228
|
+
/** Immutable snapshot of a template at a specific publish point. */
|
|
105
229
|
export interface TemplateVersion {
|
|
106
230
|
id: string;
|
|
107
231
|
template_id: string;
|
|
@@ -126,9 +250,27 @@ import { RequestBuilder } from "../request-builder";
|
|
|
126
250
|
* ```typescript
|
|
127
251
|
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
128
252
|
*
|
|
129
|
-
* //
|
|
130
|
-
* const
|
|
131
|
-
*
|
|
253
|
+
* // Create a draft
|
|
254
|
+
* const draft = await client.email.outboundEmails.create({
|
|
255
|
+
* subject: 'Your weekly nutrition update',
|
|
256
|
+
* body_html: '<p>Hello!</p>',
|
|
257
|
+
* sender_profile_id: 'sp_abc123',
|
|
258
|
+
* });
|
|
259
|
+
*
|
|
260
|
+
* // Add recipients
|
|
261
|
+
* await client.email.recipients.create({
|
|
262
|
+
* outbound_email_id: draft.id,
|
|
263
|
+
* email: 'patient@example.com',
|
|
264
|
+
* name: 'Jane Doe',
|
|
265
|
+
* });
|
|
266
|
+
*
|
|
267
|
+
* // Send
|
|
268
|
+
* await client.email.outboundEmails.send(draft.id);
|
|
269
|
+
* ```
|
|
270
|
+
*
|
|
271
|
+
* @example AI-assisted composition
|
|
272
|
+
* ```typescript
|
|
273
|
+
* const draft = await client.email.outboundEmails.composeWithAi({
|
|
132
274
|
* to: ['patient@example.com'],
|
|
133
275
|
* prompt: 'Write a warm follow-up after a nutrition session',
|
|
134
276
|
* context: {
|
|
@@ -139,7 +281,7 @@ import { RequestBuilder } from "../request-builder";
|
|
|
139
281
|
* });
|
|
140
282
|
*
|
|
141
283
|
* // Review the draft, then send
|
|
142
|
-
* await client.email.outboundEmails.send(
|
|
284
|
+
* await client.email.outboundEmails.send(draft.id);
|
|
143
285
|
* ```
|
|
144
286
|
*/
|
|
145
287
|
export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
@@ -147,51 +289,55 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
|
147
289
|
* Outbound Emails — individual email composition and delivery.
|
|
148
290
|
*/
|
|
149
291
|
outboundEmails: {
|
|
150
|
-
/**
|
|
292
|
+
/**
|
|
293
|
+
* Get a single outbound email by ID.
|
|
294
|
+
*
|
|
295
|
+
* @param id - The unique identifier of the outbound email.
|
|
296
|
+
* @param options - Optional request-level overrides.
|
|
297
|
+
* @returns The requested {@link EmailOutboundEmail}.
|
|
298
|
+
*/
|
|
151
299
|
get: (id: string, options?: RequestOptions) => Promise<EmailOutboundEmail>;
|
|
152
300
|
/**
|
|
153
301
|
* Create a new outbound email draft.
|
|
154
302
|
*
|
|
155
|
-
* Creates a draft in `draft` status
|
|
156
|
-
*
|
|
157
|
-
*
|
|
303
|
+
* Creates a draft in `draft` status. Add recipients via
|
|
304
|
+
* `client.email.recipients.create()`, then call `send()` for immediate
|
|
305
|
+
* delivery or `schedule()` for future delivery.
|
|
306
|
+
*
|
|
307
|
+
* Workspace is resolved from the authenticated actor — do not pass
|
|
308
|
+
* `workspace_id`.
|
|
158
309
|
*
|
|
159
|
-
* @param attributes -
|
|
160
|
-
* `workspace_id`, `subject`, `body_html`, `body_text`, `sender_profile_id`.
|
|
310
|
+
* @param attributes - Email draft attributes. Only `subject` is required.
|
|
161
311
|
* @param options - Optional request-level overrides.
|
|
162
|
-
* @returns
|
|
312
|
+
* @returns The newly created {@link EmailOutboundEmail} draft.
|
|
163
313
|
*
|
|
164
314
|
* @example
|
|
165
315
|
* ```typescript
|
|
166
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
167
|
-
*
|
|
168
316
|
* const draft = await client.email.outboundEmails.create({
|
|
169
|
-
* workspace_id: 'ws_abc123',
|
|
170
317
|
* subject: 'Your weekly update',
|
|
171
318
|
* body_html: '<p>Hello!</p>',
|
|
172
319
|
* sender_profile_id: 'sp_noreply',
|
|
173
320
|
* });
|
|
174
|
-
* await client.email.outboundEmails.send(draft.id);
|
|
175
321
|
* ```
|
|
176
322
|
*/
|
|
177
323
|
create: (attributes: CreateOutboundEmailAttributes, options?: RequestOptions) => Promise<EmailOutboundEmail>;
|
|
178
324
|
/**
|
|
179
|
-
* AI-draft an email from a prompt and structured context
|
|
325
|
+
* AI-draft an email from a prompt and structured context.
|
|
180
326
|
*
|
|
181
327
|
* The platform LLM generates a personalised subject and body from your
|
|
182
328
|
* prompt and any context data you provide (session notes, goals, health
|
|
183
|
-
* metrics, etc.). The email is saved as a draft
|
|
184
|
-
*
|
|
329
|
+
* metrics, etc.). The email is saved as a draft — review it, then call
|
|
330
|
+
* `send()`.
|
|
185
331
|
*
|
|
186
|
-
* @param attributes -
|
|
187
|
-
*
|
|
332
|
+
* @param attributes - AI composition parameters. `to` and `prompt` are required.
|
|
333
|
+
* @param options - Optional request-level overrides.
|
|
334
|
+
* @returns The AI-generated {@link EmailOutboundEmail} draft.
|
|
188
335
|
*
|
|
189
336
|
* @example
|
|
190
337
|
* ```typescript
|
|
191
338
|
* const draft = await client.email.outboundEmails.composeWithAi({
|
|
192
339
|
* to: ['alice@example.com'],
|
|
193
340
|
* prompt: 'Write a warm post-session follow-up for a nutrition client',
|
|
194
|
-
* workspace_id: 'ws_abc123',
|
|
195
341
|
* context: { session_notes: 'Discussed protein goals...', protein_target: 120 },
|
|
196
342
|
* sender_profile_id: 'sp_xyz',
|
|
197
343
|
* include_unsubscribe_link: true,
|
|
@@ -201,23 +347,20 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
|
201
347
|
*/
|
|
202
348
|
composeWithAi: (attributes: ComposeWithAiAttributes, options?: RequestOptions) => Promise<EmailOutboundEmail>;
|
|
203
349
|
/**
|
|
204
|
-
* Update a draft outbound email
|
|
350
|
+
* Update a draft outbound email (PATCH semantics).
|
|
205
351
|
*
|
|
206
|
-
* Only
|
|
207
|
-
* An email can only be updated while in `draft` or `scheduled` status.
|
|
352
|
+
* Only emails in `draft` status can be updated.
|
|
208
353
|
*
|
|
209
|
-
* @param id - The
|
|
210
|
-
* @param attributes -
|
|
211
|
-
* `subject`, `body_html`, `body_text`, `sender_profile_id`).
|
|
354
|
+
* @param id - The outbound email ID.
|
|
355
|
+
* @param attributes - Fields to update.
|
|
212
356
|
* @param options - Optional request-level overrides.
|
|
213
|
-
* @returns
|
|
357
|
+
* @returns The updated {@link EmailOutboundEmail}.
|
|
214
358
|
*
|
|
215
359
|
* @example
|
|
216
360
|
* ```typescript
|
|
217
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
218
|
-
*
|
|
219
361
|
* const updated = await client.email.outboundEmails.update('oe_abc123', {
|
|
220
362
|
* subject: 'Updated subject line',
|
|
363
|
+
* body_html: '<p>Revised content</p>',
|
|
221
364
|
* });
|
|
222
365
|
* ```
|
|
223
366
|
*/
|
|
@@ -225,47 +368,73 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
|
225
368
|
/**
|
|
226
369
|
* Delete a draft outbound email.
|
|
227
370
|
*
|
|
228
|
-
* Only emails in `draft` status can be deleted.
|
|
229
|
-
* `failed` status are immutable — archive them via your application logic.
|
|
371
|
+
* Only emails in `draft` status can be deleted. Sent emails are immutable.
|
|
230
372
|
*
|
|
231
|
-
* @param id - The
|
|
373
|
+
* @param id - The outbound email ID.
|
|
232
374
|
* @param options - Optional request-level overrides.
|
|
233
|
-
* @returns
|
|
234
|
-
*
|
|
235
|
-
* @example
|
|
236
|
-
* ```typescript
|
|
237
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
238
|
-
*
|
|
239
|
-
* await client.email.outboundEmails.delete('oe_abc123');
|
|
240
|
-
* ```
|
|
375
|
+
* @returns `true` on successful deletion.
|
|
241
376
|
*/
|
|
242
377
|
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
243
378
|
/**
|
|
244
|
-
* Send a draft email immediately via the workspace's connected
|
|
379
|
+
* Send a draft email immediately via the workspace's connected account.
|
|
245
380
|
*
|
|
246
|
-
*
|
|
247
|
-
*
|
|
381
|
+
* Transitions the email to `ready` status. Delivery is asynchronous —
|
|
382
|
+
* poll for `sent` status or subscribe to the `OutboundEmailSent`
|
|
383
|
+
* WebSocket event.
|
|
248
384
|
*
|
|
249
|
-
*
|
|
385
|
+
* Requires a `sender_profile_id` to be set on the email and at least
|
|
386
|
+
* one recipient.
|
|
387
|
+
*
|
|
388
|
+
* @param id - The outbound email ID.
|
|
389
|
+
* @param options - Optional request-level overrides.
|
|
390
|
+
* @returns The email in `ready` status.
|
|
250
391
|
*/
|
|
251
392
|
send: (id: string, options?: RequestOptions) => Promise<EmailOutboundEmail>;
|
|
252
393
|
/**
|
|
253
394
|
* Schedule a draft for future delivery.
|
|
254
395
|
*
|
|
255
|
-
* @param id -
|
|
256
|
-
* @param attributes
|
|
396
|
+
* @param id - The outbound email ID.
|
|
397
|
+
* @param attributes - Must include `scheduled_for` as an ISO 8601 datetime.
|
|
398
|
+
* @param options - Optional request-level overrides.
|
|
399
|
+
* @returns The email in `scheduled` status.
|
|
400
|
+
*
|
|
401
|
+
* @example
|
|
402
|
+
* ```typescript
|
|
403
|
+
* await client.email.outboundEmails.schedule('oe_abc123', {
|
|
404
|
+
* scheduled_for: '2026-04-01T09:00:00Z',
|
|
405
|
+
* });
|
|
406
|
+
* ```
|
|
257
407
|
*/
|
|
258
408
|
schedule: (id: string, attributes: {
|
|
259
409
|
scheduled_for: string;
|
|
260
410
|
}, options?: RequestOptions) => Promise<EmailOutboundEmail>;
|
|
261
|
-
/**
|
|
411
|
+
/**
|
|
412
|
+
* Cancel a previously scheduled email (returns it to `draft` status).
|
|
413
|
+
*
|
|
414
|
+
* @param id - The outbound email ID.
|
|
415
|
+
* @param options - Optional request-level overrides.
|
|
416
|
+
* @returns The email back in `draft` status.
|
|
417
|
+
*/
|
|
262
418
|
cancelSchedule: (id: string, options?: RequestOptions) => Promise<EmailOutboundEmail>;
|
|
263
|
-
/**
|
|
419
|
+
/**
|
|
420
|
+
* List all outbound emails in a workspace.
|
|
421
|
+
*
|
|
422
|
+
* @param workspaceId - The workspace ID.
|
|
423
|
+
* @param options - Pagination (`page`, `pageSize`) and request-level overrides.
|
|
424
|
+
* @returns An array of {@link EmailOutboundEmail} records.
|
|
425
|
+
*/
|
|
264
426
|
listByWorkspace: (workspaceId: string, options?: {
|
|
265
427
|
page?: number;
|
|
266
428
|
pageSize?: number;
|
|
267
429
|
} & RequestOptions) => Promise<EmailOutboundEmail[]>;
|
|
268
|
-
/**
|
|
430
|
+
/**
|
|
431
|
+
* List emails sent to a specific contact within a workspace.
|
|
432
|
+
*
|
|
433
|
+
* @param workspaceId - The workspace ID.
|
|
434
|
+
* @param contactRefId - The CRM contact reference ID.
|
|
435
|
+
* @param options - Pagination and request-level overrides.
|
|
436
|
+
* @returns An array of {@link EmailOutboundEmail} records for the contact.
|
|
437
|
+
*/
|
|
269
438
|
listByContact: (workspaceId: string, contactRefId: string, options?: {
|
|
270
439
|
page?: number;
|
|
271
440
|
pageSize?: number;
|
|
@@ -273,29 +442,34 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
|
273
442
|
};
|
|
274
443
|
/**
|
|
275
444
|
* Sender Profiles — verified from-address identities for outgoing email.
|
|
445
|
+
*
|
|
446
|
+
* A sender profile defines the `From` name and email address used when
|
|
447
|
+
* sending. Before a profile can be used, its domain must be verified via
|
|
448
|
+
* DNS records (SPF, DKIM, DMARC). Call `validateDns()` after publishing
|
|
449
|
+
* DNS records.
|
|
276
450
|
*/
|
|
277
451
|
senderProfiles: {
|
|
278
|
-
/**
|
|
452
|
+
/**
|
|
453
|
+
* Get a sender profile by ID.
|
|
454
|
+
*
|
|
455
|
+
* @param id - The sender profile ID.
|
|
456
|
+
* @param options - Optional request-level overrides.
|
|
457
|
+
* @returns The requested {@link EmailMarketingSenderProfile}.
|
|
458
|
+
*/
|
|
279
459
|
get: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
|
|
280
460
|
/**
|
|
281
|
-
* Create a new sender profile
|
|
461
|
+
* Create a new sender profile.
|
|
282
462
|
*
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
* verified via DNS records (SPF, DKIM, DMARC). Call `validateDns()` to
|
|
286
|
-
* trigger verification after publishing DNS records.
|
|
463
|
+
* Workspace is resolved from the authenticated actor — do not pass
|
|
464
|
+
* `workspace_id`.
|
|
287
465
|
*
|
|
288
|
-
* @param attributes -
|
|
289
|
-
* `workspace_id`, `email`, `name`. Optional: `address`, `company`, `phone`, `signature`.
|
|
466
|
+
* @param attributes - Profile attributes. `email` and `name` are required.
|
|
290
467
|
* @param options - Optional request-level overrides.
|
|
291
|
-
* @returns
|
|
468
|
+
* @returns The newly created {@link EmailMarketingSenderProfile}.
|
|
292
469
|
*
|
|
293
470
|
* @example
|
|
294
471
|
* ```typescript
|
|
295
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
296
|
-
*
|
|
297
472
|
* const profile = await client.email.senderProfiles.create({
|
|
298
|
-
* workspace_id: 'ws_abc123',
|
|
299
473
|
* email: 'hello@acme.com',
|
|
300
474
|
* name: 'Acme Team',
|
|
301
475
|
* });
|
|
@@ -303,228 +477,313 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
|
303
477
|
* await client.email.senderProfiles.validateDns(profile.id);
|
|
304
478
|
* ```
|
|
305
479
|
*/
|
|
306
|
-
create: (attributes:
|
|
480
|
+
create: (attributes: CreateSenderProfileAttributes, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
|
|
307
481
|
/**
|
|
308
|
-
* Update a sender profile
|
|
482
|
+
* Update a sender profile (PATCH semantics).
|
|
309
483
|
*
|
|
310
|
-
*
|
|
311
|
-
*
|
|
312
|
-
* with `validateDns()` to confirm deliverability is not impacted.
|
|
484
|
+
* After changing domain-related fields, re-verify DNS with
|
|
485
|
+
* `validateDns()`.
|
|
313
486
|
*
|
|
314
|
-
* @param id - The
|
|
315
|
-
* @param attributes -
|
|
316
|
-
* `name`, `company`, `signature`).
|
|
487
|
+
* @param id - The sender profile ID.
|
|
488
|
+
* @param attributes - Fields to update.
|
|
317
489
|
* @param options - Optional request-level overrides.
|
|
318
|
-
* @returns
|
|
319
|
-
*
|
|
320
|
-
* @example
|
|
321
|
-
* ```typescript
|
|
322
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
323
|
-
*
|
|
324
|
-
* const profile = await client.email.senderProfiles.update('sp_abc123', {
|
|
325
|
-
* name: 'Acme Support',
|
|
326
|
-
* });
|
|
327
|
-
* ```
|
|
490
|
+
* @returns The updated {@link EmailMarketingSenderProfile}.
|
|
328
491
|
*/
|
|
329
|
-
update: (id: string, attributes:
|
|
492
|
+
update: (id: string, attributes: UpdateSenderProfileAttributes, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
|
|
330
493
|
/**
|
|
331
494
|
* Delete a sender profile.
|
|
332
495
|
*
|
|
333
|
-
*
|
|
334
|
-
*
|
|
496
|
+
* Emails and campaigns referencing this profile will need a replacement
|
|
497
|
+
* before sending.
|
|
335
498
|
*
|
|
336
|
-
* @param id - The
|
|
499
|
+
* @param id - The sender profile ID.
|
|
337
500
|
* @param options - Optional request-level overrides.
|
|
338
|
-
* @returns
|
|
501
|
+
* @returns `true` on successful deletion.
|
|
502
|
+
*/
|
|
503
|
+
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
504
|
+
/**
|
|
505
|
+
* Trigger DNS validation (verifies SPF/DKIM/DMARC records).
|
|
339
506
|
*
|
|
340
|
-
*
|
|
341
|
-
*
|
|
342
|
-
*
|
|
507
|
+
* Validation runs asynchronously via a background worker. Poll the
|
|
508
|
+
* profile's `spf_valid`, `dkim_valid`, and `dmarc_valid` fields for
|
|
509
|
+
* results.
|
|
343
510
|
*
|
|
344
|
-
*
|
|
345
|
-
*
|
|
511
|
+
* @param id - The sender profile ID.
|
|
512
|
+
* @param options - Optional request-level overrides.
|
|
513
|
+
* @returns The sender profile (DNS status may still be pending).
|
|
346
514
|
*/
|
|
347
|
-
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
348
|
-
/** Trigger DNS validation for a sender profile (verifies SPF/DKIM). */
|
|
349
515
|
validateDns: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
|
|
350
516
|
/**
|
|
351
517
|
* Set a sender profile as the workspace default.
|
|
352
518
|
*
|
|
353
|
-
* The default
|
|
354
|
-
*
|
|
355
|
-
* Only one profile can be the default per workspace at a time —
|
|
519
|
+
* The default profile is used automatically when no `sender_profile_id`
|
|
520
|
+
* is specified on an outbound email. Only one default per workspace —
|
|
356
521
|
* calling this replaces any previous default.
|
|
357
522
|
*
|
|
358
|
-
* @param id - The
|
|
523
|
+
* @param id - The sender profile ID.
|
|
359
524
|
* @param options - Optional request-level overrides.
|
|
360
|
-
* @returns
|
|
361
|
-
* with `is_default` set to `true`.
|
|
362
|
-
*
|
|
363
|
-
* @example
|
|
364
|
-
* ```typescript
|
|
365
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
366
|
-
*
|
|
367
|
-
* await client.email.senderProfiles.setDefault('sp_abc123');
|
|
368
|
-
* console.log('Default sender profile updated');
|
|
369
|
-
* ```
|
|
525
|
+
* @returns The profile with `is_default` set to `true`.
|
|
370
526
|
*/
|
|
371
527
|
setDefault: (id: string, options?: RequestOptions) => Promise<EmailMarketingSenderProfile>;
|
|
372
|
-
/**
|
|
528
|
+
/**
|
|
529
|
+
* List all sender profiles in a workspace.
|
|
530
|
+
*
|
|
531
|
+
* @param workspaceId - The workspace ID.
|
|
532
|
+
* @param options - Pagination and request-level overrides.
|
|
533
|
+
* @returns An array of {@link EmailMarketingSenderProfile} records.
|
|
534
|
+
*/
|
|
373
535
|
listByWorkspace: (workspaceId: string, options?: {
|
|
374
536
|
page?: number;
|
|
375
537
|
pageSize?: number;
|
|
376
538
|
} & RequestOptions) => Promise<EmailMarketingSenderProfile[]>;
|
|
377
539
|
};
|
|
378
540
|
/**
|
|
379
|
-
* Recipients — to/cc/bcc
|
|
541
|
+
* Recipients — to/cc/bcc addresses on an outbound email.
|
|
542
|
+
*
|
|
543
|
+
* Add recipients after creating a draft. At least one `to` recipient is
|
|
544
|
+
* required before sending.
|
|
380
545
|
*/
|
|
381
546
|
recipients: {
|
|
382
|
-
/**
|
|
547
|
+
/**
|
|
548
|
+
* Get a recipient by ID.
|
|
549
|
+
*
|
|
550
|
+
* @param id - The recipient record ID.
|
|
551
|
+
* @param options - Optional request-level overrides.
|
|
552
|
+
* @returns The requested {@link EmailRecipient}.
|
|
553
|
+
*/
|
|
383
554
|
get: (id: string, options?: RequestOptions) => Promise<EmailRecipient>;
|
|
384
|
-
/**
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
555
|
+
/**
|
|
556
|
+
* Add a recipient to an outbound email.
|
|
557
|
+
*
|
|
558
|
+
* @param attributes - Recipient details. `outbound_email_id` and `email` are required.
|
|
559
|
+
* @param options - Optional request-level overrides.
|
|
560
|
+
* @returns The newly created {@link EmailRecipient}.
|
|
561
|
+
*
|
|
562
|
+
* @example
|
|
563
|
+
* ```typescript
|
|
564
|
+
* await client.email.recipients.create({
|
|
565
|
+
* outbound_email_id: draft.id,
|
|
566
|
+
* email: 'jane@example.com',
|
|
567
|
+
* name: 'Jane Doe',
|
|
568
|
+
* recipient_type: 'to',
|
|
569
|
+
* });
|
|
570
|
+
* ```
|
|
571
|
+
*/
|
|
572
|
+
create: (attributes: CreateRecipientAttributes, options?: RequestOptions) => Promise<EmailRecipient>;
|
|
573
|
+
/**
|
|
574
|
+
* Remove a recipient from an outbound email.
|
|
575
|
+
*
|
|
576
|
+
* @param id - The recipient record ID.
|
|
577
|
+
* @param options - Optional request-level overrides.
|
|
578
|
+
* @returns `true` on successful deletion.
|
|
579
|
+
*/
|
|
392
580
|
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
393
|
-
/**
|
|
581
|
+
/**
|
|
582
|
+
* List all recipients for an outbound email.
|
|
583
|
+
*
|
|
584
|
+
* @param outboundEmailId - The outbound email ID.
|
|
585
|
+
* @param options - Optional request-level overrides.
|
|
586
|
+
* @returns An array of {@link EmailRecipient} records.
|
|
587
|
+
*/
|
|
394
588
|
listByEmail: (outboundEmailId: string, options?: RequestOptions) => Promise<EmailRecipient[]>;
|
|
395
589
|
};
|
|
396
590
|
/**
|
|
397
|
-
* Inclusions — structured data
|
|
591
|
+
* Inclusions — structured data (goals, charts, metrics) embedded in email bodies.
|
|
592
|
+
*
|
|
593
|
+
* Attach platform objects to a draft email. Inclusions are rendered into
|
|
594
|
+
* the email body before sending.
|
|
398
595
|
*/
|
|
399
596
|
inclusions: {
|
|
400
|
-
/**
|
|
597
|
+
/**
|
|
598
|
+
* Get an inclusion by ID.
|
|
599
|
+
*
|
|
600
|
+
* @param id - The inclusion ID.
|
|
601
|
+
* @param options - Optional request-level overrides.
|
|
602
|
+
* @returns The requested {@link EmailInclusion}.
|
|
603
|
+
*/
|
|
401
604
|
get: (id: string, options?: RequestOptions) => Promise<EmailInclusion>;
|
|
402
|
-
/**
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
605
|
+
/**
|
|
606
|
+
* Attach a structured data inclusion to a draft email.
|
|
607
|
+
*
|
|
608
|
+
* @param attributes - Inclusion details. `outbound_email_id` and `inclusion_type` are required.
|
|
609
|
+
* @param options - Optional request-level overrides.
|
|
610
|
+
* @returns The newly created {@link EmailInclusion}.
|
|
611
|
+
*
|
|
612
|
+
* @example
|
|
613
|
+
* ```typescript
|
|
614
|
+
* await client.email.inclusions.create({
|
|
615
|
+
* outbound_email_id: draft.id,
|
|
616
|
+
* inclusion_type: 'goal',
|
|
617
|
+
* title: 'Weekly protein target',
|
|
618
|
+
* data: { target: 120, unit: 'grams', status: 'active' },
|
|
619
|
+
* });
|
|
620
|
+
* ```
|
|
621
|
+
*/
|
|
622
|
+
create: (attributes: CreateInclusionAttributes, options?: RequestOptions) => Promise<EmailInclusion>;
|
|
623
|
+
/**
|
|
624
|
+
* Update an inclusion (PATCH semantics).
|
|
625
|
+
*
|
|
626
|
+
* @param id - The inclusion ID.
|
|
627
|
+
* @param attributes - Fields to update.
|
|
628
|
+
* @param options - Optional request-level overrides.
|
|
629
|
+
* @returns The updated {@link EmailInclusion}.
|
|
630
|
+
*/
|
|
631
|
+
update: (id: string, attributes: UpdateInclusionAttributes, options?: RequestOptions) => Promise<EmailInclusion>;
|
|
632
|
+
/**
|
|
633
|
+
* Remove an inclusion from a draft email.
|
|
634
|
+
*
|
|
635
|
+
* @param id - The inclusion ID.
|
|
636
|
+
* @param options - Optional request-level overrides.
|
|
637
|
+
* @returns `true` on successful deletion.
|
|
638
|
+
*/
|
|
419
639
|
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
420
|
-
/**
|
|
640
|
+
/**
|
|
641
|
+
* List all inclusions attached to an outbound email.
|
|
642
|
+
*
|
|
643
|
+
* @param outboundEmailId - The outbound email ID.
|
|
644
|
+
* @param options - Optional request-level overrides.
|
|
645
|
+
* @returns An array of {@link EmailInclusion} records.
|
|
646
|
+
*/
|
|
421
647
|
listByEmail: (outboundEmailId: string, options?: RequestOptions) => Promise<EmailInclusion[]>;
|
|
422
648
|
};
|
|
423
649
|
/**
|
|
424
650
|
* Tracking Events — open/click/bounce event history. Read-only.
|
|
425
651
|
*/
|
|
426
652
|
trackingEvents: {
|
|
427
|
-
/**
|
|
653
|
+
/**
|
|
654
|
+
* Get a tracking event by ID.
|
|
655
|
+
*
|
|
656
|
+
* @param id - The tracking event ID.
|
|
657
|
+
* @param options - Optional request-level overrides.
|
|
658
|
+
* @returns The requested {@link EmailTrackingEvent}.
|
|
659
|
+
*/
|
|
428
660
|
get: (id: string, options?: RequestOptions) => Promise<EmailTrackingEvent>;
|
|
429
|
-
/**
|
|
661
|
+
/**
|
|
662
|
+
* List all tracking events in a workspace.
|
|
663
|
+
*
|
|
664
|
+
* @param workspaceId - The workspace ID.
|
|
665
|
+
* @param options - Pagination and request-level overrides.
|
|
666
|
+
* @returns An array of {@link EmailTrackingEvent} records.
|
|
667
|
+
*/
|
|
430
668
|
listByWorkspace: (workspaceId: string, options?: {
|
|
431
669
|
page?: number;
|
|
432
670
|
pageSize?: number;
|
|
433
671
|
} & RequestOptions) => Promise<EmailTrackingEvent[]>;
|
|
434
672
|
};
|
|
435
673
|
/**
|
|
436
|
-
* Unsubscribers — CAN-SPAM global unsubscribe registry.
|
|
674
|
+
* Unsubscribers — CAN-SPAM global unsubscribe registry. Read-only.
|
|
437
675
|
*/
|
|
438
676
|
unsubscribers: {
|
|
439
|
-
/** Get an unsubscribe record by ID. */
|
|
440
|
-
get: (id: string, options?: RequestOptions) => Promise<EmailUnsubscriber>;
|
|
441
|
-
/** List all unsubscribers for a workspace. */
|
|
442
|
-
listByWorkspace: (workspaceId: string, options?: {
|
|
443
|
-
page?: number;
|
|
444
|
-
pageSize?: number;
|
|
445
|
-
} & RequestOptions) => Promise<EmailUnsubscriber[]>;
|
|
446
|
-
};
|
|
447
|
-
/**
|
|
448
|
-
* Send Limits — daily send quota records for outbound email.
|
|
449
|
-
*
|
|
450
|
-
* Each workspace has a send limit record per calendar day that tracks
|
|
451
|
-
* how many emails (with and without unsubscribe links) have been sent.
|
|
452
|
-
* Use these records to display usage dashboards or enforce ISV-side
|
|
453
|
-
* throttling before hitting platform hard limits.
|
|
454
|
-
*/
|
|
455
|
-
sendLimits: {
|
|
456
677
|
/**
|
|
457
|
-
* Get
|
|
678
|
+
* Get an unsubscribe record by ID.
|
|
458
679
|
*
|
|
459
|
-
* @param
|
|
680
|
+
* @param id - The unsubscriber record ID.
|
|
460
681
|
* @param options - Optional request-level overrides.
|
|
461
|
-
* @returns
|
|
462
|
-
*
|
|
463
|
-
* @example
|
|
464
|
-
* ```typescript
|
|
465
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
466
|
-
*
|
|
467
|
-
* const limit = await client.email.sendLimits.get('ws_abc123');
|
|
468
|
-
* console.log(limit.attributes.sent_with_unsubscribe, limit.attributes.limit_with_unsubscribe);
|
|
469
|
-
* ```
|
|
682
|
+
* @returns The requested {@link EmailUnsubscriber}.
|
|
470
683
|
*/
|
|
471
|
-
get: (
|
|
684
|
+
get: (id: string, options?: RequestOptions) => Promise<EmailUnsubscriber>;
|
|
472
685
|
/**
|
|
473
|
-
* List
|
|
474
|
-
*
|
|
475
|
-
* Returns one record per day that emails were sent. Records are ordered
|
|
476
|
-
* by date descending. Use for displaying usage history or charting
|
|
477
|
-
* daily send volume over time.
|
|
686
|
+
* List all unsubscribers in a workspace.
|
|
478
687
|
*
|
|
479
|
-
* @param workspaceId - The
|
|
480
|
-
* @param options -
|
|
481
|
-
*
|
|
482
|
-
* @returns A promise that resolves to an array of {@link EmailSendLimit} records.
|
|
483
|
-
*
|
|
484
|
-
* @example
|
|
485
|
-
* ```typescript
|
|
486
|
-
* const client = new GptClient({ apiKey: 'sk_app_...' });
|
|
487
|
-
*
|
|
488
|
-
* const history = await client.email.sendLimits.listByWorkspace('ws_abc123', { pageSize: 30 });
|
|
489
|
-
* console.log(`Last 30 days of send history: ${history.length} records`);
|
|
490
|
-
* ```
|
|
688
|
+
* @param workspaceId - The workspace ID.
|
|
689
|
+
* @param options - Pagination and request-level overrides.
|
|
690
|
+
* @returns An array of {@link EmailUnsubscriber} records.
|
|
491
691
|
*/
|
|
492
692
|
listByWorkspace: (workspaceId: string, options?: {
|
|
493
693
|
page?: number;
|
|
494
694
|
pageSize?: number;
|
|
495
|
-
} & RequestOptions) => Promise<
|
|
695
|
+
} & RequestOptions) => Promise<EmailUnsubscriber[]>;
|
|
496
696
|
};
|
|
497
697
|
/**
|
|
498
698
|
* Inbound Addresses — workspace-scoped email addresses that receive inbound mail.
|
|
499
699
|
*
|
|
500
|
-
* Any sender can email `{token}@inbound.gpt.app`. Configure a routing
|
|
501
|
-
* (`:extraction`, `:agent`, `:invoices`, `:crm`) to process
|
|
700
|
+
* Any sender can email `{token}@inbound.gpt.app`. Configure a routing
|
|
701
|
+
* target (`:extraction`, `:agent`, `:invoices`, `:crm`) to process
|
|
702
|
+
* received emails automatically.
|
|
502
703
|
*/
|
|
503
704
|
inbound: {
|
|
504
705
|
addresses: {
|
|
505
|
-
/**
|
|
706
|
+
/**
|
|
707
|
+
* Get an inbound address by ID.
|
|
708
|
+
*
|
|
709
|
+
* @param id - The inbound address ID.
|
|
710
|
+
* @param options - Optional request-level overrides.
|
|
711
|
+
* @returns The requested {@link EmailInboundAddress}.
|
|
712
|
+
*/
|
|
506
713
|
get: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
|
|
507
|
-
/**
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
714
|
+
/**
|
|
715
|
+
* Create a new inbound address.
|
|
716
|
+
*
|
|
717
|
+
* Unlike outbound resources, `workspace_id` is an explicit required
|
|
718
|
+
* parameter here.
|
|
719
|
+
*
|
|
720
|
+
* @param attributes - Address configuration. `workspace_id`, `name`, and
|
|
721
|
+
* `routing_target` are required.
|
|
722
|
+
* @param options - Optional request-level overrides.
|
|
723
|
+
* @returns The newly created {@link EmailInboundAddress}.
|
|
724
|
+
*
|
|
725
|
+
* @example
|
|
726
|
+
* ```typescript
|
|
727
|
+
* const addr = await client.email.inbound.addresses.create({
|
|
728
|
+
* workspace_id: 'ws_abc123',
|
|
729
|
+
* name: 'Invoice intake',
|
|
730
|
+
* routing_target: 'invoices',
|
|
731
|
+
* });
|
|
732
|
+
* console.log(`Send invoices to: ${addr.token}@inbound.gpt.app`);
|
|
733
|
+
* ```
|
|
734
|
+
*/
|
|
735
|
+
create: (attributes: CreateInboundAddressAttributes, options?: RequestOptions) => Promise<EmailInboundAddress>;
|
|
736
|
+
/**
|
|
737
|
+
* Update an inbound address (PATCH semantics).
|
|
738
|
+
*
|
|
739
|
+
* @param id - The inbound address ID.
|
|
740
|
+
* @param attributes - Fields to update.
|
|
741
|
+
* @param options - Optional request-level overrides.
|
|
742
|
+
* @returns The updated {@link EmailInboundAddress}.
|
|
743
|
+
*/
|
|
518
744
|
update: (id: string, attributes: UpdateInboundAddressAttributes, options?: RequestOptions) => Promise<EmailInboundAddress>;
|
|
519
|
-
/**
|
|
745
|
+
/**
|
|
746
|
+
* Delete an inbound address.
|
|
747
|
+
*
|
|
748
|
+
* @param id - The inbound address ID.
|
|
749
|
+
* @param options - Optional request-level overrides.
|
|
750
|
+
* @returns `true` on successful deletion.
|
|
751
|
+
*/
|
|
520
752
|
delete: (id: string, options?: RequestOptions) => Promise<true>;
|
|
521
|
-
/**
|
|
753
|
+
/**
|
|
754
|
+
* Rotate the inbound address token (invalidates the old token).
|
|
755
|
+
*
|
|
756
|
+
* After rotation, the old `{token}@inbound.gpt.app` address stops
|
|
757
|
+
* accepting email. Update any senders with the new token.
|
|
758
|
+
*
|
|
759
|
+
* @param id - The inbound address ID.
|
|
760
|
+
* @param options - Optional request-level overrides.
|
|
761
|
+
* @returns The address with the new token.
|
|
762
|
+
*/
|
|
522
763
|
rotateToken: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
|
|
523
|
-
/**
|
|
764
|
+
/**
|
|
765
|
+
* Disable an inbound address (stops accepting email).
|
|
766
|
+
*
|
|
767
|
+
* @param id - The inbound address ID.
|
|
768
|
+
* @param options - Optional request-level overrides.
|
|
769
|
+
* @returns The address with `is_active` set to `false`.
|
|
770
|
+
*/
|
|
524
771
|
disable: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
|
|
525
|
-
/**
|
|
772
|
+
/**
|
|
773
|
+
* Re-enable a disabled inbound address.
|
|
774
|
+
*
|
|
775
|
+
* @param id - The inbound address ID.
|
|
776
|
+
* @param options - Optional request-level overrides.
|
|
777
|
+
* @returns The address with `is_active` set to `true`.
|
|
778
|
+
*/
|
|
526
779
|
enable: (id: string, options?: RequestOptions) => Promise<EmailInboundAddress>;
|
|
527
|
-
/**
|
|
780
|
+
/**
|
|
781
|
+
* List all inbound addresses in a workspace.
|
|
782
|
+
*
|
|
783
|
+
* @param workspaceId - The workspace ID.
|
|
784
|
+
* @param options - Pagination and request-level overrides.
|
|
785
|
+
* @returns An array of {@link EmailInboundAddress} records.
|
|
786
|
+
*/
|
|
528
787
|
listByWorkspace: (workspaceId: string, options?: {
|
|
529
788
|
page?: number;
|
|
530
789
|
pageSize?: number;
|
|
@@ -532,14 +791,32 @@ export declare function createEmailNamespace(rb: RequestBuilder): {
|
|
|
532
791
|
};
|
|
533
792
|
/** Received — read-only log of received inbound emails. */
|
|
534
793
|
received: {
|
|
535
|
-
/**
|
|
794
|
+
/**
|
|
795
|
+
* Get a received inbound email by ID.
|
|
796
|
+
*
|
|
797
|
+
* @param id - The inbound email ID.
|
|
798
|
+
* @param options - Optional request-level overrides.
|
|
799
|
+
* @returns The requested {@link EmailInboundEmail}.
|
|
800
|
+
*/
|
|
536
801
|
get: (id: string, options?: RequestOptions) => Promise<EmailInboundEmail>;
|
|
537
|
-
/**
|
|
802
|
+
/**
|
|
803
|
+
* List received emails by inbound address.
|
|
804
|
+
*
|
|
805
|
+
* @param addressId - The inbound address ID.
|
|
806
|
+
* @param options - Pagination and request-level overrides.
|
|
807
|
+
* @returns An array of {@link EmailInboundEmail} records.
|
|
808
|
+
*/
|
|
538
809
|
listByAddress: (addressId: string, options?: {
|
|
539
810
|
page?: number;
|
|
540
811
|
pageSize?: number;
|
|
541
812
|
} & RequestOptions) => Promise<EmailInboundEmail[]>;
|
|
542
|
-
/**
|
|
813
|
+
/**
|
|
814
|
+
* List all received emails in a workspace.
|
|
815
|
+
*
|
|
816
|
+
* @param workspaceId - The workspace ID.
|
|
817
|
+
* @param options - Pagination and request-level overrides.
|
|
818
|
+
* @returns An array of {@link EmailInboundEmail} records.
|
|
819
|
+
*/
|
|
543
820
|
listByWorkspace: (workspaceId: string, options?: {
|
|
544
821
|
page?: number;
|
|
545
822
|
pageSize?: number;
|