Files
whatsapp-bridge/test-client.ts
T

28 lines
761 B
TypeScript

import { WhatsAppClient } from "./src/client/whatsapp";
import { getId } from "./ui/src/lib/utils";
const wa = new WhatsAppClient("ws://127.0.0.1:8787");
await wa.connect();
// console.log("status", await wa.status());
// const devices = await wa.listDevices();
// console.log("devices", devices);
// const test = await wa.exec("return window.location;");
// console.log("test", test);
// const groups = await wa.listGroups();
// console.log(groups.map((i) => ({ name: i.subject, id: getId(i.id) })));
const groupId = "[email protected]";
const messages = await wa.getMessages({ chatId: groupId, count: 50 });
console.log(
messages
.filter((i) => i.type === "chat")
.map((i) => ({ body: i.body, fromMe: i.fromMe })),
);
process.exit(0);