← Back to PRs

#13424: feat(whatsapp): add Newsletter/Channel JID support

by agentz-manfred open 2026-02-10 14:04 View on GitHub →
stale size: XS
## Summary Adds support for WhatsApp Newsletter/Channel JIDs (`xxxxx@newsletter`) in the message tool's target validation. Currently, the `normalizeWhatsAppTarget()` function rejects any JID containing `@` that isn't a group JID (`@g.us`) or user JID (`@s.whatsapp.net` / `@lid`), which prevents sending messages to WhatsApp Channels. ## Changes ### `src/whatsapp/normalize.ts` - Added `isWhatsAppNewsletterJid()` helper that matches `\d+@newsletter` format - Newsletter JIDs are now passed through `normalizeWhatsAppTarget()` instead of being rejected ### `src/channels/plugins/outbound/whatsapp.ts` - Newsletter JIDs are treated like group JIDs in outbound routing (bypass `allowFrom` checks, since channels are owned/administered by the sender) ## How it works The underlying Baileys library already supports `sendMessage()` to `@newsletter` JIDs — the `toWhatsappJid()` utility in `src/utils.ts` correctly passes through any JID containing `@`. This PR only removes the validation barrier in the normalize/outbound layer that prevented newsletter targets from reaching the send path. ## Use case WhatsApp Channels (launched 2023) are one-way broadcast channels. Bot accounts that are admins/owners of a channel should be able to post to it via the message tool using the newsletter JID as target (e.g. `120363xxx@newsletter`). Closes #13417 <!-- greptile_comment --> <h2>Greptile Overview</h2> <h3>Greptile Summary</h3> This PR adds WhatsApp Newsletter/Channel JID (`\d+@newsletter`) support by relaxing `normalizeWhatsAppTarget()` validation and allowing outbound routing to bypass `allowFrom` checks for newsletter targets (treated similarly to group JIDs). Key behavior changes: - `src/whatsapp/normalize.ts` introduces `isWhatsAppNewsletterJid()` and returns newsletter JIDs unchanged from `normalizeWhatsAppTarget()`. - `src/channels/plugins/outbound/whatsapp.ts` now treats newsletter JIDs like group JIDs in `resolveTarget()`. Main follow-up needed before merge: other parts of the outbound pipeline (session routing/metadata) still classify newsletter targets as direct chats, which likely causes inconsistent session keys and chatType compared to the adapter’s intended behavior. <h3>Confidence Score: 3/5</h3> - This PR is close but has a routing inconsistency that should be fixed before merge. - Normalization and outbound adapter logic accept newsletter JIDs, but outbound session routing still treats them as direct chats, which can change session keys/metadata and lead to inconsistent behavior across the pipeline. - src/infra/outbound/outbound-session.ts <!-- greptile_other_comments_section --> <sub>(2/5) Greptile learns from your feedback when you react with thumbs up/down!</sub> <!-- /greptile_comment -->

Most Similar PRs