REST API for WhatsApp

WUZAPI is an implementation of the whatsmeow library as a simple RESTful API service, with support for multiple devices and concurrent sessions.

Main Features

WUZAPI offers a complete API to interact with WhatsApp efficiently without using heavy resources like Puppeteer or Android emulators.

High Performance

Direct communication with WhatsApp servers via websocket, resulting in lower memory and CPU usage.

Multiple Sessions

Support for multiple devices and users simultaneously on the same instance.

Rich Messages

Send text, images, audio, documents, videos, stickers, location, and contacts.

Webhooks

Configure webhooks to receive real-time notifications of events and messages.

User Verification

Check if phone numbers have WhatsApp and get profile information.

Simple Authentication

Token system for easy and secure user authentication.

API Endpoints

WUZAPI offers several endpoints to interact with WhatsApp, organized into functional categories.

Session

Manage WhatsApp sessions with ease.

  • Connect to WhatsApp
  • Disconnect, Logout
  • Check connection status
  • Get QR Code for scanning
  • Pair by Phone Number
  • Proxy configuration

Chat

Interact with chats and messages.

  • Mark messages as read
  • Delete messages
  • Send reactions to messages
  • Set presence (typing/recording)
  • Download images
  • Download videos
  • Download documents

Messages

Send different types of messages.

  • Text, images, audio
  • Documents, videos, stickers
  • Location, contacts
  • Templates with buttons

Users

Get information about users.

  • Check if numbers have WhatsApp
  • Get profile information
  • Get avatar/profile picture
  • List contacts
  • Set global presence

Groups

Manage WhatsApp groups.

  • List subscribed groups
  • Get group information
  • Get invite link
  • Change group name
  • Change group picture

Webhooks

Configure notifications for events.

  • Set webhook URL
  • Subscribe to specific events
  • Update configuration
  • Remove webhook

Interactive Demo

See how easy it is to use the WUZAPI API to interact with WhatsApp.

W

WUZAPI Assistant

Online

Important Warning

Using this software in violation of WhatsApp's Terms of Service may result in your number being banned. Be very careful, do not use it for SPAM or anything similar. Use at your own risk. If you need to develop something with commercial interest, contact a global WhatsApp solution provider and sign up for the WhatsApp Business API service.

How to Use

Instructions to start using WUZAPI quickly.

Prerequisites

To run WUZAPI, you need:

  • Go (Go Programming Language)
  • Docker (optional, for containerization)
  • Postgres (optional, can work standalone using SQLite)

Compilation

Compile the project with the following command:

go build .

Configuration

WuzAPI uses a .env file for configuration. Here are the required settings:

For PostgresSQL

WUZAPI_ADMIN_TOKEN=your_admin_token_here
USER=wuzapi
PASSWORD=wuzapi
NAME=wuzapi
HOST=localhost
PORT=5432
America/New_York

For SQLite

WUZAPI_ADMIN_TOKEN=your_admin_token_here
TZ=America/New_York

Execution

By default, the service will start on port 8080. You can change the behavior with the following parameters:

  • -address: defines the IP address to bind the server (default 0.0.0.0)
  • -port: defines the port number (default 8080)
  • -logtype: format for logs, console (default) or json
  • -wadebug: enables whatsmeow debug, INFO or DEBUG levels are supported
  • -sslcertificate: SSL Certificate File
  • -sslprivatekey: SSL Private Key File
  • -skipmedia: Do not automatically download media from received messages
  • -osname: Connection OSName in Whatsapp (default "Mac OS 10")
  • -admintoken: Security Token to authorize admin actions (list/create/remove users)
Example:
./wuzapi -logtype json

Creating Users

To open sessions, you first need to create a user and define an authentication token for it. You can do this login into the Dashboard, or using the API directly:

curl -X POST http://localhost:8080/admin/users \
-H "Authorization: $WUZAPI_ADMIN_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name": "John", "token": "Z1234ABCCXD"}'

Once users are created, you can communicate with the API by passing the Token header as a simple authentication method. You can have multiple users (different numbers) on the same server. For every user you will need to Connect to whatsapp and then either scan a QR Code or Pair via phone number.

Web Resources

The daemon also serves some static web files, useful for development/testing that you can load with your browser:

  • A Swagger API reference at /api
  • An example web page to connect and scan QR codes at /login (where you will need to pass ?token=1234ABCD)
  • A management dashboard at /dashboard