Block a User
Block a user to prevent them from sending you messages:Unblock a User
Unblock a previously blocked user:Function Signature
TheupdateBlockStatus function is implemented in src/Socket/chats.ts:373-391:
Fetch Blocklist
Retrieve a list of all blocked contacts:Blocklist Implementation
Fromsrc/Socket/chats.ts:359-371:
The function returns an array of JID strings representing all blocked users.
Complete Example
Listen for Block Status Changes
You can track block status changes through events:Implementation Details
Both functions use WhatsApp’sblocklist XML namespace:
- Block/Unblock: Sends an IQ query with
type: 'set'and an item containing the action - Fetch Blocklist: Sends an IQ query with
type: 'get'and parses the returned item nodes
makeChatsSocket in src/Socket/chats.ts:1225-1271.