RepositoryTypeScriptBRBrazil
code-chat-br

code-chat-br/whatsapp-api

CodeChat - WhatsApp Api

1.3kstars
394forks
0issues
4views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: automotion

#1 Repository of the week

1
TINIX TRENDING·Topic: api-rest

#1 Repository of the week

2
TINIX TRENDING·Topic: whatsapp-api

#2 Repository of the week


Telegram Group Whatsapp Group License Support Support

Project Structure

WhatsApp-Api-NodeJs

This code is an implementation of WhiskeySockets, as a RestFull Api service, which controls whatsapp functions.
With this one you can create multiservice chats, service bots or any other system that uses whatsapp. With this code you don't need to know javascript for nodejs , just start the server and make the language requests that you feel most comfortable with.

Infrastructure

1. Docker installation

  • First, let's install Docker. Docker is a platform that allows us to quickly create, test and deploy applications in isolated environments called containers.
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh
sudo usermod -aG docker ${USER}

2. Installing the database

PostgreSql [required]

  • Now, we have configured our PostgreSQL database using Docker Compose.
  • Access your postgre manager and create a database.

compose from postgres

3. Nvm installation

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
# or
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

After finishing, restart the terminal to load the new information.

3.1 Nodejs installation

  • Installing Node.js using NVM, a version manager that allows us to switch between different versions of Node.js easily.
nvm install 20

4. pm2 installation

npm i -g pm2

5. Application startup

Cloning the Repository

git clone https://github.com/code-chat-br/whatsapp-api.git

Go to the project directory and install all dependencies.

Give preference to npm as it has greater compatibility.

cd whatsapp-api-v2

npm install
# or
npm install --force

6. Environment variables

See additional settings that can be applied through the env file by clicking here.

⚠️Attention⚠️: copy the .env.dev file to .env.

cp .env.dev .env

7. Prism ORM

  • We're going to use Prisma ORM to manage our database. Prisma simplifies database access and ensures operations are secure and easy to maintain.
  • Commands and Explanations:
    • In development environment: npx prisma migrate dev
      • We use migrate dev in development to automatically create and apply migrations, making working with the database easier.
    • In production environment: npx prisma migrate deploy
      • In production, we use migrate deploy to apply migrations in a controlled and secure way.
    • Data visualization: npx prisma studio
      • Prisma Studio is a visual tool that helps us manage and visualize bank data in an intuitive way.

Define the DATABASE_URL environment variable for the database deployment.

bash deploy_db.sh

Finally, run the command below to start the application:

npm run start:dev

npm run start:prod

# pm2
pm2 start 'npm run start:prod' --name CodeChat_API_v1.3.0

Worker

Worker options for session management

To use the worker with the API it is necessary to define the following environment variables in the API:

  • PROVIDER_ENABLED=true: This variable enables the use of the provider (worker) in the API.
  • PROVIDER_HOST=127.0.0.1: Defines the host where the worker is listening for requests.
  • PROVIDER_PORT=5656: Defines the port where the worker is listening for requests.
  • PROVIDER_PREFIX=codechat: Set prefix for instance grouping on worker

WebSocket

websocket compatibility added. Read here.

Swagger - OpenAPI 3.0.0

Authentication

You can define two authentication types for the routes in the env file. Authentications must be inserted in the request header.

  1. jwt: A JWT is a standard for authentication and information exchange defined with a signature.

Authentications are generated at instance creation time.

Note: There is also the possibility to define a global api key, which can access and control all instances.

App in Docker

After building the application, in the same directory as the files above, run the following command:

docker-compose up

Send Messages

Send Text✔
Send Buttons❌
Send Media: audio - video - image - document - gif

base64: false
✔
Send Media File✔
Send Audio type WhatsApp✔
Send Audio type WhatsApp - File✔
Send Location✔
Send List❌
Send Link Preview✔
Send Contact✔
Send Reaction - emoji✔

Postman collections

  • Run in Postman

