@wahooks/channel 0.8.1 → 0.9.0
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.
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -315,9 +315,13 @@ mcp.setRequestHandler(CallToolRequestSchema, async (req) => {
|
|
|
315
315
|
switch (req.params.name) {
|
|
316
316
|
case "wahooks_reply":
|
|
317
317
|
case "wahooks_send": {
|
|
318
|
+
const chatId = toChatId(args.to);
|
|
319
|
+
// Start typing, then send with skipPresence to avoid double seen/typing
|
|
320
|
+
api("POST", `/connections/${connectionId}/typing`, { chatId }).catch(() => { });
|
|
318
321
|
await api("POST", `/connections/${connectionId}/send`, {
|
|
319
|
-
chatId
|
|
322
|
+
chatId,
|
|
320
323
|
text: args.text,
|
|
324
|
+
skipPresence: true,
|
|
321
325
|
});
|
|
322
326
|
return { content: [{ type: "text", text: `Sent to ${args.to}` }] };
|
|
323
327
|
}
|
|
@@ -418,7 +422,11 @@ function connectWebSocket() {
|
|
|
418
422
|
return;
|
|
419
423
|
const chatId = payload.from ?? "";
|
|
420
424
|
const isGroup = chatId.includes("@g.us");
|
|
421
|
-
const sender = payload.participant ?? chatId;
|
|
425
|
+
const sender = payload.participant ?? chatId;
|
|
426
|
+
// Send read receipt immediately
|
|
427
|
+
if (chatId && connectionId) {
|
|
428
|
+
api("POST", `/connections/${connectionId}/mark-read`, { chatId }).catch(() => { });
|
|
429
|
+
}
|
|
422
430
|
const text = payload.body ?? payload.text ?? "";
|
|
423
431
|
const hasMedia = payload.hasMedia === true;
|
|
424
432
|
const media = payload.media;
|