PhoneNumbersResource
Defined in: src/resources/phone-numbers.ts:52
Phone-number management API exposed as client.phoneNumbers.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new PhoneNumbersResource(
request,getDefaultPhoneNumberId):PhoneNumbersResource
Defined in: src/resources/phone-numbers.ts:56
Parameters
Section titled “Parameters”request
Section titled “request”RequestFn
getDefaultPhoneNumberId
Section titled “getDefaultPhoneNumberId”PhoneNumberIdAccessor
Returns
Section titled “Returns”PhoneNumbersResource
Methods
Section titled “Methods”deregister()
Section titled “deregister()”deregister(
phoneNumberId?):Promise<SuccessResponse>
Defined in: src/resources/phone-numbers.ts:132
Deregisters the phone number from the Cloud API.
Parameters
Section titled “Parameters”phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”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.
Parameters
Section titled “Parameters”phoneNumberId?
Section titled “phoneNumberId?”string
fields?
Section titled “fields?”string[]
Returns
Section titled “Returns”Promise<PhoneNumber>
getBusinessProfile()
Section titled “getBusinessProfile()”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.
Parameters
Section titled “Parameters”phoneNumberId?
Section titled “phoneNumberId?”string
fields?
Section titled “fields?”string[]
Returns
Section titled “Returns”Promise<BusinessProfile | undefined>
register()
Section titled “register()”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.
Parameters
Section titled “Parameters”options
Section titled “options”phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”Promise<SuccessResponse>
requestVerificationCode()
Section titled “requestVerificationCode()”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.
Parameters
Section titled “Parameters”options
Section titled “options”RequestVerificationCodeOptions
phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”Promise<SuccessResponse>
setTwoStepPin()
Section titled “setTwoStepPin()”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.
Parameters
Section titled “Parameters”string
phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”Promise<SuccessResponse>
updateBusinessProfile()
Section titled “updateBusinessProfile()”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.
Parameters
Section titled “Parameters”profile
Section titled “profile”phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”Promise<SuccessResponse>
verifyCode()
Section titled “verifyCode()”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.
Parameters
Section titled “Parameters”string
phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”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.