Webhook Events

NameEventTypeDataDescription
QRCODE_UPDATEDqrcode.updatedJSONSends the base64 of the QR code for reading
CONNECTION_UPDATEconnection.updateJSONInforms the status of the connection with WhatsApp
MESSAGES_SETmessages.setJSONSends a list of all your messages uploaded on WhatsApp
This event occurs only once
MESSAGES_UPSERTmessages.upsertJSONNotifies you when a message is received
MESSAGES_UPDATEmessages.updateJSONTells you when a message is updated
SEND_MESSAGEsend.messageJSONNotifies when a message is sent
CONTACTS_SETcontacts.setJSONPerforms initial loading of all contacts
This event occurs only once
CONTACTS_UPSERTcontacts.upsertJSONReloads all contacts with additional information
This event occurs only once
CONTACTS_UPDATEcontacts.updateJSONInforms you when a contact is updated
PRESENCE_UPDATEpresence.updateJSONInforms if the user is online, typing, recording, or last seen
unavailable available composing recording paused
CHATS_SETchats.setJSONSends a list of all loaded chats
CHATS_UPDATEchats.updateJSONInforms you when the chat is updated
CHATS_UPSERTchats.upsertJSONSends any new chat information
CHATS_DELETEchats.deleteJSONInforms when a chat is deleted
GROUPS_UPSERTgroups.upsertJSONNotifies when a group is created
GROUPS_UPDATEgroups.updateJSONNotifies when a group has its information updated
GROUP_PARTICIPANTS_UPDATEgroup-participants.updateJSONNotifies when an action occurs involving a participant
add remove promote demote
REFRESH_TOKENrefresh.tokenJSONNotifies when the JWT token is updated
CALL_UPSERTcall.upsertJSONNotifies when there is a new call event
LABELS_ASSOCIATIONlabels.associationJSONAssociates labels to chats or contacts
LABELS_EDITlabels.editJSONNotifies when a label is edited

SSL

To install the SSL certificate, follow the instructions below.

Note

This code is in no way affiliated with WhatsApp. Use at your own discretion. Don't spam this.

This code was produced based on the baileys library and it is still under development.

Donate to the project.

Pix: 2b526ada-4ef4-4db4-bbeb-f60da2421fce

PicPay


Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
rmyndharis/OpenWA

Free, Open Source, Self-Hosted WhatsApp API Gateway

17.5k
Nov 29, 2026
RepositoryJavaScript
wwebjs/whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app

23.0k
Nov 29, 2026
RepositoryJavaScript
wwebjs/whatsapp-web.js

A WhatsApp client library for NodeJS that connects through the WhatsApp Web browser app

23.0k
Nov 29, 2026
RepositoryTypeScript
devlikeapro/waha

WAHA - WhatsApp HTTP API (REST API) that you can configure in a click! Multiple engines: WEBJS (browser based), NOWEB (websocket nodejs), GOWS (websocket go), WPP (browser)

8.0k
Nov 26, 2026
RepositoryTypeScript
venomapi/venom

Venom is a high-performance system developed with JavaScript to create a bot for WhatsApp, support for creating any interaction, such as customer service, media sending, sentence recognition based on artificial intelligence and all types of design architecture for WhatsApp.

6.6k
Sep 9, 2026
RepositoryTypeScript
wppconnect-team/wppconnect

WhatsApp Web automation library for Node.js and TypeScript. Manage sessions, send and receive messages, handle media and build bots with Puppeteer. Part of the WPPConnect ecosystem.

3.6k
Dec 1, 2026
RepositoryGo
shridarpatil/whatomate

Whatomate is an open-source WhatsApp integration

1.8k
Dec 1, 2026
RepositoryPython
danielcardeenas/whatsapp-framework

⚗️Whatsapp python api

1.2k
Apr 10, 2020
RepositoryTypeScript
hoppscotch/hoppscotch

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

81.0k
Nov 27, 2026