Closed smashah closed 3 years ago
@github-actions run
589c03a
ev
out of the MessageCollector
, now required in constructor #1760 adfb326
SocketClient
now extends Client
API #1778 357e85d
createMessageCollector
on SocketClient
#1760 fc4334d
5042043
> npx @open-wa/wa-automate --socket -p 8002 -k api_key
Note: --socket
flag is required!!
import {
Client,
SocketClient,
} from "@open-wa/wa-automate";
const NUMBER = 'TEST_PHONE_NUMBER@c.us'
const start = async () => {
const client = new SocketClient(
"http://localhost:8002",
"api_key"
) as SocketClient & Client;
client.socket.on("connect", async () => {
client.onAnyMessage((message) => {
console.log("onAnyMessage", message.id, message.body);
});
const socketId = client.socket.id;
console.log("π ~ file: client.ts ~ line 144 ~ start ~ socketId", socketId);
console.log(
"Connected!",
await client.sendText(NUMBER, "this is a text")
);
client
.sendAudio(
NUMBER,
"https://file-examples-com.github.io/uploads/2017/11/file_example_MP3_700KB.mp3"
)
.then((audoMessageId) => console.log(audoMessageId));
console.log(
await client.sendFile(
NUMBER,
"https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4",
"test.mp4",
"hellow"
)
);
});
};
start();
Completed in v2.1.0 of the socket client project
I want:
not