#17438: feat(whatsapp): add blockFrom support for sender blocklisting
channel: whatsapp-web
size: S
## Summary
Add `blockFrom` array to WhatsApp config that rejects matching senders before any other access control check.
- **Problem:** No way to block specific senders while keeping `dmPolicy: "open"`.
- **Why it matters:** Users running open DM policies (e.g. for lead generation) need to block specific numbers without switching to allowlist mode.
- **What changed:** Added `blockFrom` to WhatsApp schema, types, account resolver, and access control. Blocked senders are rejected at the gateway level with zero token usage.
- **What did NOT change:** No changes to existing `allowFrom`, `dmPolicy`, or `groupPolicy` behavior.
## Change Type
- [x] Feature
## User-visible / Behavior Changes
New optional config field `channels.whatsapp.blockFrom` accepts an array of E.164 phone numbers. Messages from blocked senders are silently rejected before any other access check.
## Backward compatible
Yes - `blockFrom` is optional and defaults to undefined.
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Adds `blockFrom` array to WhatsApp config for rejecting specific senders before any access control checks. The implementation correctly handles both direct messages and group messages by checking the sender's E.164 phone number against a normalized blocklist.
- Types updated consistently across `WhatsAppConfig`, `WhatsAppAccountConfig`, and `ResolvedWhatsAppAccount`
- Schema validation added with optional array of strings
- Account resolution properly cascades from account-level to channel-level config
- Access control logic correctly placed before all other checks (lines 77-91 in access-control.ts)
- Comprehensive test coverage including channel-level, account-level, DM, and group scenarios
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with no identified risks
- The implementation is straightforward, well-tested with 4 test cases covering all scenarios, follows existing code patterns exactly, and the logic is placed correctly in the access control flow. The feature is additive (optional field) with no breaking changes.
- No files require special attention
<sub>Last reviewed commit: 865b5e3</sub>
<!-- greptile_other_comments_section -->
<!-- /greptile_comment -->
Most Similar PRs
#5665: fix: match group JIDs in groupAllowFrom allowlist
by koala73 · 2026-01-31
78.5%
#21889: fix(whatsapp): include outbound DMs in agent context for allowed co...
by mactsk · 2026-02-20
77.8%
#23288: feat(whatsapp): group command gating via commands.allowFrom + sende...
by rodrigoscoelho · 2026-02-22
76.9%
#4390: fix(whatsapp): allow media from allowlisted groups without groupAllow…
by Sarang19114 · 2026-01-30
76.9%
#11611: feat: separate group-level allowlist from sender-level command auth...
by thisnick · 2026-02-08
75.8%
#4402: fix: store group messages from non-allowlisted senders as pending c...
by adam91holt · 2026-01-30
74.8%
#14789: fix: per-account dmPolicy ignored in checkInboundAccessControl
by croll83 · 2026-02-12
74.6%
#21953: feat(whatsapp): sender prefix on BodyForAgent + contactNames config
by mactsk · 2026-02-20
74.6%
#20626: feat(whatsapp): add linkPreviewPolicy for URL exfiltration protection
by arniesaha · 2026-02-19
73.3%
#16942: fix(whatsapp): add typingIndicator config to avoid rate limits
by MisterGuy420 · 2026-02-15
72.5%