Overview
Provider-neutral email sync adapters for AbsoluteJS applications.
@absolutejs/emailv0.1.0alphaMessagingGmail, Microsoft Graph, and IMAP sync clients that return one normalized message shape.
Provider-neutral email sync adapters for AbsoluteJS applications, covering Gmail REST sync, Microsoft Graph delta sync, and IMAP over TLS. The package owns the provider mechanics — history and delta cursors, webhook payload parsing, and normalized message shapes — while your host app keeps ownership of consent, credential storage, persistence, and scheduling. Normalized messages come out in one shape regardless of provider, ready to persist, score, filter, or enrich.
bun add @absolutejs/emailProvider-neutral email sync adapters for AbsoluteJS applications.
This package owns the provider mechanics:
Gmail REST sync, users.watch, and Pub/Sub payload parsing
Microsoft Graph message delta sync and subscription notification parsing
IMAP over TLS for custom mailbox providers
Normalized message shapes that host apps can persist, score, filter, or enrich
Host applications own product policy:
user consent and privacy controls
credential storage
business-specific relevance scoring
database persistence
queue scheduling and UI
createGmailClient handles Gmail REST history sync, users.watch registration, and Pub/Sub webhook payload parsing via parseGmailPubSubWebhook.
createMicrosoftGraphEmailClient drives Graph message delta sync and parses subscription notifications for Microsoft 365 mailboxes.
fetchImapMessages pulls mail over IMAP with TLS for Fastmail, self-hosted, and other custom mailbox providers.
gmailMessagesToNormalized and microsoftMessagesToNormalized convert provider payloads into one message shape your app can persist or score.
The package never touches credential storage, consent, relevance scoring, or persistence — those stay in your application where product policy belongs.
Outcomes
Provider-neutral email sync adapters for AbsoluteJS applications.
Hardening checklist
Follow in order
Working example for Gmail.
import {
createGmailClient,
gmailMessagesToNormalized,
parseGmailPubSubWebhook,
} from "@absolutejs/email";
const client = createGmailClient({ accessToken });
const { messages, cursor } = await client.listHistory({ cursor: historyId });
const normalized = await gmailMessagesToNormalized(client, messages, {
accountEmail: "member@example.com",
});Working example for Microsoft Graph.
import {
createMicrosoftGraphEmailClient,
microsoftMessagesToNormalized,
} from "@absolutejs/email";
const client = createMicrosoftGraphEmailClient({ accessToken });
const { messages, cursor } = await client.listDelta();
const normalized = microsoftMessagesToNormalized(messages, {
accountEmail: "member@example.com",
});Sync a Gmail mailbox from a history cursor and normalize the results. Persist the returned cursor and pass it back on the next sync.
import {
createGmailClient,
gmailMessagesToNormalized
} from '@absolutejs/email';
const client = createGmailClient({ accessToken });
const { messages, cursor } = await client.listHistory({
cursor: historyId
});
const normalized = await gmailMessagesToNormalized(client, messages, {
accountEmail: 'member@example.com'
});Microsoft 365 mailboxes sync through Graph delta queries — the first listDelta call returns everything plus a delta cursor for incremental follow-ups.
import {
createMicrosoftGraphEmailClient,
microsoftMessagesToNormalized
} from '@absolutejs/email';
const client = createMicrosoftGraphEmailClient({ accessToken });
const { messages, cursor } = await client.listDelta();
const normalized = microsoftMessagesToNormalized(messages, {
accountEmail: 'member@example.com'
});For providers without a REST API, fetchImapMessages connects over IMAP with TLS and returns messages in the same normalized shape.
import { fetchImapMessages } from '@absolutejs/email';
const result = await fetchImapMessages({
accountEmail: 'member@example.com',
auth: { pass: appPassword, user: 'member@example.com' },
host: 'imap.fastmail.com',
port: 993,
secure: true
});Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.
Current package surface
Import surface · click to copy