From API key to first sent message.
Six steps with the TypeScript SDK: connect a mailbox, receive its events, then read and send mail.
Get an API key.
Workspaces come with early access; once yours is open, create a key in the console at app.workwae.com and keep it in your secret manager, since it is shown once.
# Your app's environment, not committed
WORKWAE_API_KEY=wk_... Install the SDK.
@workwae/sdk is a typed TypeScript client on npm, currently an alpha.
bun add @workwae/sdk
# or
npm install @workwae/sdk Create the client.
Pass the key from your own app’s environment; every method takes one object with its path, query and body fields.
import { createClient } from "@workwae/sdk";
export const workwae = createClient({
apiKey: process.env.WORKWAE_API_KEY,
}); Connect a mailbox.
Create a hosted connect session and redirect the user to its URL; the browser returns with status and account_id in the query string.
const session = await workwae.connectSessions.create({
redirectUri: "https://app.example.com/mail/connected",
providers: ["google", "microsoft", "imap"],
externalRef: "user_42",
});
// Redirect the browser to session.url
// Back on your redirect URI:
// ?status=success&account_id=6f1c2a4e-... Receive events.
Create a webhook endpoint, store its secret, and verify each delivery with parseWebhook before you trust it.
import { parseWebhook } from "@workwae/sdk";
const { endpoint, secret } = await workwae.webhooks.create({
url: "https://app.example.com/hooks/workwae",
filters: { eventTypes: ["message.created"] },
});
// In your handler: checks the signature and the timestamp
const body = await request.text();
const event = await parseWebhook(secret, request.headers, body);
if (event.known && event.type === "message.created") {
console.log(event.data.message.subject);
} Read and send.
List the account’s messages, then reply from the same mailbox; sends are queued and retried, and results arrive as events.
const { items } = await workwae.messages.list({ accountId, unread: true });
const message = await workwae.messages.get({
accountId,
messageId: items[0].id,
});
await workwae.outbox.create({
accountId,
inReplyToMessageId: message.id,
to: [{ address: "priya@example.com" }],
subject: "Re: Q3 roadmap",
text: "Thanks, I will review it today.",
}); Go deeper in the docs.
Quickstart guide
The full walkthrough, with curl, errors and the change feed.
Connect flows
Headless connect, your own OAuth apps and reauthorization.
Webhooks
Filters, retries, replay and secret rotation.
API reference
Every operation, with its fields and error reasons.
OpenAPI document
The machine-readable spec for code generators and tools.
Get a workspace and an API key.
We are onboarding a small number of teams. Tell us what you are building.