Skip to main content

Documentation Index

Fetch the complete documentation index at: https://momentic.ai/docs/llms.txt

Use this file to discover all available pages before exploring further.

Prerequisites: A permanent inbox provisioned in Settings -> Email inboxes, or an ephemeral inbox created on the fly with email.create.
Email runs inside the JavaScript step’s sandbox via the global email object. Momentic-provisioned inboxes end in @usemomentic.com or @gomomentic.com.

email.create

Provision a fresh ephemeral inbox at test runtime. The returned inbox is auto-deleted by Momentic after 24 hours. The lifetime is fixed and not configurable from test code. Use this when each run needs a clean inbox (signup flows, magic-link logins, password resets) and you don’t want to share a permanent address across parallel runs.
const inbox = await email.create();
// inbox.email     -> "[email protected]"
// inbox.prefix    -> "mom-1a2b3c4d5e6f"  (use as `inbox` in fetchLatest/fetchAll)
// inbox.expiresAt -> Date  (when Momentic will delete it)

await signUp({ email: inbox.email });
const verification = await email.fetchLatest({
  inbox: inbox.prefix,
  afterDate: new Date(),
  timeout: 30_000,
});
return verification.text;
Ephemeral inboxes are not subject to the self-serve plan’s permanent-inbox cap.

email.send

Send an email from a Momentic-provisioned address.
await email.send({
  subject: "Hello",
  body: "Hello world!",
  to: "[email protected]",
  from: "momentic", // Momentic-provisioned inbox name
});

email.fetchLatest

Returns the most recent email, polling until one arrives or the timeout elapses. Throws on timeout.
const msg = await email.fetchLatest({
  inbox: "jeff+test", // Momentic-provisioned inbox name
  afterDate: new Date(), // only fetch emails received after this date
  timeout: 20_000, // milliseconds, keep below the JS step timeout (default 15s)
  // trimWhitespace?: boolean  - default true
});

// msg.subject, msg.from, msg.fromEmail, msg.to, msg.time, msg.secondsAgo
// msg.size, msg.text, msg.html
return msg.text;

email.fetchAll

Returns up to limit emails without polling. Throws if the inbox is empty. Defaults: 15 minute window, 3 emails. Max: 24 hours, 10 emails.
const msgs = await email.fetchAll({
  inbox: "jeff+test",
  afterDate: new Date(Date.now() - 60 * 1000), // last 60 seconds
  limit: 5, // default 3, max 10
  // trimWhitespace?: boolean  - default true
});

return msgs.filter((msg) => msg.text.includes("verification code"));

Isolated inboxes

Append a suffix to your provisioned username to create unlimited isolated inboxes. If your username is momentic, [email protected] is a separate inbox fetched via inbox: "momentic+test". Use randomized suffixes (e.g. Date.now()) in parallel runs to avoid race conditions.
The JavaScript step itself has a default timeout of 15 seconds (max 60). If your email.fetchLatest timeout exceeds that, set the JavaScript step’s Timeout field high enough to cover the whole script or the step will be killed before your code returns.