Interface: MailroomClient
Defined in: packages/sdk/src/client.ts:38
The Mailroom API client. Build one with createClient() and reach the API
through its resource properties; every method resolves to the response data
and throws a typed MailroomError on failure.
Example
const mailroom = createClient({
apiKey: process.env.MAILROOM_API_KEY!,
baseUrl: "https://mailroom.example.com",
});
await mailroom.send({ to: "ada@example.com", template: "welcome", data: { name: "Ada" } });
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
campaigns | readonly | CampaignsResource | One-off campaigns. | packages/sdk/src/client.ts:53 |
contacts | readonly | ContactsResource | Contacts: upsert, read, filter, unsubscribe. | packages/sdk/src/client.ts:43 |
enrollments | readonly | EnrollmentsResource | Active sequence enrollments (cancellation). | packages/sdk/src/client.ts:49 |
events | readonly | EventsResource | Product events that drive sequence triggers. | packages/sdk/src/client.ts:47 |
segments | readonly | SegmentsResource | Saved audience filters. | packages/sdk/src/client.ts:51 |
sends | readonly | SendsResource | The send log with delivery + engagement state. | packages/sdk/src/client.ts:61 |
sequences | readonly | SequencesResource | Lifecycle sequences and their flow graphs. | packages/sdk/src/client.ts:45 |
suppressions | readonly | SuppressionsResource | The do-not-send list. | packages/sdk/src/client.ts:55 |
templates | readonly | TemplatesResource | The template registry and its content versions. | packages/sdk/src/client.ts:59 |
webhooks | readonly | WebhooksResource | Outbound webhook endpoints. | packages/sdk/src/client.ts:57 |
Methods
campaign()
campaign(input: CampaignInput, opts?: CallOptions): Promise<CampaignResult>;
Defined in: packages/sdk/src/client.ts:105
Create a campaign, injecting the client's default brand.
Parameters
| Parameter | Type |
|---|---|
input | CampaignInput |
opts? | CallOptions |
Returns
Promise<CampaignResult>
health()
health(opts?: CallOptions): Promise<HealthResult>;
Defined in: packages/sdk/src/client.ts:110
Liveness check; returns the service name and the SDK version the API sees.
Parameters
| Parameter | Type |
|---|---|
opts? | CallOptions |
Returns
Promise<HealthResult>
send()
send(input: SendInput, opts?: CallOptions): Promise<SendResult>;
Defined in: packages/sdk/src/client.ts:96
Send one transactional or marketing email, rendering template with data.
The client's defaultBrand is applied when the input omits brand.
Parameters
| Parameter | Type |
|---|---|
input | SendInput |
opts? | CallOptions |
Returns
Promise<SendResult>
unsubscribe()
unsubscribe(contactId: string, opts?: CallOptions): Promise<{
id: string;
status: "unsubscribed";
}>;
Defined in: packages/sdk/src/client.ts:115
Programmatic opt-out by contact id (alias of contacts.unsubscribe).
Parameters
| Parameter | Type |
|---|---|
contactId | string |
opts? | CallOptions |
Returns
Promise<{
id: string;
status: "unsubscribed";
}>