Receive portal SMS one-time codes through tenant-owned Libretto Cloud inbox numbers, then wait for the code inside a workflow.
*_totp_secret) when the portal supports it.+15551234567) as the MFA phone on the portal account.await claimSmsOtp(...) to lock an inbox, click send-code, then await otp.wait() for the code.12libretto cloud sms-numbers provision --label uhc libretto cloud sms-numbers list
/v1/smsNumbers/provisionx-api-key.label (optional): portal label such as uhccountry (optional): two-letter country codearea_code (optional): preferred area code/v1/smsNumbers/listinclude_released: true to include released rows./v1/smsNumbers/updatelabel./v1/smsNumbers/releaseclaimSmsOtp first locks the inbox (exclusive claim), then returns a handle. Always await the claim before clicking send-code so the lock is held when the SMS arrives. Call otp.wait() after send-code.claimSmsOtp.phoneNumber, phoneNumberId, or phoneNumberLabel to select the inbox.LIBRETTO_API_KEY (same key as deploy/CLI)claimSmsOtp picks it up with no extra args1234567891011121314import { 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); }, });
claimSmsOtp:POST /v1/smsOtp/claims/create — exclusive open claim on the inbox (returns after lock)otp.wait() polls POST /v1/smsOtp/claims/get until fulfilled, then consumes the code oncetimeoutMs (default 120s) is how long to poll after the claim opens. Claim TTL is derived from it (clamped to 30–300 seconds).x-api-key or x-libretto-job-token (hosted jobs inject the job token automatically).number_id, label, or phone_number; optional ttl_seconds (30–300, default 300). claimSmsOtp sets ttl_seconds from timeoutMs and does not expose a separate TTL option.claim_id; optional consume (default true). Returns code once when fulfilled.claim_id. Marks an open claim expired so the inbox lock is freed (used when otp.wait() times out).