BlocksResource
Defined in: src/resources/blocks.ts:30
Block API exposed as client.blocks.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new BlocksResource(
request,getDefaultPhoneNumberId):BlocksResource
Defined in: src/resources/blocks.ts:34
Parameters
Section titled “Parameters”request
Section titled “request”RequestFn
getDefaultPhoneNumberId
Section titled “getDefaultPhoneNumberId”PhoneNumberIdAccessor
Returns
Section titled “Returns”BlocksResource
Methods
Section titled “Methods”block()
Section titled “block()”block(
users,phoneNumberId?):Promise<BlockUsersResponse>
Defined in: src/resources/blocks.ts:47
Blocks one or more WhatsApp users for the given phone number id.
Pass up to MAX_BLOCK_USERS phone numbers; the array must be
non-empty. Only users who have messaged the business in the last 24 hours
can be blocked. Users that could not be blocked appear in
block_users.failed_users even when the overall call succeeds.
Parameters
Section titled “Parameters”string[]
phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”Promise<BlockUsersResponse>
list()
Section titled “list()”list(
options?):Promise<BlockedUserList>
Defined in: src/resources/blocks.ts:84
Lists the users currently blocked for the given phone number id. All
options are optional; limit, after, and before are URL-encoded.
Parameters
Section titled “Parameters”options?
Section titled “options?”Returns
Section titled “Returns”Promise<BlockedUserList>
unblock()
Section titled “unblock()”unblock(
users,phoneNumberId?):Promise<BlockUsersResponse>
Defined in: src/resources/blocks.ts:67
Unblocks one or more WhatsApp users for the given phone number id.
Issues a DELETE carrying the same body shape as BlocksResource.block;
consumers read the result from block_users.removed_users. Pass up to
MAX_BLOCK_USERS phone numbers; the array must be non-empty.
Parameters
Section titled “Parameters”string[]
phoneNumberId?
Section titled “phoneNumberId?”string
Returns
Section titled “Returns”Promise<BlockUsersResponse>
Independent open-source project. Not affiliated with, endorsed by or sponsored by Meta or WhatsApp. Released under the MIT licence. Source on GitHub.