delivrie 0.3.0 → 0.3.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 South Circle
3
+ Copyright (c) 2026 Surce Inc
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -35,7 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
36
  exports.Delivrie = exports.VERSION = void 0;
37
37
  const webhooks_js_1 = require("./webhooks.cjs");
38
- exports.VERSION = "0.3.0";
38
+ exports.VERSION = "0.3.2";
39
39
  const DEFAULT_BASE_URL = "https://delivrie.io/api";
40
40
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
41
41
  const enc = encodeURIComponent;
@@ -251,6 +251,16 @@ class Delivrie {
251
251
  /** Record an event for a contact; live automations listening for it start. */
252
252
  send: (params) => this.request("POST", "/events", params),
253
253
  list: () => this.request("GET", "/events"),
254
+ /** Live events after `since` (polling). For a stream, open a WebSocket to /events/live (see the docs). */
255
+ live: (params = {}) => this.request("GET", "/events/live", undefined, { query: { ...params } }),
256
+ };
257
+ /** Pods: groups of inboxes kept apart, e.g. one per customer. */
258
+ this.pods = {
259
+ list: (params = {}) => this.request("GET", "/pods", undefined, { query: { ...params } }),
260
+ create: (params) => this.request("POST", "/pods", params),
261
+ get: (idOrClientId) => this.request("GET", `/pods/${enc(idOrClientId)}`),
262
+ update: (idOrClientId, params) => this.request("PATCH", `/pods/${enc(idOrClientId)}`, params),
263
+ remove: (idOrClientId) => this.request("DELETE", `/pods/${enc(idOrClientId)}`),
254
264
  };
