#23579: feat(whatsapp): add sender attribution to inbound message logs
channel: whatsapp-web
size: XS
## Problem
WhatsApp group messages are logged without sender attribution. The log entries include `from` (group JID), `to`, `body`, `mediaPath`, `mediaType`, `mediaFileName`, and `timestamp`, but not who within the group sent the message.
The Baileys message object has `pushName` (display name) and `key.participant` (sender JID) available, but these weren't included in the log output.
## Solution
Added `pushName` and `participant` fields to the inbound message log entry for WhatsApp messages.
**Before:**
```json
{
"type": "inbound message",
"from": "120363418116473253@g.us",
"to": "61450067892:16@s.whatsapp.net",
"body": "message text",
"timestamp": 1740000000
}
```
**After:**
```json
{
"type": "inbound message",
"from": "120363418116473253@g.us",
"to": "61450067892:16@s.whatsapp.net",
"participant": "447922832522@s.whatsapp.net",
"pushName": "Daniel",
"body": "message text",
"timestamp": 1740000000
}
```
## Use Case
External tools (message loggers, analytics) that tail the gateway log need sender attribution to build useful chat histories. Without it, all group messages appear anonymous.
## Testing
- ✅ Build passes (`pnpm build`)
- ✅ Linter passes (`pnpm check`)
- ✅ Unit tests pass (`pnpm test src/web/monitor-inbox.streams-inbound-messages.test.ts`)
- ✅ No breaking changes to existing code
## Notes
- The `WebInboundMessage` type already had `pushName` and `senderJid` fields
- These fields were being populated in the message object passed to handlers
- This PR only adds them to the log output for observability
- Both fields are optional (undefined for direct messages or when unavailable)
Made with [Cursor](https://cursor.com)
<!-- greptile_comment -->
<h3>Greptile Summary</h3>
Added `participant` and `pushName` fields to WhatsApp inbound message log entries for better observability. These fields were already captured in the `WebInboundMessage` object (`senderJid` and `pushName`) and passed to handlers, but weren't included in the structured log output. This change addresses a gap where group message logs lacked sender attribution, making it difficult for external tools consuming the logs to identify who sent messages in group chats.
<h3>Confidence Score: 5/5</h3>
- This PR is safe to merge with minimal risk
- The change only adds two optional fields to the log output without modifying any logic. The fields (`participantJid` and `senderName`) are already defined and used in the same code path to populate the `WebInboundMessage` object. The PR includes passing unit tests and the implementation follows existing patterns in the codebase.
- No files require special attention
<sub>Last reviewed commit: 6ff2a94</sub>
<!-- greptile_other_comments_section -->
<sub>(3/5) Reply to the agent's comments like "Can you suggest a fix for this @greptileai?" or ask follow-up questions!</sub>
<!-- /greptile_comment -->
Most Similar PRs
#23567: fix: add senderE164 and pushName to WhatsApp inbound log line
by svan058 · 2026-02-22
84.0%
#23288: feat(whatsapp): group command gating via commands.allowFrom + sende...
by rodrigoscoelho · 2026-02-22
81.6%
#21953: feat(whatsapp): sender prefix on BodyForAgent + contactNames config
by mactsk · 2026-02-20
79.6%
#16785: fix(whatsapp): preserve document filenames in outbound Baileys mode
by SahilSahu731 · 2026-02-15
78.9%
#7287: feat(whatsapp): expose group admin functions
by balthazar-bot · 2026-02-02
78.6%
#17326: fix(whatsapp): group composing indicator, echo prevention, and pres...
by globalcaos · 2026-02-15
78.6%
#21881: fix(whatsapp): pass user-provided fileName through document send pipe…
by saakshigupta2002 · 2026-02-20
78.1%
#15650: fix(whatsapp): pass fileName to document sends instead of hardcodin...
by whoknowsmann · 2026-02-13
78.0%
#6566: fix: thread fileName through WhatsApp document send path
by giannisanni · 2026-02-01
78.0%
#8224: feat(whatsapp): extract @mentions into dedicated module
by zurizuriaria · 2026-02-03
77.6%