Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/open-wa/wa-automate-socket-client-nodejs
🔌 🛠The wa-automate socket client allows you to easily connect to remote EASY API instances. Be sure to 🌟 this repository for updates!
https://github.com/open-wa/wa-automate-socket-client-nodejs
nodejs socket-io whatsapp-api
Last synced: about 1 month ago
JSON representation
🔌 🛠The wa-automate socket client allows you to easily connect to remote EASY API instances. Be sure to 🌟 this repository for updates!
- Host: GitHub
- URL: https://github.com/open-wa/wa-automate-socket-client-nodejs
- Owner: open-wa
- Created: 2021-08-31T01:46:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-05-20T13:31:38.000Z (over 1 year ago)
- Last Synced: 2024-10-26T11:39:18.146Z (about 2 months ago)
- Topics: nodejs, socket-io, whatsapp-api
- Language: TypeScript
- Homepage:
- Size: 145 KB
- Stars: 9
- Watchers: 2
- Forks: 1
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Remote Socket Client
## How to:
1. Run the EASY API
```bash
> npx @open-wa/wa-automate --socket -p 8002 -k api_key
```Note: `--socket` flag is required!!
2. Typescript code:
```javascript
import {
Client,
SocketClient,
} from "@open-wa/wa-automate-socket-client";const NUMBER = '[email protected]'
const start = async () => {
const client = await SocketClient.connect(
"http://localhost:8002",
"api_key"
) as SocketClient & Client;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();
```