whatsapp-ws is a project built upon the whatsmeow library, providing a WebSocket interface and endpoints to send daily messages to a database and serve as a WhatsApp bridge. It allows users to connect via WebSocket to interact with WhatsApp through programmatically sent commands.
The main objective of whatsapp-ws is to streamline the integration of WhatsApp messaging capabilities into various applications and systems. By utilizing the WebSocket interface, users can establish real-time connections and send commands to interact with WhatsApp in an automated fashion.
The /ws
endpoint provides a WebSocket interface for real-time interaction with the WhatsApp messaging capabilities offered by whatsapp-ws. Users can connect to this endpoint and send commands in the form of JSON objects.
{
"cmd": "string",
"args": ["string"],
"user_id": int
}
cmd
: The command to be executed.args
: An array of string arguments required for the command.user_id
: An integer representing the user ID for context.
The /status
endpoint allows users to check if they are logged in. It returns an HTTP 200 response if the user is logged in and authenticated.
The /qr
endpoint serves the login QR code for WhatsApp. Users can access this endpoint to view the QR code required for logging in to WhatsApp.
The /upload
endpoint enables users to upload files to WhatsApp. It can be used with tools like curl
. Here's an example command to upload a file:
curl -X POST -F file=@filepath -F jid=PHONE_NUMBER@s.whatsapp.net -F user_id=1 http://localhost:6023/upload
To build whatsapp-ws, use the following command:
go build -ldflags '-extldflags "-static"'
/ws
- websocket endpoint/status
- status endpoint/qr
- qr endpoint/upload
- upload endpoint
whatsapp-ws is GPL-3.0 licensed. See LICENSE file for details.