255
265
  this.automations = {
256
266
  list: () => this.request("GET", "/automations"),
@@ -288,8 +298,9 @@ class Delivrie {
288
298
  };
289
299
  /** Inboxes (addresses on receiving domains) and their agent settings. */
290
300
  this.inboxes = {
291
- list: () => this.request("GET", "/inboxes"),
292
- create: (params) => this.request("POST", "/inboxes", params),
301
+ list: (params = {}) => this.request("GET", "/inboxes", undefined, { query: { ...params } }),
302
+ /** No address: an instant address on agents.delivrie.io (pass username, or leave it out for a random one). */
303
+ create: (params = {}) => this.request("POST", "/inboxes", params),
293
304
  get: (idOrAddress) => this.request("GET", `/inboxes/${enc(idOrAddress)}`),
294
305
  update: (idOrAddress, params) => this.request("PATCH", `/inboxes/${enc(idOrAddress)}`, params),
295
306
  remove: (idOrAddress) => this.request("DELETE", `/inboxes/${enc(idOrAddress)}`),
@@ -1,6 +1,6 @@
1
- import type { ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted, BroadcastRecipients, BroadcastLink, AttachmentDownload, EmailShare, ContactImport, CreateContactImportRequest, EmailContent, EmailBlock, EditContentRequest, AiDraftRequest, AiDraft } from "./types.cjs";
1
+ import type { InboxCreateParams, LiveEvent, ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted, BroadcastRecipients, BroadcastLink, AttachmentDownload, EmailShare, ContactImport, CreateContactImportRequest, EmailContent, EmailBlock, EditContentRequest, AiDraftRequest, AiDraft } from "./types.cjs";
2
2
  import { type VerifyWebhookOptions } from "./webhooks.cjs";
3
- export declare const VERSION = "0.3.0";
3
+ export declare const VERSION = "0.3.2";
4
4
  export interface DelivrieOptions {
5
5
  /** Defaults to `https://delivrie.io/api`. */
6
6
  baseUrl?: string;
@@ -244,6 +244,34 @@ export declare class Delivrie {
244
244
  /** Record an event for a contact; live automations listening for it start. */
245
245
  send: (params: SendEventRequest) => Promise<Result<Record<string, unknown>>>;
246
246
  list: () => Promise<Result<List<Record<string, unknown>>>>;
247
+ /** Live events after `since` (polling). For a stream, open a WebSocket to /events/live (see the docs). */
248
+ live: (params?: {
249
+ since?: number;
250
+ events?: string;
251
+ inboxes?: string;
252
+ limit?: number;
253
+ }) => Promise<Result<{
254
+ object: "list";
255
+ data: LiveEvent[];
256
+ last_event_id: number;
257
+ }>>;
258
+ };
259
+ /** Pods: groups of inboxes kept apart, e.g. one per customer. */
260
+ readonly pods: {
261
+ list: (params?: {
262
+ client_id?: string;
263
+ }) => Promise<Result<List<Record<string, unknown>>>>;
264
+ create: (params: {
265
+ name: string;
266
+ client_id?: string;
267
+ metadata?: Record<string, unknown>;
268
+ }) => Promise<Result<Record<string, unknown>>>;
269
+ get: (idOrClientId: string) => Promise<Result<Record<string, unknown>>>;
270
+ update: (idOrClientId: string, params: {
271
+ name?: string;
272
+ metadata?: Record<string, unknown> | null;
273
+ }) => Promise<Result<Record<string, unknown>>>;
274
+ remove: (idOrClientId: string) => Promise<Result<Deleted>>;
247
275
  };
248
276
  readonly automations: {
249
277
  list: () => Promise<Result<List<Automation>>>;
@@ -294,12 +322,12 @@ export declare class Delivrie {
294
322
  };
295
323
  /** Inboxes (addresses on receiving domains) and their agent settings. */
296
324
  readonly inboxes: {
297
- list: () => Promise<Result<List<Record<string, unknown>>>>;
298
- create: (params: {
299
- address: string;
300
- name?: string;
301
- description?: string;
302
- }) => Promise<Result<Record<string, unknown>>>;
325
+ list: (params?: {
326
+ pod?: string;
327
+ client_id?: string;
328
+ }) => Promise<Result<List<Record<string, unknown>>>>;
329
+ /** No address: an instant address on agents.delivrie.io (pass username, or leave it out for a random one). */
330
+ create: (params?: InboxCreateParams) => Promise<Result<Record<string, unknown>>>;
303
331
  get: (idOrAddress: string) => Promise<Result<Record<string, unknown>>>;
304
332
  update: (idOrAddress: string, params: Record<string, unknown>) => Promise<Result<Record<string, unknown>>>;
305
333
  remove: (idOrAddress: string) => Promise<Result<Deleted>>;
@@ -191,6 +191,47 @@ export interface CreateApiKeyRequest {
191
191
  permission?: "full_access" | "sending_access";
192
192
  /** Limit a sending key to one domain. */
193
193
  domain_id?: string;
194
+ /** Limit the key to one inbox (id or address): its threads, drafts and replies, and sending from its address. */
195
+ inbox?: string;
196
+ /** Limit the key to one pod (id or client_id): every inbox in it, and making new ones there. */
197
+ pod?: string;
198
+ }
199
+ export interface InboxRules {
200
+ allow?: string[];
201
+ block?: string[];
202
+ }
203
+ export interface InboxCreateParams {
204
+ /** An address on your own receiving domain. Leave out for an instant agents.delivrie.io address. */
205
+ address?: string;
206
+ /** For agents.delivrie.io: the part before the @. Leave out for a random one. */
207
+ username?: string;
208
+ name?: string;
209
+ /** Sender name on emails from this inbox. */
210
+ display_name?: string;
211
+ description?: string;
212
+ /** Added to every email and reply sent from the address. */
213
+ signature?: {
214
+ text?: string | null;
215
+ html?: string | null;
216
+ } | string | null;
217
+ metadata?: Record<string, string | number | boolean | null>;
218
+ /** Your own id; creating again with it returns the same inbox. */
219
+ client_id?: string;
220
+ /** Pod id or client_id. */
221
+ pod?: string;
222
+ send_rules?: InboxRules;
223
+ receive_rules?: InboxRules;
224
+ /** ISO 8601: deactivate the inbox then. */
225
+ deactivate_at?: string;
226
+ }
227
+ export interface LiveEvent {
228
+ type: "event";
229
+ id: number;
230
+ event: string;
231
+ inbox_id: string | null;
232
+ pod_id: string | null;
233
+ created_at: string;
234
+ data: Record<string, unknown>;
194
235
  }
195
236
  export interface CreateApiKeyResponse {
196
237
  id: string;
@@ -1,6 +1,6 @@
1
- import type { ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted, BroadcastRecipients, BroadcastLink, AttachmentDownload, EmailShare, ContactImport, CreateContactImportRequest, EmailContent, EmailBlock, EditContentRequest, AiDraftRequest, AiDraft } from "./types.js";
1
+ import type { InboxCreateParams, LiveEvent, ApiKey, Automation, Broadcast, Contact, CreateApiKeyRequest, CreateApiKeyResponse, CreateBroadcastRequest, CreateContactRequest, CreateDomainRequest, CreateEmailResponse, CreateTemplateRequest, CreateWebhookRequest, CreateWebhookResponse, Domain, Email, EmailSummary, ForwardEmailRequest, InboxThread, List, ListContactsParams, ListEmailsParams, Log, LogSummary, Metrics, Pagination, ReplyToThreadRequest, RequestOptions, Result, Segment, SendEmailRequest, SendEventRequest, Suppression, Template, Topic, UpdateContactRequest, UpdateDomainRequest, Usage, Webhook, WebhookDelivery, Deleted, BroadcastRecipients, BroadcastLink, AttachmentDownload, EmailShare, ContactImport, CreateContactImportRequest, EmailContent, EmailBlock, EditContentRequest, AiDraftRequest, AiDraft } from "./types.js";
2
2
  import { type VerifyWebhookOptions } from "./webhooks.js";
3
- export declare const VERSION = "0.3.0";
3
+ export declare const VERSION = "0.3.2";
4
4
  export interface DelivrieOptions {
5
5
  /** Defaults to `https://delivrie.io/api`. */
6
6
  baseUrl?: string;
@@ -244,6 +244,34 @@ export declare class Delivrie {
244
244
  /** Record an event for a contact; live automations listening for it start. */
245
245
  send: (params: SendEventRequest) => Promise<Result<Record<string, unknown>>>;
246
246
  list: () => Promise<Result<List<Record<string, unknown>>>>;
247
+ /** Live events after `since` (polling). For a stream, open a WebSocket to /events/live (see the docs). */
248
+ live: (params?: {
249
+ since?: number;
250
+ events?: string;
251
+ inboxes?: string;
252
+ limit?: number;
253
+ }) => Promise<Result<{
254
+ object: "list";
255
+ data: LiveEvent[];
256
+ last_event_id: number;
257
+ }>>;
258
+ };
259
+ /** Pods: groups of inboxes kept apart, e.g. one per customer. */
260
+ readonly pods: {
261
+ list: (params?: {
262
+ client_id?: string;
263
+ }) => Promise<Result<List<Record<string, unknown>>>>;
264
+ create: (params: {
265
+ name: string;
266
+ client_id?: string;
267
+ metadata?: Record<string, unknown>;
268
+ }) => Promise<Result<Record<string, unknown>>>;
269
+ get: (idOrClientId: string) => Promise<Result<Record<string, unknown>>>;
270
+ update: (idOrClientId: string, params: {
271
+ name?: string;
272
+ metadata?: Record<string, unknown> | null;
273
+ }) => Promise<Result<Record<string, unknown>>>;
274
+ remove: (idOrClientId: string) => Promise<Result<Deleted>>;
247
275
  };
248
276
  readonly automations: {
249
277
  list: () => Promise<Result<List<Automation>>>;
@@ -294,12 +322,12 @@ export declare class Delivrie {
294
322
  };
295
323
  /** Inboxes (addresses on receiving domains) and their agent settings. */
296
324
  readonly inboxes: {
297
- list: () => Promise<Result<List<Record<string, unknown>>>>;
298
- create: (params: {
299
- address: string;
300
- name?: string;
301
- description?: string;
302
- }) => Promise<Result<Record<string, unknown>>>;
325
+ list: (params?: {
326
+ pod?: string;
327
+ client_id?: string;
328
+ }) => Promise<Result<List<Record<string, unknown>>>>;
329
+ /** No address: an instant address on agents.delivrie.io (pass username, or leave it out for a random one). */
330
+ create: (params?: InboxCreateParams) => Promise<Result<Record<string, unknown>>>;
303
331
  get: (idOrAddress: string) => Promise<Result<Record<string, unknown>>>;
304
332
  update: (idOrAddress: string, params: Record<string, unknown>) => Promise<Result<Record<string, unknown>>>;
305
333
  remove: (idOrAddress: string) => Promise<Result<Deleted>>;
@@ -1,5 +1,5 @@
1
1
  import { verifyWebhook } from "./webhooks.js";
2
- export const VERSION = "0.3.0";
2
+ export const VERSION = "0.3.2";
3
3
  const DEFAULT_BASE_URL = "https://delivrie.io/api";
4
4
  const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
5
5
  const enc = encodeURIComponent;
@@ -215,6 +215,16 @@ export class Delivrie {
215
215
  /** Record an event for a contact; live automations listening for it start. */
216
216
  send: (params) => this.request("POST", "/events", params),
217
217
  list: () => this.request("GET", "/events"),
218
+ /** Live events after `since` (polling). For a stream, open a WebSocket to /events/live (see the docs). */
219
+ live: (params = {}) => this.request("GET", "/events/live", undefined, { query: { ...params } }),
220
+ };
221
+ /** Pods: groups of inboxes kept apart, e.g. one per customer. */
222
+ this.pods = {
223
+ list: (params = {}) => this.request("GET", "/pods", undefined, { query: { ...params } }),
224
+ create: (params) => this.request("POST", "/pods", params),
225
+ get: (idOrClientId) => this.request("GET", `/pods/${enc(idOrClientId)}`),
226
+ update: (idOrClientId, params) => this.request("PATCH", `/pods/${enc(idOrClientId)}`, params),
227
+ remove: (idOrClientId) => this.request("DELETE", `/pods/${enc(idOrClientId)}`),
218
228
  };
219
229
  this.automations = {
220
230
  list: () => this.request("GET", "/automations"),
@@ -252,8 +262,9 @@ export class Delivrie {
252
262
  };
253
263
  /** Inboxes (addresses on receiving domains) and their agent settings. */
254
264
  this.inboxes = {
255
- list: () => this.request("GET", "/inboxes"),
256
- create: (params) => this.request("POST", "/inboxes", params),
265
+ list: (params = {}) => this.request("GET", "/inboxes", undefined, { query: { ...params } }),
266
+ /** No address: an instant address on agents.delivrie.io (pass username, or leave it out for a random one). */
267
+ create: (params = {}) => this.request("POST", "/inboxes", params),
257
268
  get: (idOrAddress) => this.request("GET", `/inboxes/${enc(idOrAddress)}`),
258
269
  update: (idOrAddress, params) => this.request("PATCH", `/inboxes/${enc(idOrAddress)}`, params),
259
270
  remove: (idOrAddress) => this.request("DELETE", `/inboxes/${enc(idOrAddress)}`),
@@ -191,6 +191,47 @@ export interface CreateApiKeyRequest {
191
191
  permission?: "full_access" | "sending_access";
192
192
  /** Limit a sending key to one domain. */
193
193
  domain_id?: string;
194
+ /** Limit the key to one inbox (id or address): its threads, drafts and replies, and sending from its address. */
195
+ inbox?: string;
196
+ /** Limit the key to one pod (id or client_id): every inbox in it, and making new ones there. */
197
+ pod?: string;
198
+ }
199
+ export interface InboxRules {
200
+ allow?: string[];
201
+ block?: string[];
202
+ }
203
+ export interface InboxCreateParams {
204
+ /** An address on your own receiving domain. Leave out for an instant agents.delivrie.io address. */
205
+ address?: string;
206
+ /** For agents.delivrie.io: the part before the @. Leave out for a random one. */
207
+ username?: string;
208
+ name?: string;
209
+ /** Sender name on emails from this inbox. */
210
+ display_name?: string;
211
+ description?: string;
212
+ /** Added to every email and reply sent from the address. */
213
+ signature?: {
214
+ text?: string | null;
215
+ html?: string | null;
216
+ } | string | null;
217
+ metadata?: Record<string, string | number | boolean | null>;
218
+ /** Your own id; creating again with it returns the same inbox. */
219
+ client_id?: string;
220
+ /** Pod id or client_id. */
221
+ pod?: string;
222
+ send_rules?: InboxRules;
223
+ receive_rules?: InboxRules;
224
+ /** ISO 8601: deactivate the inbox then. */
225
+ deactivate_at?: string;
226
+ }
227
+ export interface LiveEvent {
228
+ type: "event";
229
+ id: number;
230
+ event: string;
231
+ inbox_id: string | null;
232
+ pod_id: string | null;
233
+ created_at: string;
234
+ data: Record<string, unknown>;
194
235
  }
195
236
  export interface CreateApiKeyResponse {
196
237
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delivrie",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Official Node.js and TypeScript SDK for the Delivrie email API: send transactional email, manage domains, contacts, broadcasts and templates, and verify webhooks.",
5
5
  "keywords": ["delivrie", "email", "email-api", "transactional-email", "smtp", "resend-alternative", "webhooks"],
6
6
  "homepage": "https://delivrie.io/docs/sdks",