@wahooks/channel 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +7 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -336,12 +336,16 @@ function connectWebSocket() {
336
336
  const event = JSON.parse(data.toString());
337
337
  const eventType = event.event ?? "";
338
338
  const payload = event.payload ?? {};
339
- // Only handle incoming messages
340
- if (!eventType.startsWith("message"))
339
+ // Only handle "message" events (skip "message.any", "message.ack" to avoid duplicates)
340
+ if (eventType !== "message")
341
+ return;
342
+ // Skip outbound messages (sent by us)
343
+ if (payload.fromMe)
341
344
  return;
342
345
  const from = (payload.from ?? "")
343
346
  .replace("@c.us", "")
344
- .replace("@s.whatsapp.net", "");
347
+ .replace("@s.whatsapp.net", "")
348
+ .replace("@lid", "");
345
349
  const text = payload.body ?? payload.text ?? "";
346
350
  const messageId = payload.id?._serialized ?? payload.id ?? `msg_${Date.now()}`;
347
351
  if (!from || !text)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wahooks/channel",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "WhatsApp channel for Claude Code — chat with Claude via WhatsApp",
5
5
  "type": "module",
6
6
  "bin": {