Claim a Libretto Cloud SMS inbox, then wait for an inbound one-time code during a portal login.
claimSmsOtp()claimSmsOtp locks a tenant SMS inbox number, then returns a handle whose wait() method polls until the inbound code arrives. Use it when a portal texts a one-time code. Prefer authenticator TOTP (*_totp_secret) when the portal supports it.claimSmsOtp in the sign-in path. See SMS OTP on Libretto Cloud for pool APIs and isolation rules.1async function claimSmsOtp(options: ClaimSmsOtpOptions): Promise<SmsOtpClaim>;
otp.wait() after send-code.LIBRETTO_API_KEY (same key as deploy and CLI).claimSmsOtp picks it up with no extra args.phoneNumberId, phoneNumberLabel, or phoneNumber to select the inbox.path phoneNumberIdstring/v1/smsNumbers.path phoneNumberLabelstringuhc). Prefer one
number per portal.path phoneNumberstring+15551234567) from the
tenant pool.path timeoutMsnumber120000.path pollIntervalMsnumber1500.path apiKeystringLIBRETTO_API_KEY and hosted jobs use the injected job token.path apiUrlstringLIBRETTO_API_URL or
https://api.libretto.sh.phoneNumberstringclaimIdstringphoneNumberIdstringwait() => Promise<SmsOtpCode>{ code, phoneNumber,
claimId } once. Expires the claim if the wait times out or errors.1234567891011121314import { claimSmsOtp, workflow } from "libretto"; export default workflow("portal-login", { credentials: ["username", "password"], async handler(ctx, input) { // ... fill username/password, then: const otp = await claimSmsOtp({ phoneNumberLabel: "uhc" }); // Inbox is locked. otp.phoneNumber is the claimed number. await ctx.page.click('button:has-text("Send code")'); const { code } = await otp.wait(); await ctx.page.fill('input[name="otp"]', code); }, });