Skip to main content
Prerequisite: A Momentic-provisioned phone number. Request one.

Fetch the code

const msg = await sms.fetchLatest({
  to: "+18888888888",
  afterDate: new Date(Date.now() - 60_000),
  timeout: 30_000,
});

const [code] = msg.body.match(/\b\d{6}\b/) ?? [];
if (!code) throw new Error("No OTP code found in SMS");
setVariable("OTP_CODE", code);
Then add a Type step with value {{ env.OTP_CODE }}.
Keep tests single-flow per number. Parallel runs on the same number can race.