Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WA-Lite API (WhatsApp Web API)

This project provides a REST API for interacting with WhatsApp using the whatsapp-web.js library.

DEMO

The API is used to share links to cyber security related news and incidents through WhatsApp channel at https://whatsapp.com/channel/0029VbBxBJfBA1f0xn4Rwd1g

Features

  • Authentication: QR Code generated in terminal and available via webhook.
  • Messaging: Send text (with automatic link previews), media, and react to messages.
  • Channels: Full support for WhatsApp Channels (Newsletters) - create, subscribe, search, and send messages.
  • Groups: Create groups, add/remove participants.
  • Chat Management: Archive, Pin, Mute, Delete messages.
  • Webhooks: Notifies an external URL of events with X-API-KEY verification.
  • Security: Protected by an API Key (X-API-KEY header).
  • Reliability: Built-in retry mechanism for browser-related transient errors.

Setup

Tested with chromium-browser in Linux for arm64.

  1. Install dependencies:
    npm install
  2. Configure environment variables: Copy .env.example to .env and fill in your values.
    cp .env.example .env
  3. Start the server:
    node index.js

API Endpoints

All requests require the X-API-KEY header. See USER_GUIDE.md for full documentation.

Messages

  • POST /send-message: { "number": "1234567890", "message": "Hello" }
  • POST /send-media: { "number": "1234567890", "url": "...", "caption": "...", "filename": "..." }
  • POST /messages/:chatId/:messageId/react: { "reaction": "👍" }

Channels (Newsletters)

  • GET /channels: List subscribed channels.
  • POST /channels/create: { "title": "...", "description": "..." }
  • POST /channels/:id/send-message: { "message": "..." }
  • POST /channels/:id/send-media: { "url": "...", "caption": "..." }

Groups

  • POST /groups/create: { "title": "My Group", "participants": ["..."] }
  • POST /groups/add-participants: { "groupId": "...", "participants": ["..."] }

Chat Actions

  • POST /chats/:id/archive
  • POST /chats/:id/pin
  • POST /chats/:id/mute: { "durationInSeconds": 3600 }

Utilities

  • GET /chats: List all chats.
  • GET /contacts: List all contacts.
  • GET /info: Get client info and version.
  • POST /check-number/:number: Check if a number is registered on WhatsApp.

Webhooks

If WEBHOOK_URL is configured, the server will send POST requests (including X-API-KEY header) for:

  • qr, ready, message, message_create, status_change, contact_update, disconnected.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages