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.
Prerequisite: A Momentic-provisioned inbox (@usemomentic.com or
@gomomentic.com). Request one.
Fetch the code
Add a JavaScript step that reads the latest email, parses the code, and
saves it to the environment.
const msg = await email.fetchLatest({
inbox: "otp+test",
afterDate: new Date(Date.now() - 60_000),
timeout: 30_000,
});
const [code] = msg.text.match(/\b\d{6}\b/) ?? [];
if (!code) throw new Error("No OTP code found in email");
setVariable("OTP_CODE", code);
Then add a Type step with value {{ env.OTP_CODE }} targeting the OTP
input.
Always pass afterDate to avoid matching a stale code from a previous run.
This script polls for up to 30 seconds, so set the JavaScript step’s
Timeout field to at least that. Steps default to 15 seconds (max 60)
and will be killed early if the timeout is left at the default.