![]() This commit introduces changes to support managing WhatsApp templates using the official WhatsApp Business API. The following modifications have been made: - Implemented a new Template model in the Prisma schema, including fields for template ID, name, language, and associated Instance (business ID, instance ID, and created/updated timestamps). - Modified the Instance model in the Prisma schema to include a Template relationship. - Updated InstanceController to include a new `businessId` property in the InstanceDto. - Added a new TemplateRouter, TemplateController, and TemplateService to handle template-related requests and services. - Updated the WebhookService to utilize the new TemplateService. - Added new TypebotController, WebhookController, and WAMonitoringService methods to handle template-related events. - Updated the validate schema to include a new template schema. The main goal of this commit is to enable managing WhatsApp templates, including creating, updating, and deleting templates, as well as associating them with specific instances. |
||
---|---|---|
.github | ||
.vscode | ||
Docker | ||
Extras | ||
prisma | ||
public/images | ||
src | ||
views | ||
.dockerignore | ||
.DS_Store | ||
.env.example | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.prettierrc.js | ||
CHANGELOG.md | ||
docker-compose.yaml.example | ||
docker-compose.yaml.example.complete | ||
docker-compose.yaml.example.dockerhub | ||
Dockerfile | ||
LICENSE | ||
package.json | ||
README.md | ||
tsconfig.json |
Evolution Api
Evolution API - Whatsapp API Node JS
This project is based on the CodeChat. The original project is an implementation of Baileys, serving as a Restful API service that controls WhatsApp functions.
The code allows the creation of multiservice chats, service bots, or any other system that utilizes WhatsApp. The documentation provides instructions on how to set up and use the project, as well as additional information about its features and configuration options.
The Evolution API has direct integration with Typebot and Chatwoot
Evolution Pro Community
Join our Evolution Pro community for expert support and a weekly call to answer questions. Visit the link below to learn more and subscribe:
Instalation
Installing NVM (Node Version Manager)
NVM allows you to install and manage multiple versions of Node.js. This is particularly useful for maintaining compatibility across different projects.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
Installing Node.js
nvm install v20.10.0 && nvm use v20.10.0
Initializing the Application
Clone the repository:
git clone https://github.com/EvolutionAPI/evolution-api.git
Configure the environment variables in the .env file.
Installing Application Dependencies
cd evolution-api
npm install
npm run build
Env
OBS: Rename the .env.example file to .env
cp .env.example .env
Database Setup
The application supports PostgreSQL, MySQL, MariaDB.
Run one of the commands below for the non-existence of a database.
-
MySQL or MariaDB:
npm run db:migrate:mysql
-
PostgreSQL:
npm run db:migrate:postgres
Deploying
For production environments.
For existing relational databases such as PostgreSQL, MySQL, or MariaDB, the setup involves two essential steps:
-
Setting the Environment Variable: Initially, it's imperative to define the
DATABASE_PROVIDER
environment variable in alignment with your relational database type. Usepostgresql
for PostgreSQL, andmysql
for MySQL or MariaDB. This configuration is crucial as it directs the Prisma ORM regarding the specific relational database in use. -
Deploying Schema Changes: Following this, execute the
npm run db:migrate:postgres
command. This command serves as a shortcut for theprisma deploy
command, whose main role is to examine the current schema of the relational database and implement necessary modifications. A key feature of this command is its ability to update the database schema without affecting the existing data. This ensures that your current data remains intact while the database schema is updated to meet the latest requirements of the application.
Prisma Studio
- View your data
npm run db:studio:mysql # or npm run db:studio:postgres
This will sync your data models to your database, creating tables as needed.
Running the Application
-
Development Mode:
npm run dev:server
-
Production Mode:
npm run build npm run start:prod
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.
PicPay
Buy me coffe - PIX
Content Creator Partners
We are proud to collaborate with the following content creators who have contributed valuable insights and tutorials about Evolution API: