Skip to content

BlocksResource

Defined in: src/resources/blocks.ts:30

Block API exposed as client.blocks.

new BlocksResource(request, getDefaultPhoneNumberId): BlocksResource

Defined in: src/resources/blocks.ts:34

RequestFn

PhoneNumberIdAccessor

BlocksResource

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.

string[]

string

Promise<BlockUsersResponse>


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.

ListBlockedUsersOptions

Promise<BlockedUserList>


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.

string[]

string

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.