One index
Folders and labels with roles; messages with thread, direction, categories and priority.
One index of every Gmail, Microsoft 365 and IMAP mailbox, synced by provider push, and an outbox that queues, retries and reports each send.
// Unread, high-priority mail, newest first
const { items } = await workwae.messages.list({
accountId,
unread: true,
importance: "high",
});
// Body and attachments, stored or fetched
const message = await workwae.messages.get({
accountId,
messageId: items[0].id,
});
console.log(message.body.html, message.attachments);
// To the provider and the index at once
await workwae.messages.update({
accountId,
messageId: message.id,
isRead: true,
});# Unread, high-priority mail, newest first
listing = workwae.messages.list(
account_id=account_id,
unread=True,
importance="high",
)
# Body and attachments, stored or fetched
message = workwae.messages.get(
account_id=account_id,
message_id=listing.items[0].id,
)
print(message.body.html, message.attachments)
# To the provider and the index at once
workwae.messages.update(
account_id=account_id,
message_id=message.id,
is_read=True,
)
Gmail, Microsoft 365 (including GCC High and DoD) and any IMAP server answer through one API, with typed SDKs for TypeScript and Python.
Folders and labels with roles; messages with thread, direction, categories and priority.
Gmail Pub/Sub, Graph notifications and IMAP IDLE and NOTIFY, behind a backstop poll.
Fetched on request by default, or cached or kept, encrypted per tenant.
Ranked full-text over the index, or Gmail search, KQL or IMAP SEARCH as written.
Conversations with participants and unread counts, whole-thread actions, and drafts you can send.
One send at a time per account, retried, scheduled or undone.
Send-as, proxy and Send As addresses or IMAP aliases, with signatures per message or on every send.
Up to 100 personal messages per merge, with one-click unsubscribe.
Opt-in opens and clicks, people and machines counted apart.
outbox.create seals and queues the message and answers at
once; the rest arrives as events carrying your reference.
undoSendSecondsundo_send_seconds (0 to 60) holds sends
until undoUntilundo_until, and a sendAtsend_at can move before the first attempt
(send.rescheduled).
outboxIdoutbox_id and
reference, so bounces and replies match the send.
"high" or "low" writes the headers
Outlook, Thunderbird and Apple Mail read; indexed messages carry importance.
// From a send-as identity, November 3 at 9:00 UTC
const send = await workwae.outbox.create({
accountId,
from: { address: "sales@example.com" },
to: [{ name: "Priya Shah", address: "priya@example.com" }],
subject: "Contract for review",
html: "<p>The contract is attached.</p>",
attachments: [
{
filename: "contract.pdf",
contentType: "application/pdf",
content: pdfBase64,
},
],
priority: "high",
sendAt: "2026-11-03T09:00:00Z",
reference: "deal_1042",
});
// Before the first attempt, move it earlier or later
await workwae.outbox.reschedule({
accountId,
outboxId: send.id,
sendAt: "2026-11-03T14:00:00Z",
});
// Queued, sending, sent, failed or cancelled
const entry = await workwae.outbox.get({
accountId,
outboxId: send.id,
});
console.log(entry.status, entry.attempt, entry.lastError);from datetime import datetime, timezone
# From a send-as identity, November 3 at 9:00 UTC
send = workwae.outbox.create(
account_id=account_id,
from_={"address": "sales@example.com"},
to=[{"name": "Priya Shah", "address": "priya@example.com"}],
subject="Contract for review",
html="<p>The contract is attached.</p>",
attachments=[
{
"filename": "contract.pdf",
"content_type": "application/pdf",
"content": pdf_base64,
},
],
priority="high",
send_at=datetime(2026, 11, 3, 9, tzinfo=timezone.utc),
reference="deal_1042",
)
# Before the first attempt, move it earlier or later
workwae.outbox.reschedule(
account_id=account_id,
outbox_id=send.id,
send_at=datetime(2026, 11, 3, 14, tzinfo=timezone.utc),
)
# Queued, sending, sent, failed or cancelled
entry = workwae.outbox.get(account_id=account_id, outbox_id=send.id)
print(entry.status, entry.attempt, entry.last_error)
Store a template once, send one message per recipient, and skip whoever left the list.
{{rcpt.unsubscribeUrl}}, over HTTPS as Gmail and Yahoo require.
global, checked when queued and at delivery.
message.bounced; a gone address on a list
send goes on global, and abuse reports can suppress it on that list.
const template = await workwae.templates.create({
name: "renewal-reminder",
subject: "{{params.company}}: your renewal is due",
html:
"<p>Hi {{params.name}}, you renew on {{params.date}}.</p>" +
'<p><a href="{{rcpt.unsubscribeUrl}}">Unsubscribe</a></p>',
});
// One message per recipient, each addressed to them alone
const { items } = await workwae.mailMerges.create({
accountId,
template: template.id,
listId: "renewals",
entries: [
{
to: { address: "priya@example.com" },
params: { name: "Priya", company: "Acme", date: "Dec 1" },
},
{
to: { address: "sam@example.com" },
params: { name: "Sam", company: "Globex", date: "Dec 4" },
},
],
});
for (const result of items) {
if (!result.success) console.warn(result.to, result.reason);
}
// Your own opt-outs, on the same list
await workwae.suppressions.entries.add({
listId: "renewals",
addresses: ["former-customer@example.com"],
});template = workwae.templates.create(
name="renewal-reminder",
subject="{{params.company}}: your renewal is due",
html=(
"<p>Hi {{params.name}}, you renew on {{params.date}}.</p>"
'<p><a href="{{rcpt.unsubscribeUrl}}">Unsubscribe</a></p>'
),
)
# One message per recipient, each addressed to them alone
merge = workwae.mail_merges.create(
account_id=account_id,
template=template.id,
list_id="renewals",
entries=[
{
"to": {"address": "priya@example.com"},
"params": {"name": "Priya", "company": "Acme", "date": "Dec 1"},
},
{
"to": {"address": "sam@example.com"},
"params": {"name": "Sam", "company": "Globex", "date": "Dec 4"},
},
],
)
for result in merge.items:
if result.success is False:
print(result.to, result.reason)
# Your own opt-outs, on the same list
workwae.suppressions.entries.add(
list_id="renewals",
addresses=["former-customer@example.com"],
)
Opt-in per tenant, account or send; proxies, prefetching and link scanners don't count as readers.
mailto:, unsubscribe or data-workwae-notrack links.
actor (human, proxy, prefetch,
scanner or unknown) and reasons, counted apart.
const send = await workwae.outbox.create({
accountId,
to: [{ address: "jordan@example.com" }],
subject: "Proposal and next steps",
html: proposalHtml,
tracking: { opens: true, clicks: true },
reference: "deal_4821",
});
// Later: counts split by person and machine
const entry = await workwae.outbox.get({
accountId,
outboxId: send.id,
});
console.log(entry.humanOpenCount, entry.machineOpenCount);
// Each hit, newest first, with why it was classified that way
const { items } = await workwae.outbox.tracking({
accountId,
outboxId: send.id,
});
for (const hit of items) {
console.log(hit.kind, hit.actor, hit.isMachine, hit.reasons);
}send = workwae.outbox.create(
account_id=account_id,
to=[{"address": "jordan@example.com"}],
subject="Proposal and next steps",
html=proposal_html,
tracking={"opens": True, "clicks": True},
reference="deal_4821",
)
# Later: counts split by person and machine
entry = workwae.outbox.get(account_id=account_id, outbox_id=send.id)
print(entry.human_open_count, entry.machine_open_count)
# Each hit, newest first, with why it was classified that way
hits = workwae.outbox.tracking(account_id=account_id, outbox_id=send.id)
for hit in hits.items:
print(hit.kind, hit.actor, hit.is_machine, hit.reasons)
| First sync |
No per-message events; ends with one account.initialized
with counts, and only later changes emit message.* and
mailbox.*.
|
|---|---|
| Sync window | 90 days by default, set per tenant or per account, or the whole history; provider search reaches older mail. |
| Your own writes | API writes change the index in the same call, and sync announces nothing more when it sees them. |
| Push and polling | A notification only wakes the sync, so a lost one delays a change; the backstop poll runs every 10 minutes with push, every minute without. |
| Direction | Outbound when in Sent or from the account's address or an identity, so drafts and notes to self count. |
| Expired cursors | The mailbox or folder is re-read and diffed, so only real changes are announced. |
| Aspect | Gmail and Google Workspace | Microsoft 365 | IMAP |
|---|---|---|---|
| Mailboxes | Labels; a message can carry several. Inbox tabs become categories; no per-label counts. | Folders; a message is in one. Immutable ids survive a move. | Folders from LIST, counts from LIST-STATUS. |
| Finding changes | history.list; a history id older than about a week forces a full read, diffed. | Message delta per folder plus a folder delta; an expired token re-reads the folder, diffed. | QRESYNC (VANISHED and CHANGEDSINCE) or UID and flag comparison, 1,000 messages per commit, resumable. |
| Push | users.watch to Cloud Pub/Sub, renewed daily, OIDC-verified; your own Google OAuth app can use its own topic. | One subscription per account, renewed at half its lifetime or on a lifecycle notification. | IDLE on INBOX; NOTIFY (RFC 5465) for other mailboxes where offered, else a STATUS check of Sent and Drafts every minute. |
| Backstop | The poll; a refused watch is explained in runtime detail and retried with backoff. | The poll, for notifications Graph drops. | A full read every 5 minutes on a second connection; at most two per account. |
| Provider search | Gmail syntax, at most 10 searches per account per minute. | KQL. | SEARCH TEXT. |
| Message identity | Gmail message ids; attachments by MIME part. | Immutable ids; a replaced draft keeps its id. | OBJECTID or X-GM-MSGID where available, else another program's move is a delete plus a create. |
| Sent copies | Filed by Gmail; consumer Gmail replaces the Message-ID, and Workwae links the copy by its own header. | Filed by Exchange in Sent Items. | Appended untracked to Sent unless the server files it. |
| Worth knowing | Workwae's Google app uses gmail.modify, so delete moves to Trash; permanent delete needs your own app with full scope. | At most 4 requests in flight per mailbox, honoring Retry-After; in GCC High and DoD permanent delete goes to Recoverable Items. | Servers autodiscovered; private addresses and plaintext logins refused. Google over IMAP needs your own Google OAuth app. |
bodyStorage is a tenant default with a per-account override.
Stored content goes to object storage, sealed per tenant in 64 KiB chunks and streamed back
a chunk at a time.
| Mode | Stored | Reads from | Index search covers |
|---|---|---|---|
none (default) | Metadata only; switching to it drops stored content. | The provider, every time. | Subject, sender and recipient names and addresses, snippet. |
cache | What reads fetch, capped per workspace; dropped after 30 days unread through the API. | Stored content, storing the raw message on a miss. | Also bodies read so far. |
full | Every indexed message, backfilled on switch without holding back new mail. | Stored content; drafts always from the provider. | Also every body. |
The index keeps a search vector of body text, never the text. With
source=auto (the default), search asks the provider only when
the index can't answer, such as before the window; results the index lacks have a null id
and can't be opened through the API.
Signed per Standard Webhooks and filterable by event type, account, mailbox, sender, subject and direction.
| Event | When |
|---|---|
account.initialized | The first mail sync finished, with mailbox and message counts. |
mailbox.created, mailbox.updated, mailbox.deleted | A folder or label appeared, changed name, place or role, or went away; counts change silently. |
message.created | A message was received, sent, drafted or moved in from outside the window. |
message.updated | Read, flagged, moved, reprioritized or linked to its send; changes names the fields. |
message.deleted | A message was removed; carries it and its mailboxes as last indexed. |
send.sent, send.retrying, send.failed | Accepted by the provider, waiting for nextAttemptAt after a failed attempt, or failed for good. |
send.rescheduled | A queued send got a new sendAt before its first attempt. |
message.bounced | A delivery status notification arrived, with each failed recipient's status and diagnostic, and the outboxId if it answers a send. |
message.opened, message.clicked | A tracked send was opened or a link followed, with the actor and its reasons. |
suppression.created | An unsubscribe, bounce or complaint put an address on a suppression list. |
message.classified | With AI features on, a reply to your send was classified as a human reply, auto-reply, opt-out or bounce. |
Delivery is at least once, but a retry first looks for a copy already sent, and provider
requests repeat only after a refusal. An SMTP send with an unknown outcome fails as
outcome_unknown instead of retrying.
Worldwide (including GCC), GCC High and DoD, each with its own app registration. In 21Vianet, Graph has no message delta yet, so mail runs over IMAP and SMTP with Microsoft sign-in.
Gmail and Microsoft 365 keep the tracked copy, pixel included, in Sent; on Gmail, viewing
it arrives through the image proxy as a proxy hit. IMAP
accounts keep an untracked copy.
Log every rep's email to the deal, and send from their mailbox.
Shared inboxes as tickets, answered from the same address.
Read, draft and send for a person, with every change as an event.
Signed deliveries, filters, replays and an ordered change feed.
Google, Microsoft 365 and CardDAV address books.
Hosted or headless sign-in for every account type.
Workwae is in early access. Tell us what you are building, and read the docs in the meantime.