@masters-union/outbound-sdk 0.4.4 → 0.4.6
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.d.mts +479 -8
- package/dist/index.d.ts +479 -8
- package/dist/index.js +194 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +194 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -47,7 +47,35 @@ interface SendEmailResponse {
|
|
|
47
47
|
interface BulkEmailParams {
|
|
48
48
|
fromEmail: string;
|
|
49
49
|
emailSubject: string;
|
|
50
|
-
|
|
50
|
+
/**
|
|
51
|
+
* Inline recipients, up to 1000 per request. Mutually exclusive with `listId`.
|
|
52
|
+
* Required unless `listId` is given.
|
|
53
|
+
*/
|
|
54
|
+
emails?: BulkEmailRecipient[];
|
|
55
|
+
/**
|
|
56
|
+
* Send to a saved contact list instead. NO RECIPIENT CAP: the server expands the
|
|
57
|
+
* list in the background and returns one job id to track. `htmlBody` is required
|
|
58
|
+
* in this mode, and `mapping` says which contact column feeds each `{{variable}}`.
|
|
59
|
+
*/
|
|
60
|
+
listId?: string;
|
|
61
|
+
/**
|
|
62
|
+
* OPTIONAL shared HTML body (mail merge). Supply it once and give each recipient
|
|
63
|
+
* a small `variables` object instead of its own full body: the template then
|
|
64
|
+
* crosses the wire once rather than once per recipient.
|
|
65
|
+
*
|
|
66
|
+
* BACKWARD COMPATIBLE: rendering happens if and only if a recipient carries a
|
|
67
|
+
* `variables` object. A recipient without one is sent verbatim, even if its body
|
|
68
|
+
* contains `{{...}}`.
|
|
69
|
+
*/
|
|
70
|
+
htmlBody?: string;
|
|
71
|
+
/** OPTIONAL shared plain-text body (mail merge). */
|
|
72
|
+
textBody?: string;
|
|
73
|
+
/** `{ variableName: columnName }` for a list send. */
|
|
74
|
+
mapping?: VariableMapping;
|
|
75
|
+
/** Values for variables no column supplies, applied to every recipient. */
|
|
76
|
+
defaults?: Record<string, string>;
|
|
77
|
+
/** Whether a contact missing a variable is skipped (default) or sent anyway. */
|
|
78
|
+
onMissingVariable?: 'skip' | 'send';
|
|
51
79
|
senderName?: string;
|
|
52
80
|
replyTo?: string;
|
|
53
81
|
/**
|
|
@@ -63,7 +91,13 @@ interface BulkEmailParams {
|
|
|
63
91
|
}
|
|
64
92
|
interface BulkEmailRecipient {
|
|
65
93
|
toEmail: string;
|
|
66
|
-
htmlBody
|
|
94
|
+
/** Required unless a shared top-level `htmlBody` is supplied. */
|
|
95
|
+
htmlBody?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Mail-merge values for this recipient. Its PRESENCE is what opts the entry into
|
|
98
|
+
* server-side rendering, so omit it entirely for a body you want sent verbatim.
|
|
99
|
+
*/
|
|
100
|
+
variables?: Record<string, string>;
|
|
67
101
|
subject?: string;
|
|
68
102
|
textBody?: string;
|
|
69
103
|
ccEmail?: string;
|
|
@@ -268,6 +302,16 @@ interface TemplateSendParams {
|
|
|
268
302
|
interface TemplateBulkSendParams {
|
|
269
303
|
templateId: string;
|
|
270
304
|
fromEmail: string;
|
|
305
|
+
/**
|
|
306
|
+
* Send to a saved contact list instead of `recipients`. No recipient cap — the
|
|
307
|
+
* server expands the list in the background.
|
|
308
|
+
*/
|
|
309
|
+
listId?: string;
|
|
310
|
+
/** `{ variableName: columnName }` for a list send. */
|
|
311
|
+
mapping?: VariableMapping;
|
|
312
|
+
/** Values for variables no column supplies. */
|
|
313
|
+
defaults?: Record<string, string>;
|
|
314
|
+
onMissingVariable?: 'skip' | 'send';
|
|
271
315
|
senderName?: string;
|
|
272
316
|
replyTo?: string;
|
|
273
317
|
/**
|
|
@@ -280,7 +324,8 @@ interface TemplateBulkSendParams {
|
|
|
280
324
|
priority?: 'critical' | 'urgent' | 'high' | 'normal' | 'low' | 'deferred' | 'backlog';
|
|
281
325
|
idempotencyKey?: string;
|
|
282
326
|
campaignId?: string;
|
|
283
|
-
recipients
|
|
327
|
+
/** Inline recipients, up to 1000. Mutually exclusive with `listId`. */
|
|
328
|
+
recipients?: TemplateBulkRecipient[];
|
|
284
329
|
}
|
|
285
330
|
interface TemplateBulkRecipient {
|
|
286
331
|
toEmail: string;
|
|
@@ -335,10 +380,17 @@ interface TemplateStatsResponse {
|
|
|
335
380
|
leastUsed: Template[];
|
|
336
381
|
recentlyUsed: Template[];
|
|
337
382
|
}
|
|
383
|
+
type SuppressionReason = 'bounce' | 'complaint' | 'manual' | 'unsubscribe';
|
|
338
384
|
interface ListSuppressionsParams {
|
|
339
385
|
page?: number;
|
|
340
386
|
limit?: number;
|
|
341
|
-
reason?:
|
|
387
|
+
reason?: SuppressionReason;
|
|
388
|
+
/**
|
|
389
|
+
* Partial, case-insensitive match on the address. A comma-separated value is
|
|
390
|
+
* treated as several terms OR'd together (`'acme.com,gmail.com'`). For an exact
|
|
391
|
+
* lookup of known addresses use `search()` instead.
|
|
392
|
+
*/
|
|
393
|
+
search?: string;
|
|
342
394
|
}
|
|
343
395
|
interface ListSuppressionsResponse {
|
|
344
396
|
suppressions: Suppression[];
|
|
@@ -357,11 +409,90 @@ interface Suppression {
|
|
|
357
409
|
}
|
|
358
410
|
interface AddSuppressionParams {
|
|
359
411
|
email: string;
|
|
360
|
-
reason?:
|
|
412
|
+
reason?: SuppressionReason;
|
|
361
413
|
}
|
|
362
414
|
interface SuppressionResponse {
|
|
363
415
|
suppression: Suppression;
|
|
364
416
|
}
|
|
417
|
+
/** An address that failed server-side RFC validation and was never acted on. */
|
|
418
|
+
interface RejectedEmail {
|
|
419
|
+
/** The address exactly as you supplied it. */
|
|
420
|
+
email: string;
|
|
421
|
+
/** `invalid_format` — failed the RFC regex. `too_long` — over 254 characters. */
|
|
422
|
+
reason: 'invalid_format' | 'too_long';
|
|
423
|
+
}
|
|
424
|
+
/**
|
|
425
|
+
* A list of addresses. Either a comma-separated string or an array — the SDK
|
|
426
|
+
* normalizes both to the wire format.
|
|
427
|
+
*/
|
|
428
|
+
type EmailList = string | string[];
|
|
429
|
+
interface SearchSuppressionsParams {
|
|
430
|
+
/** Addresses to look up, max 100 per request. */
|
|
431
|
+
emails: EmailList;
|
|
432
|
+
}
|
|
433
|
+
interface SearchSuppressionsResponse {
|
|
434
|
+
/** The suppression records that matched, newest first. */
|
|
435
|
+
suppressions: Suppression[];
|
|
436
|
+
/** Valid addresses that were looked up (lowercased, deduped). */
|
|
437
|
+
accepted: string[];
|
|
438
|
+
/** Addresses that failed validation and were never looked up. */
|
|
439
|
+
rejected: RejectedEmail[];
|
|
440
|
+
/** Accepted addresses that are not on the suppression list. */
|
|
441
|
+
notFound: string[];
|
|
442
|
+
summary: {
|
|
443
|
+
requested: number;
|
|
444
|
+
accepted: number;
|
|
445
|
+
rejected: number;
|
|
446
|
+
found: number;
|
|
447
|
+
notFound: number;
|
|
448
|
+
};
|
|
449
|
+
}
|
|
450
|
+
interface BulkAddSuppressionsParams {
|
|
451
|
+
/** Addresses to suppress, max 1000 per request. */
|
|
452
|
+
emails: EmailList;
|
|
453
|
+
/** Applied to newly added addresses only (default: `manual`). */
|
|
454
|
+
reason?: SuppressionReason;
|
|
455
|
+
}
|
|
456
|
+
interface BulkAddSuppressionsResponse {
|
|
457
|
+
/** The suppression records for every accepted address, new and pre-existing. */
|
|
458
|
+
suppressions: Suppression[];
|
|
459
|
+
/** Valid addresses that were processed (lowercased, deduped). */
|
|
460
|
+
accepted: string[];
|
|
461
|
+
/** Addresses that failed validation and were never suppressed. */
|
|
462
|
+
rejected: RejectedEmail[];
|
|
463
|
+
/** Addresses newly added by this call. */
|
|
464
|
+
added: string[];
|
|
465
|
+
/** Accepted addresses that were already on the list; their record is unchanged. */
|
|
466
|
+
alreadySuppressed: string[];
|
|
467
|
+
summary: {
|
|
468
|
+
requested: number;
|
|
469
|
+
accepted: number;
|
|
470
|
+
rejected: number;
|
|
471
|
+
added: number;
|
|
472
|
+
alreadySuppressed: number;
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
interface BulkRemoveSuppressionsParams {
|
|
476
|
+
/** Addresses to unsuppress, max 1000 per request. */
|
|
477
|
+
emails: EmailList;
|
|
478
|
+
}
|
|
479
|
+
interface BulkRemoveSuppressionsResponse {
|
|
480
|
+
/** Valid addresses that were processed (lowercased, deduped). */
|
|
481
|
+
accepted: string[];
|
|
482
|
+
/** Addresses that failed validation and were never removed. */
|
|
483
|
+
rejected: RejectedEmail[];
|
|
484
|
+
/** Addresses actually removed from the list by this call. */
|
|
485
|
+
removed: string[];
|
|
486
|
+
/** Accepted addresses that were not on the list to begin with. */
|
|
487
|
+
notFound: string[];
|
|
488
|
+
summary: {
|
|
489
|
+
requested: number;
|
|
490
|
+
accepted: number;
|
|
491
|
+
rejected: number;
|
|
492
|
+
removed: number;
|
|
493
|
+
notFound: number;
|
|
494
|
+
};
|
|
495
|
+
}
|
|
365
496
|
type WebhookEvent = 'send' | 'delivery' | 'bounce' | 'complaint' | 'open' | 'click' | 'reject' | 'rendering_failure' | 'dropped' | 'unsubscribe' | 'resubscribe';
|
|
366
497
|
/** @deprecated v1 is discontinued — all webhooks now use {@link IncomingWebhookEventV2}. */
|
|
367
498
|
interface IncomingWebhookEvent {
|
|
@@ -696,6 +827,213 @@ interface CampaignAnalytics {
|
|
|
696
827
|
bounceReasons: CampaignBounceReason[];
|
|
697
828
|
timeseries: CampaignTimeseriesPoint[];
|
|
698
829
|
}
|
|
830
|
+
/** Only `subscribed` is ever sent to. */
|
|
831
|
+
type ContactStatus = 'subscribed' | 'invalid' | 'bounced' | 'complained' | 'unsubscribed' | 'suppressed';
|
|
832
|
+
/** The precise cause behind a non-subscribed status. */
|
|
833
|
+
type ContactStatusReason = 'invalid_format' | 'too_long' | 'bounce' | 'complaint' | 'unsubscribe' | 'manual' | 'ses_send_reject';
|
|
834
|
+
interface ContactList {
|
|
835
|
+
id: string;
|
|
836
|
+
name: string;
|
|
837
|
+
description: string | null;
|
|
838
|
+
status: 'active' | 'deleting';
|
|
839
|
+
contactCount: number;
|
|
840
|
+
/** Every attribute key seen on import — the valid targets for a send `mapping`. */
|
|
841
|
+
fields: string[];
|
|
842
|
+
metadata: Record<string, unknown> | null;
|
|
843
|
+
lastImportAt: string | null;
|
|
844
|
+
lastSentAt: string | null;
|
|
845
|
+
lastValidatedAt: string | null;
|
|
846
|
+
createdAt: string;
|
|
847
|
+
updatedAt: string;
|
|
848
|
+
}
|
|
849
|
+
interface ContactListDetail {
|
|
850
|
+
list: ContactList;
|
|
851
|
+
/** How many contacts sit in each status. */
|
|
852
|
+
statusBreakdown: Record<ContactStatus, number>;
|
|
853
|
+
/** Shorthand for `statusBreakdown.subscribed` — how many this list can reach. */
|
|
854
|
+
sendable: number;
|
|
855
|
+
sendablePercent: number;
|
|
856
|
+
}
|
|
857
|
+
interface Contact {
|
|
858
|
+
id: string;
|
|
859
|
+
email: string;
|
|
860
|
+
/** The original CSV value, present only when sanitization changed it. */
|
|
861
|
+
emailRaw: string | null;
|
|
862
|
+
name: string | null;
|
|
863
|
+
attributes: Record<string, string>;
|
|
864
|
+
status: ContactStatus;
|
|
865
|
+
statusReason: ContactStatusReason | null;
|
|
866
|
+
statusChangedAt: string | null;
|
|
867
|
+
source: 'import' | 'api' | 'manual';
|
|
868
|
+
createdAt: string;
|
|
869
|
+
updatedAt: string;
|
|
870
|
+
}
|
|
871
|
+
interface CreateContactListParams {
|
|
872
|
+
name: string;
|
|
873
|
+
description?: string;
|
|
874
|
+
metadata?: Record<string, unknown>;
|
|
875
|
+
}
|
|
876
|
+
interface UpdateContactListParams {
|
|
877
|
+
name?: string;
|
|
878
|
+
description?: string | null;
|
|
879
|
+
metadata?: Record<string, unknown> | null;
|
|
880
|
+
}
|
|
881
|
+
interface ListContactListsParams {
|
|
882
|
+
page?: number;
|
|
883
|
+
limit?: number;
|
|
884
|
+
search?: string;
|
|
885
|
+
sort?: 'recent' | 'created' | 'name' | 'size';
|
|
886
|
+
}
|
|
887
|
+
interface ListContactListsResponse {
|
|
888
|
+
lists: ContactList[];
|
|
889
|
+
pagination: {
|
|
890
|
+
page: number;
|
|
891
|
+
limit: number;
|
|
892
|
+
total: number;
|
|
893
|
+
totalPages: number;
|
|
894
|
+
};
|
|
895
|
+
quota: {
|
|
896
|
+
used: number;
|
|
897
|
+
allocated: number;
|
|
898
|
+
remaining: number;
|
|
899
|
+
};
|
|
900
|
+
}
|
|
901
|
+
interface ImportContactRow {
|
|
902
|
+
email: string;
|
|
903
|
+
name?: string;
|
|
904
|
+
/** Anything else the CSV carried. These keys become the list's `fields`. */
|
|
905
|
+
attributes?: Record<string, string>;
|
|
906
|
+
}
|
|
907
|
+
interface ImportContactsParams {
|
|
908
|
+
rows: ImportContactRow[];
|
|
909
|
+
/**
|
|
910
|
+
* One id per FILE. Together with `chunkIndex` it makes a retried chunk a no-op
|
|
911
|
+
* instead of a double-insert, so a failed upload is safe to retry blindly.
|
|
912
|
+
*/
|
|
913
|
+
importId?: string;
|
|
914
|
+
chunkIndex?: number;
|
|
915
|
+
/** Which row wins when the same address appears twice in one chunk. */
|
|
916
|
+
duplicatesInFile?: 'first' | 'last';
|
|
917
|
+
/**
|
|
918
|
+
* What to do with an address already in the list. `update` merges attributes and
|
|
919
|
+
* refreshes the name; it NEVER re-subscribes a bounced or opted-out contact.
|
|
920
|
+
*/
|
|
921
|
+
onExisting?: 'skip' | 'update';
|
|
922
|
+
}
|
|
923
|
+
interface ImportContactsResponse {
|
|
924
|
+
importId: string | null;
|
|
925
|
+
chunkIndex: number;
|
|
926
|
+
/** Rows with no usable address at all — the only rows that are not stored. */
|
|
927
|
+
rejected: Array<{
|
|
928
|
+
row: number;
|
|
929
|
+
value: string;
|
|
930
|
+
reason: string;
|
|
931
|
+
}>;
|
|
932
|
+
/** A sample of the addresses stored with `status: 'invalid'`. */
|
|
933
|
+
invalidSamples: Array<{
|
|
934
|
+
email: string;
|
|
935
|
+
emailRaw: string | null;
|
|
936
|
+
reason: ContactStatusReason;
|
|
937
|
+
}>;
|
|
938
|
+
summary: {
|
|
939
|
+
requested: number;
|
|
940
|
+
added: number;
|
|
941
|
+
updated: number;
|
|
942
|
+
skipped: number;
|
|
943
|
+
/** How many addresses sanitization actually changed. */
|
|
944
|
+
sanitized: number;
|
|
945
|
+
/** Stored, but marked invalid — NOT discarded. */
|
|
946
|
+
invalid: number;
|
|
947
|
+
/** Stored, but already on your suppression list. */
|
|
948
|
+
suppressed: number;
|
|
949
|
+
duplicatesInFile: number;
|
|
950
|
+
rejected: number;
|
|
951
|
+
};
|
|
952
|
+
list: {
|
|
953
|
+
id: string;
|
|
954
|
+
contactCount: number;
|
|
955
|
+
fields: string[];
|
|
956
|
+
};
|
|
957
|
+
}
|
|
958
|
+
interface ListContactsParams {
|
|
959
|
+
limit?: number;
|
|
960
|
+
/** From the previous response's `pagination.nextCursor`. Keyset, not offset. */
|
|
961
|
+
cursor?: string;
|
|
962
|
+
sort?: 'created' | 'email';
|
|
963
|
+
status?: ContactStatus;
|
|
964
|
+
search?: string;
|
|
965
|
+
}
|
|
966
|
+
interface ListContactsResponse {
|
|
967
|
+
contacts: Contact[];
|
|
968
|
+
pagination: {
|
|
969
|
+
limit: number;
|
|
970
|
+
hasMore: boolean;
|
|
971
|
+
nextCursor: string | null;
|
|
972
|
+
/** A FLOOR when `totalCapped` is true — an exact filtered count is not run per page. */
|
|
973
|
+
total: number;
|
|
974
|
+
totalCapped: boolean;
|
|
975
|
+
};
|
|
976
|
+
}
|
|
977
|
+
interface AddContactParams {
|
|
978
|
+
email: string;
|
|
979
|
+
name?: string;
|
|
980
|
+
attributes?: Record<string, string>;
|
|
981
|
+
}
|
|
982
|
+
interface UpdateContactParams {
|
|
983
|
+
name?: string;
|
|
984
|
+
/** REPLACES the stored object wholesale. Import merges instead. */
|
|
985
|
+
attributes?: Record<string, string>;
|
|
986
|
+
status?: ContactStatus;
|
|
987
|
+
}
|
|
988
|
+
interface BulkDeleteContactsParams {
|
|
989
|
+
contactIds?: string[];
|
|
990
|
+
emails?: string[];
|
|
991
|
+
/** A filter rather than ids — how you clear every invalid address in one call. */
|
|
992
|
+
status?: ContactStatus;
|
|
993
|
+
all?: boolean;
|
|
994
|
+
}
|
|
995
|
+
interface BulkDeleteContactsResponse {
|
|
996
|
+
message: string;
|
|
997
|
+
deleted?: number;
|
|
998
|
+
listId?: string;
|
|
999
|
+
}
|
|
1000
|
+
interface ContactListFieldsResponse {
|
|
1001
|
+
fields: Array<{
|
|
1002
|
+
name: string;
|
|
1003
|
+
sample: string | null;
|
|
1004
|
+
}>;
|
|
1005
|
+
/** Mappable alongside `fields`, but not attributes. */
|
|
1006
|
+
reservedFields: string[];
|
|
1007
|
+
}
|
|
1008
|
+
interface RecountContactListResponse {
|
|
1009
|
+
contactCount: number;
|
|
1010
|
+
previous: number;
|
|
1011
|
+
drift: number | null;
|
|
1012
|
+
timedOut?: boolean;
|
|
1013
|
+
message?: string;
|
|
1014
|
+
}
|
|
1015
|
+
interface AcceptedResponse {
|
|
1016
|
+
message: string;
|
|
1017
|
+
listId?: string;
|
|
1018
|
+
}
|
|
1019
|
+
/**
|
|
1020
|
+
* Which contact column feeds each `{{variable}}`, as `{ variableName: columnName }`.
|
|
1021
|
+
* Omit an entry when the column is already named the same as the variable.
|
|
1022
|
+
* `email` and `name` are always mappable in addition to the list's own fields.
|
|
1023
|
+
*/
|
|
1024
|
+
type VariableMapping = Record<string, string>;
|
|
1025
|
+
interface ListSendResponse {
|
|
1026
|
+
message: string;
|
|
1027
|
+
mode: 'list';
|
|
1028
|
+
jobId: string;
|
|
1029
|
+
listId: string;
|
|
1030
|
+
listName: string;
|
|
1031
|
+
/** How many contacts were sendable when the send was accepted. */
|
|
1032
|
+
estimatedRecipientCount: number;
|
|
1033
|
+
status: 'expanding';
|
|
1034
|
+
statusUrl: string;
|
|
1035
|
+
usingSesTemplate?: boolean;
|
|
1036
|
+
}
|
|
699
1037
|
|
|
700
1038
|
declare class HttpClient {
|
|
701
1039
|
private config;
|
|
@@ -715,7 +1053,18 @@ declare class EmailResource {
|
|
|
715
1053
|
private http;
|
|
716
1054
|
constructor(http: HttpClient);
|
|
717
1055
|
send(params: SendEmailParams, overrides?: RequestOverrides): Promise<SendEmailResponse>;
|
|
718
|
-
|
|
1056
|
+
/**
|
|
1057
|
+
* Send to many recipients at once.
|
|
1058
|
+
*
|
|
1059
|
+
* Three shapes, discriminated by what you pass:
|
|
1060
|
+
* - `emails[]` with a full `htmlBody` each — the original behaviour, unchanged.
|
|
1061
|
+
* - `emails[]` + a shared `htmlBody` + per-recipient `variables` — MAIL MERGE.
|
|
1062
|
+
* The template crosses the wire once instead of once per recipient.
|
|
1063
|
+
* - `listId` (+ `mapping`) — a saved contact list, with NO recipient cap. Returns
|
|
1064
|
+
* a `ListSendResponse` with `mode: 'list'` and a job id you can poll; the
|
|
1065
|
+
* server materializes the recipients in the background.
|
|
1066
|
+
*/
|
|
1067
|
+
bulk(params: BulkEmailParams, overrides?: RequestOverrides): Promise<BulkEmailResponse | ListSendResponse>;
|
|
719
1068
|
status(jobId: string, overrides?: RequestOverrides): Promise<JobStatusResponse>;
|
|
720
1069
|
/**
|
|
721
1070
|
* Look up the current status of a single message by its `messageId` — the ID
|
|
@@ -764,7 +1113,14 @@ declare class TemplatesResource {
|
|
|
764
1113
|
}, overrides?: RequestOverrides): Promise<TemplateResponse>;
|
|
765
1114
|
preview(id: string, params?: TemplatePreviewParams, overrides?: RequestOverrides): Promise<TemplatePreviewResponse>;
|
|
766
1115
|
send(params: TemplateSendParams, overrides?: RequestOverrides): Promise<SendEmailResponse>;
|
|
767
|
-
|
|
1116
|
+
/**
|
|
1117
|
+
* Send a template to many recipients.
|
|
1118
|
+
*
|
|
1119
|
+
* Pass `recipients[]` (up to 1000) for an inline send, or `listId` (+ `mapping`)
|
|
1120
|
+
* to send to a whole saved contact list with no recipient cap — the server
|
|
1121
|
+
* expands the list in the background and returns `mode: 'list'` with a job id.
|
|
1122
|
+
*/
|
|
1123
|
+
bulkSend(params: TemplateBulkSendParams, overrides?: RequestOverrides): Promise<TemplateBulkSendResponse | ListSendResponse>;
|
|
768
1124
|
stats(overrides?: RequestOverrides): Promise<TemplateStatsResponse>;
|
|
769
1125
|
}
|
|
770
1126
|
|
|
@@ -773,7 +1129,30 @@ declare class SuppressionsResource {
|
|
|
773
1129
|
constructor(http: HttpClient);
|
|
774
1130
|
list(params?: ListSuppressionsParams, overrides?: RequestOverrides): Promise<ListSuppressionsResponse>;
|
|
775
1131
|
listAll(params?: Omit<ListSuppressionsParams, 'page'>, overrides?: RequestOverrides): AsyncGenerator<Suppression>;
|
|
1132
|
+
/**
|
|
1133
|
+
* Look up specific addresses on the suppression list — exact, case-insensitive,
|
|
1134
|
+
* up to 100 per request. Every address is validated server-side before it is
|
|
1135
|
+
* queried, so a malformed entry comes back in `rejected` instead of failing the
|
|
1136
|
+
* whole call.
|
|
1137
|
+
*
|
|
1138
|
+
* For substring matching (e.g. every address on a domain), use
|
|
1139
|
+
* `list({ search: 'acme.com' })` instead.
|
|
1140
|
+
*/
|
|
1141
|
+
search(params: SearchSuppressionsParams, overrides?: RequestOverrides): Promise<SearchSuppressionsResponse>;
|
|
776
1142
|
add(params: AddSuppressionParams, overrides?: RequestOverrides): Promise<SuppressionResponse>;
|
|
1143
|
+
/**
|
|
1144
|
+
* Suppress up to 1000 addresses in one request. Valid addresses are added and
|
|
1145
|
+
* reported in `added`; ones already on the list come back in `alreadySuppressed`
|
|
1146
|
+
* with their existing record untouched; ones that fail validation come back in
|
|
1147
|
+
* `rejected` and are never written.
|
|
1148
|
+
*/
|
|
1149
|
+
bulkAdd(params: BulkAddSuppressionsParams, overrides?: RequestOverrides): Promise<BulkAddSuppressionsResponse>;
|
|
1150
|
+
/**
|
|
1151
|
+
* Unsuppress up to 1000 addresses in one request. Unlike `remove()`, an address
|
|
1152
|
+
* that is not on the list is not an error: it is reported in `notFound`, so one
|
|
1153
|
+
* bad entry cannot fail the batch.
|
|
1154
|
+
*/
|
|
1155
|
+
bulkRemove(params: BulkRemoveSuppressionsParams, overrides?: RequestOverrides): Promise<BulkRemoveSuppressionsResponse>;
|
|
777
1156
|
remove(email: string, overrides?: RequestOverrides): Promise<{
|
|
778
1157
|
message: string;
|
|
779
1158
|
}>;
|
|
@@ -833,6 +1212,97 @@ declare class CampaignsResource {
|
|
|
833
1212
|
analytics(campaignId: string, params?: CampaignAnalyticsParams, overrides?: RequestOverrides): Promise<CampaignAnalytics>;
|
|
834
1213
|
}
|
|
835
1214
|
|
|
1215
|
+
/**
|
|
1216
|
+
* Contact lists: reusable audiences you can send to without a recipient limit.
|
|
1217
|
+
*
|
|
1218
|
+
* The per-request cap on `email.bulk` / `templates.bulkSend` exists because those
|
|
1219
|
+
* carry their recipients in the request body. A list send carries only a `listId`,
|
|
1220
|
+
* and the server expands the list in the background — so there is no cap, and the
|
|
1221
|
+
* caller gets one job id to track however large the audience is.
|
|
1222
|
+
*
|
|
1223
|
+
* ── Address hygiene ──
|
|
1224
|
+
* Every imported address is sanitized (display-name unwrapping, `mailto:`,
|
|
1225
|
+
* zero-width characters, quotes, case) and then validated with the SAME rules the
|
|
1226
|
+
* send path applies. Addresses that fail are STORED with `status: 'invalid'` rather
|
|
1227
|
+
* than discarded, so you can list them, export them and fix them. Addresses on your
|
|
1228
|
+
* suppression list are stored with the matching status. Only `subscribed` contacts
|
|
1229
|
+
* are ever sent to, and bounces, complaints and unsubscribes flow back onto the
|
|
1230
|
+
* contact automatically.
|
|
1231
|
+
*/
|
|
1232
|
+
declare class ContactListsResource {
|
|
1233
|
+
private http;
|
|
1234
|
+
constructor(http: HttpClient);
|
|
1235
|
+
create(params: CreateContactListParams, overrides?: RequestOverrides): Promise<{
|
|
1236
|
+
message: string;
|
|
1237
|
+
list: ContactList;
|
|
1238
|
+
}>;
|
|
1239
|
+
list(params?: ListContactListsParams, overrides?: RequestOverrides): Promise<ListContactListsResponse>;
|
|
1240
|
+
/** Auto-paginating iterator over every contact list, mirroring templates.listAll(). */
|
|
1241
|
+
listAll(params?: Omit<ListContactListsParams, 'page'>, overrides?: RequestOverrides): AsyncGenerator<ContactList>;
|
|
1242
|
+
/** A list plus its per-status breakdown (how many are sendable, invalid, bounced...). */
|
|
1243
|
+
get(listId: string, overrides?: RequestOverrides): Promise<ContactListDetail>;
|
|
1244
|
+
update(listId: string, params: UpdateContactListParams, overrides?: RequestOverrides): Promise<{
|
|
1245
|
+
message: string;
|
|
1246
|
+
list: ContactList;
|
|
1247
|
+
}>;
|
|
1248
|
+
/**
|
|
1249
|
+
* Delete a list. Returns 202: the contacts are removed by a background job in
|
|
1250
|
+
* chunks, so a multi-million-row list does not block on one enormous transaction.
|
|
1251
|
+
* Fails with a conflict while a send is still expanding this list.
|
|
1252
|
+
*/
|
|
1253
|
+
delete(listId: string, overrides?: RequestOverrides): Promise<AcceptedResponse>;
|
|
1254
|
+
/**
|
|
1255
|
+
* Import a chunk of contacts (max 1000 rows per call).
|
|
1256
|
+
*
|
|
1257
|
+
* Pass the same `importId` with an incrementing `chunkIndex` for every chunk of
|
|
1258
|
+
* one file: that pair makes a retried chunk a no-op instead of a double-insert,
|
|
1259
|
+
* so a network failure mid-upload is safe to retry blindly.
|
|
1260
|
+
*
|
|
1261
|
+
* `onExisting: 'update'` merges attributes into contacts already in the list. It
|
|
1262
|
+
* never re-subscribes someone who bounced, complained or opted out.
|
|
1263
|
+
*/
|
|
1264
|
+
importContacts(listId: string, params: ImportContactsParams, overrides?: RequestOverrides): Promise<ImportContactsResponse>;
|
|
1265
|
+
/**
|
|
1266
|
+
* List contacts. KEYSET paginated: pass the previous response's
|
|
1267
|
+
* `pagination.nextCursor` as `cursor` to advance. There is no page number,
|
|
1268
|
+
* because offset paging degrades badly past a few hundred pages.
|
|
1269
|
+
*/
|
|
1270
|
+
contacts(listId: string, params?: ListContactsParams, overrides?: RequestOverrides): Promise<ListContactsResponse>;
|
|
1271
|
+
/** Auto-paginating iterator over every contact in a list. */
|
|
1272
|
+
contactsAll(listId: string, params?: Omit<ListContactsParams, 'cursor'>, overrides?: RequestOverrides): AsyncGenerator<Contact>;
|
|
1273
|
+
addContact(listId: string, params: AddContactParams, overrides?: RequestOverrides): Promise<{
|
|
1274
|
+
message: string;
|
|
1275
|
+
contact: Contact;
|
|
1276
|
+
}>;
|
|
1277
|
+
/** `attributes` REPLACES the stored object wholesale here; import merges instead. */
|
|
1278
|
+
updateContact(listId: string, contactId: string, params: UpdateContactParams, overrides?: RequestOverrides): Promise<{
|
|
1279
|
+
message: string;
|
|
1280
|
+
contact: Contact;
|
|
1281
|
+
}>;
|
|
1282
|
+
deleteContact(listId: string, contactId: string, overrides?: RequestOverrides): Promise<void>;
|
|
1283
|
+
/**
|
|
1284
|
+
* Delete many contacts. Pass `contactIds` or `emails` (up to 1000), or a FILTER
|
|
1285
|
+
* — `{ status: 'invalid' }` or `{ all: true }` — which is how you clear tens of
|
|
1286
|
+
* thousands of dead addresses in one small request. Filtered deletes return 202
|
|
1287
|
+
* and run in the background.
|
|
1288
|
+
*/
|
|
1289
|
+
bulkDeleteContacts(listId: string, params: BulkDeleteContactsParams, overrides?: RequestOverrides): Promise<BulkDeleteContactsResponse>;
|
|
1290
|
+
/**
|
|
1291
|
+
* The column names available for send-time variable mapping, with a sample value
|
|
1292
|
+
* for each. This is what tells you which `mapping` keys a list will accept.
|
|
1293
|
+
*/
|
|
1294
|
+
fields(listId: string, options?: {
|
|
1295
|
+
refresh?: boolean;
|
|
1296
|
+
}, overrides?: RequestOverrides): Promise<ContactListFieldsResponse>;
|
|
1297
|
+
/**
|
|
1298
|
+
* Re-run validation and re-sync suppression across the whole list. Useful after a
|
|
1299
|
+
* bulk suppression import, or to refresh a list that has been sitting. Returns 202.
|
|
1300
|
+
*/
|
|
1301
|
+
revalidate(listId: string, overrides?: RequestOverrides): Promise<AcceptedResponse>;
|
|
1302
|
+
/** Reconcile the denormalized contact count with an exact COUNT. */
|
|
1303
|
+
recount(listId: string, overrides?: RequestOverrides): Promise<RecountContactListResponse>;
|
|
1304
|
+
}
|
|
1305
|
+
|
|
836
1306
|
declare class Outbound {
|
|
837
1307
|
readonly email: EmailResource;
|
|
838
1308
|
readonly templates: TemplatesResource;
|
|
@@ -841,6 +1311,7 @@ declare class Outbound {
|
|
|
841
1311
|
readonly dashboard: DashboardResource;
|
|
842
1312
|
readonly quota: QuotaResource;
|
|
843
1313
|
readonly campaigns: CampaignsResource;
|
|
1314
|
+
readonly contactLists: ContactListsResource;
|
|
844
1315
|
constructor(config?: OutboundConfig);
|
|
845
1316
|
/**
|
|
846
1317
|
* Verify a webhook signature using HMAC-SHA256.
|
|
@@ -884,4 +1355,4 @@ declare class NetworkError extends OutboundError {
|
|
|
884
1355
|
constructor(message?: string);
|
|
885
1356
|
}
|
|
886
1357
|
|
|
887
|
-
export { type AddSuppressionParams, type AnyIncomingWebhookPayload, type Attachment, AuthenticationError, BadRequestError, type BulkEmailParams, type BulkEmailRecipient, type BulkEmailResponse, type BulkResponseRecipient, type CampaignAnalytics, type CampaignAnalyticsParams, type CampaignBounceReason, type CampaignDomainStat, type CampaignRates, type CampaignStatus, type CampaignSummary, type CampaignTimeseriesPoint, type CampaignTotals, type CancelEmailParams, type CancelEmailResponse, ConflictError, type CreateTemplateParams, type CreateWebhookParams, type CreateWebhookResponse, type DashboardResponse, type DedicatedIpWarmup, type EmailJob, type EmailRecipientStatus, type EmailStatus, ForbiddenError, type GlobalQuotaResponse, type IncomingWebhookEvent, type IncomingWebhookEventV2, type IncomingWebhookPayload, type IncomingWebhookPayloadV2, type IpPoolStatus, type JobStatusResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListSuppressionsParams, type ListSuppressionsResponse, type ListTemplatesParams, type ListTemplatesResponse, type ListWebhooksResponse, type MessageContentResponse, type MessageStatusRecipient, type MessageStatusResponse, NetworkError, NotFoundError, Outbound, type OutboundConfig, OutboundError, type QuotaResponse, RateLimitError, type RequestOverrides, type ResolvedConfig, type SendEmailParams, type SendEmailResponse, ServerError, type Suppression, type SuppressionResponse, type Template, type TemplateBulkRecipient, type TemplateBulkSendParams, type TemplateBulkSendResponse, type TemplatePreviewParams, type TemplatePreviewResponse, type TemplateResponse, type TemplateSendParams, type TemplateStatsResponse, TimeoutError, type UpdateTemplateParams, type UpdateWebhookParams, type UpdateWebhookResponse, type Webhook, type WebhookEvent, type WebhookEventDetails, type WebhookEventStatus, type WebhookRetryStrategy };
|
|
1358
|
+
export { type AcceptedResponse, type AddContactParams, type AddSuppressionParams, type AnyIncomingWebhookPayload, type Attachment, AuthenticationError, BadRequestError, type BulkAddSuppressionsParams, type BulkAddSuppressionsResponse, type BulkDeleteContactsParams, type BulkDeleteContactsResponse, type BulkEmailParams, type BulkEmailRecipient, type BulkEmailResponse, type BulkRemoveSuppressionsParams, type BulkRemoveSuppressionsResponse, type BulkResponseRecipient, type CampaignAnalytics, type CampaignAnalyticsParams, type CampaignBounceReason, type CampaignDomainStat, type CampaignRates, type CampaignStatus, type CampaignSummary, type CampaignTimeseriesPoint, type CampaignTotals, type CancelEmailParams, type CancelEmailResponse, type CheckQuotaResponse, ConflictError, type Contact, type ContactList, type ContactListDetail, type ContactListFieldsResponse, type ContactStatus, type ContactStatusReason, type CreateContactListParams, type CreateTemplateParams, type CreateWebhookParams, type CreateWebhookResponse, type DashboardResponse, type DedicatedIpWarmup, type EmailJob, type EmailList, type EmailRecipientStatus, type EmailStatus, ForbiddenError, type GlobalQuotaResponse, type ImportContactRow, type ImportContactsParams, type ImportContactsResponse, type IncomingWebhookEvent, type IncomingWebhookEventV2, type IncomingWebhookPayload, type IncomingWebhookPayloadV2, type IpPoolStatus, type JobStatusResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactListsParams, type ListContactListsResponse, type ListContactsParams, type ListContactsResponse, type ListSendResponse, type ListSuppressionsParams, type ListSuppressionsResponse, type ListTemplatesParams, type ListTemplatesResponse, type ListWebhooksResponse, type MessageContentResponse, type MessageStatusRecipient, type MessageStatusResponse, NetworkError, NotFoundError, Outbound, type OutboundConfig, OutboundError, type QuotaResponse, RateLimitError, type RecountContactListResponse, type RejectedEmail, type RequestOverrides, type ResolvedConfig, type SearchSuppressionsParams, type SearchSuppressionsResponse, type SendEmailParams, type SendEmailResponse, ServerError, type Suppression, type SuppressionReason, type SuppressionResponse, type Template, type TemplateBulkRecipient, type TemplateBulkSendParams, type TemplateBulkSendResponse, type TemplatePreviewParams, type TemplatePreviewResponse, type TemplateResponse, type TemplateSendParams, type TemplateStatsResponse, TimeoutError, type UpdateContactListParams, type UpdateContactParams, type UpdateTemplateParams, type UpdateWebhookParams, type UpdateWebhookResponse, type VariableMapping, type Webhook, type WebhookEvent, type WebhookEventDetails, type WebhookEventStatus, type WebhookRetryStrategy };
|