fix: skip empty WhatsApp protocol messages
WhatsApp protocol messages (encryption key distribution, read receipts, ephemeral settings, senderKeyDistributionMessage) have a message envelope but no text content. These were being stored in messages.db and processed by the agent, causing: 1. Agent responds to empty messages, wasting API tokens 2. Container stays alive indefinitely (idle timer resets) 3. Scheduled tasks blocked (queue slot occupied) This fix skips messages with empty content before calling onMessage, preventing protocol messages from being stored and processed. Fixes #250 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -170,6 +170,10 @@ export class WhatsAppChannel implements Channel {
|
|||||||
msg.message?.imageMessage?.caption ||
|
msg.message?.imageMessage?.caption ||
|
||||||
msg.message?.videoMessage?.caption ||
|
msg.message?.videoMessage?.caption ||
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
// Skip protocol messages with no text content (encryption keys, read receipts, etc.)
|
||||||
|
if (!content) continue;
|
||||||
|
|
||||||
const sender = msg.key.participant || msg.key.remoteJid || '';
|
const sender = msg.key.participant || msg.key.remoteJid || '';
|
||||||
const senderName = msg.pushName || sender.split('@')[0];
|
const senderName = msg.pushName || sender.split('@')[0];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user