Skip to content

PhoneNumbersResource

Defined in: src/resources/phone-numbers.ts:52

Phone-number management API exposed as client.phoneNumbers.

new PhoneNumbersResource(request, getDefaultPhoneNumberId): PhoneNumbersResource

Defined in: src/resources/phone-numbers.ts:56

RequestFn

PhoneNumberIdAccessor

PhoneNumbersResource

deregister(phoneNumberId?): Promise<SuccessResponse>

Defined in: src/resources/phone-numbers.ts:132

Deregisters the phone number from the Cloud API.

string

Promise<SuccessResponse>


get(phoneNumberId?, fields?): Promise<PhoneNumber>

Defined in: src/resources/phone-numbers.ts:65

Reads a phone number’s details. Pass fields to request specific Graph fields; when omitted no field selection is sent.

string

string[]

Promise<PhoneNumber>


getBusinessProfile(phoneNumberId?, fields?): Promise<BusinessProfile | undefined>

Defined in: src/resources/phone-numbers.ts:160

Reads the WhatsApp Business Profile for the phone number. When fields is omitted a sensible default set is requested. Graph returns the profile as the first element of a data array; this unwraps it for convenience and returns undefined when the array is empty.

string

string[]

Promise<BusinessProfile | undefined>


register(options, phoneNumberId?): Promise<SuccessResponse>

Defined in: src/resources/phone-numbers.ts:115

Registers the phone number for Cloud API use with its six-digit two-step PIN, optionally pinning a data-localization region.

RegisterOptions

string

Promise<SuccessResponse>


requestVerificationCode(options, phoneNumberId?): Promise<SuccessResponse>

Defined in: src/resources/phone-numbers.ts:77

Requests a verification code for the phone number via SMS or voice call. Validates the delivery method and that a language is supplied.

RequestVerificationCodeOptions

string

Promise<SuccessResponse>


setTwoStepPin(pin, phoneNumberId?): Promise<SuccessResponse>

Defined in: src/resources/phone-numbers.ts:144

Sets or changes the phone number’s six-digit two-step verification PIN. There is no API to disable two-step verification once enabled.

string

string

Promise<SuccessResponse>


updateBusinessProfile(profile, phoneNumberId?): Promise<SuccessResponse>

Defined in: src/resources/phone-numbers.ts:178

Updates the WhatsApp Business Profile for the phone number. Only provided fields are sent; profilePictureHandle maps to profile_picture_handle. Validates documented length and count limits before sending.

BusinessProfileUpdate

string

Promise<SuccessResponse>


verifyCode(code, phoneNumberId?): Promise<SuccessResponse>

Defined in: src/resources/phone-numbers.ts:99

Submits a verification code received via requestVerificationCode. The code must be a non-empty numeric string.

string

string

Promise<SuccessResponse>

Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.