A Node.js server that integrates with WhatsApp Web via whatsapp-web.js
, enabling automated message sending through a REST API. Built with Clean Architecture principles.
- WhatsApp Web integration using
whatsapp-web.js
- REST API endpoint for sending messages
- QR code authentication
- Session persistence with
LocalAuth
- Clean Architecture
- Node.js v18 or higher
- A WhatsApp account
- A smartphone with WhatsApp installed
- Package manager: Bun (recommended)
Note
This project uses Bun for local development and scripting, but is fully compatible with any Node.js-compatible package manager.
Clone the repository:
git clone https://github.com/nicolasdelrosario/whatsapp-n8n-server.git
cd whatsapp-n8n-server
Install dependencies
bun install
Start development mode
bun dev
- On first run, a QR code will appear in the terminal.
- Scan it using WhatsApp on your phone to authenticate.
- Once authenticated, your session will be saved.
Server will run on:
http://localhost:3000
POST /api/v1/send-message
Sends a WhatsApp message to a phone number.
πΈ Request Body (JSON)
{
"number": "51123456789",
"content": "Hello from WhatsApp N8N Server"
}
number:
Phone number in international format (without +)
content:
The message to send
πΈ Response
{
"message": "OK"
}
Developed by Nicolas Del Rosario
MIT