WAPI Server Development
964
REST API & WebSocket server untuk WhatsApp berbasis whatsapp-web.jsā .
docker run -p 3000:3000 snipkode/wapis:latest
GET /api/qr?api_key=
š¼ļø Tampilkan QR Code untuk scan WhatsApp (HTML response)
GET /api/status?api_key=
{ "whatsappReady": true }
GET /api/chats?type=group&api_key= # atau type=personal
[
{ "id": "[email protected]", "name": "Grup A", "unreadCount": 2 }
]
POST /api/send?api_key=
Content-Type: application/json
{
"to": "628xxx",
"message": "Hai, ini dari bot",
"quotedMessageId": "optional-msg-id"
}
Respon:
{
"status": "sent",
"target": "[email protected]",
"usedQuoted": "ABCD1234",
"id": "msgid12345"
}
const socket = new WebSocket("ws://localhost:3000");
socket.onmessage = (event) => {
const data = JSON.parse(event.data);
if (data.type === 'qr') {
document.querySelector("img").src = data.data; // base64 QR
}
};
socket.send(JSON.stringify({
type: "getCurrentChats",
chatType: "group" // atau "personal"
}));
Response:
{
"type": "currentChats",
"chatType": "group",
"data": [
{ "id": "[email protected]", "name": "Nama Grup" }
]
}
Folder .wwebjs_auth otomatis dibuat di dalam container untuk menyimpan sesi login.
version: '3.8'
services:
wapis:
image: snipkode/wapis:stable-v1.1
container_name: wapis
ports:
- "3000:3000"
volumes:
- ../.wwebjs_auth:/app/.wwebjs_auth:rw
- ../.wwebjs_cache:/app/.wwebjs_cache:rw
environment:
- API_KEY=YWxhbXdpYm93bw==
- ALLOWED_ORIGINS=['localhost:8000']
Content type
Image
Digest
sha256:5c282a4abā¦
Size
480.5 MB
Last updated
about 1 year ago
docker pull snipkode/wapis