NewWacht Bench is live — AI-assisted development for Wacht

addPhone()

Creates a user phone identifier for the target user id.

Usage

The following example shows a basic usage of the backend client from @wacht/nextjs/server.

import { wachtClient } from '@wacht/nextjs/server';export async function addPhone(userId: string) {  const client = await wachtClient();  return client.users.addPhone(userId, {    phone_number: '+14155552671',    country_code: 'US',  });}

Signature

function addPhone(  userId: string,  request: AddPhoneRequest,): Promise<UserPhone>

Parameters

userId: string;
Target user id.
country_code: string;
E.164 country code prefix.
phone_number: string;
Phone number value.

Return value

id?: string | undefined;
Phone record id.
phone_number?: string | undefined;
Stored phone number.
country_code?: string | undefined;
Stored country code.
verified?: boolean | undefined;
Verification status.

Behavior

  • Wraps the corresponding backend endpoint for this capability.
  • Use the returned payload as canonical backend state for follow-up operations.

On this page