This repo uses Baileys-MD to create a Socket.IO api. This project will store the data in a sqlite database, the data can be retrieved by various Socket.IO "endpoints"
docker run --init \
-e TOKEN=secret_password \
-v $PWD/data:/app/data \
-p 3000:3000 \
netfloex/whatsapp
version: "3"
services:
api:
image: netfloex/whatsapp
container_name: whatsapp-api
volumes:
- ./data:/app/data
environment:
TOKEN: secret_password
ports:
- 3000:3000
Install socket.io-client
yarn add socket.io-client
If you're using typescript I recommend downloading the SocketIO types from here
import { ClientToServer, ServerToClient } from "@typings/SocketIO";
import { io, Socket } from "socket.io-client";
const socket: Socket<ServerToClient, ClientToServer> = io(
"http://localhost:3000",
{
auth: {
token: "secret_password",
},
},
);
socket.emit("chats", async (chats) => {
console.log(chats[0].name);
socket.emit(
"messages.for",
{ chatId: chats[0].id, length: 10 },
(messages) => {
console.log(messages);
},
);
});
socket.on("connect_error", console.error);
Content type
Image
Digest
Size
33.9 MB
Last updated
almost 5 years ago
docker pull netfloex/whatsapp