This commit removes the Template model, including its related functionality, from the project. The template table has been removed from the database schema, and all related functions and methods in the template service have been deleted. This change was made because the project now uses the persistence of the meta, eliminating the need for a separate template model.
Please note that this change may affect other parts of the application that rely on the Template model. Ensure that all necessary adjustments have been made before merging this commit.
The Issue:
The Instance model in the postgresql-schema.prisma file previously had a Template field that was a single Template object, but this caused issues with the association of multiple templates to a single instance.
The Change:
This commit resolves the issue by changing the Template field to an array of Template objects. This allows for multiple templates to be associated with a single instance.
The Impact:
This change allows for more flexible use of templates in the system and resolves a previous limitation in the association of templates to instances.
Affected Files:
- prisma/postgresql-schema.prisma
- src/api/services/template.service.ts
Note: The migration folder added in the untracked files section is a result of the Prisma schema change and can be safely ignored in this commit message.
Correção no serviço WhatsApp Business para retornar a mensagem após o envio.
Além disso, foi adicionada a capacidade de deletar templates por ID.
Arquivos modificados:
- whatsapp.business.service.ts
- template.service.ts
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.
Updated the Instance model to include a new optional string property called businessId. This change affects the following files:
- prisma/postgresql-schema.prisma
- src/api/controllers/instance.controller.ts
- src/api/dto/instance.dto.ts
- src/api/services/monitor.service.ts
- src/validate/instance.schema.ts
A new untracked migration folder has been created to manage database schema updates:
- prisma/migrations/20240712144948_add_business_id_column_to_instances/
This change allows for storing a business identifier alongside the instance, enhancing the ability to categorize and manage instances more effectively.
This commit updates the way messages are sent to the cloud API for lists and buttons,
adjusting the structure of the request payload. The affected files include:
- sendMessage.dto.ts: updates the format of the Button class
- sendMessage.router.ts: adds a new route for sending button messages
- whatsapp.business.service.ts: updates the handling of list and button messages
- message.schema.ts: adds a new schema for button messages
These changes improve the integration with the cloud API and allow for better handling of lists and buttons in messages.
This commit refactors the webhook reception to handle all instances at once. Previously, each instance had its own webhook endpoint, but now there is a single endpoint for all instances. This change simplifies the codebase and reduces the potential for errors.
The main changes include:
- Modifying the `InstanceController` to update the webhook URL for all instances.
- Modifying the `WebhookController` to handle the reception of webhooks for all instances.
- Modifying the `IndexRouter` and `WebhookRouter` to add a new route for the webhook reception endpoint.
- Modifying the `ServerModule` to inject the `PrismaRepository` into the `WebhookService`.
- Modifying the `WebhookService` to handle the reception of webhooks for all instances.
These changes improve the maintainability and scalability of the application, as there is no longer a need to manage individual webhook endpoints for each instance.
Update and modifications in Dockerfile and src/api/services/channels/whatsapp.baileys.service.ts files. These changes improve the performance and maintainability of the Node.js project.
Update the GitHub actions workflow file to improve the CI/CD pipeline. The changes include modifying the existing `publish_docker_image_v2.yml` file. These changes ensure the project's version 2.0.0 remains up-to-date and compatible with the latest GitHub actions and Docker image publishing process.
Update to the GitHub Actions workflow in the v2.0.0 branch. This change modifies the
`.github/workflows/publish_docker_image_v2.yml` file, which is part of the CI/CD
pipeline for publishing Docker images. The specific modifications and their impact
are not detailed in the provided information.
Updated the WhatsApp Baileys service at 'src/api/services/channels/whatsapp.baileys.service.ts' to improve test coverage and reliability. This change does not alter the functionality of the service but enhances its maintainability.
- Update CHANGELOG.md to include the new Docker workflow
- Update Dockerfile to improve the build process
- Add a new GitHub Actions workflow (.github/workflows/publish\_docker\_image\_latest.yml) to publish the latest Docker image on push to the 'v2.0.0' branch
This change allows for easier deployment of the latest version of the application, with an updated Dockerfile and a new GitHub Actions workflow to handle publishing the Docker image.
This commit removes console logs from the Whatsapp Baileys Service in the `whatsapp.baileys.service.ts` file. The logs that were removed were not necessary for the functionality of the service and were only used for debugging purposes. By removing them, we improve the performance and readability of the code.
Modified files:
- src/api/services/channels/whatsapp.baileys.service.ts
Fixes a bug in the generation of the 'rabbit' queue name in the 'channel.service.ts' file. The variable 'transformedWe' was replaced by 'event' to generate the queue name. This ensures that the queue name is generated correctly, avoiding possible errors or malfunctions in the system.
The 'baileys' dependency in the 'package.json' file has been updated to use the 'EvolutionAPI' repository instead of 'WhiskeySockets'. This change ensures that the latest version of 'baileys' is used, which includes improvements in group message sending and cache utilization.
Modified files:
- package.json
Refactored the initialization of `LocalSettings` in `channel.service.ts` to only set the properties that have been explicitly provided. This refactoring improves code consistency and readability. Also, removed the unused `initStoreFolders` method from `repository.service.ts` and its related imports. In addition, updated the import style for `PrismaClient` in `repository.service.ts`.
The modified files are:
- src/api/controllers/instance.controller.ts
- src/api/repository/repository.service.ts
- src/api/services/channel.service.ts
- src/api/services/channels/whatsapp.baileys.service.ts
This commit addresses an adjustment in the process of sending messages to groups, with a focus on improving cache utilization. The main modifications include:
- Updated 'package.json' to use the latest 'baileys' version from 'WhiskeySockets' repository.
- Modified 'src/api/services/channels/whatsapp.baileys.service.ts' for better handling of group metadata cache.
The force update group metadata cache function has been removed to streamline the codebase and improve cache handling. This change will ensure that group metadata is updated more efficiently and reduce the overall processing time.
The performance of sending status updates and messages in groups has been significantly improved. The batch size for sending messages has been reduced from 200 to 1, which allows for more efficient processing.
The `whatsapp.baileys.service.ts` file has been modified to implement this change. The previous batch size was set to 200, which has been updated to 1. This change reduces the number of participants processed in each batch, resulting in improved performance.
This modification also includes a conditional statement to ensure that no further processing is performed when there are no more batches left. This enhancement aims to optimize the overall process of sending status updates and messages in groups.
Refactored WAMonitoringService to retrieve instances using Prisma's `findMany` method with a dynamic `where` clause.
This change simplifies the code and makes it more maintainable.
It also removes the deprecated `for...of` loop and the unnecessary instantiation of objects.
The new implementation provides better performance and is more aligned with the current best practices.
Modified files:
- src/api/services/monitor.service.ts
The updateMessage function was updated to support different message types such as text, image, and video.
A new private function formatUpdateMessage was added to handle the logic of formatting the message based on its type.
The function checks the message type and returns the corresponding format for the message.
If the message type is not supported, it will return null and throw a BadRequestException.
The createJid function is now called in the updateMessage function to get the jid of the recipient.
This change improves the flexibility of the updateMessage function and ensures that it can handle different types of messages.
Corrected an issue where stickers were not being sent properly in WhatsApp channels. The bug was caused by a mistake in the 'src/api/services/channels/whatsapp.baileys.service.ts' file. This fix resolves the problem and ensures that stickers are sent correctly in WhatsApp channels.
Corrects an issue where a ghost emoji was being displayed in message sending. The 'Mentions' class was removed and its properties were moved to the 'Options' class. The 'everyOne' and 'mentioned' properties were replaced by 'mentionsEveryOne' and 'mentioned', respectively. This change improves the code readability and maintainability.
The affected files are:
- src/api/dto/sendMessage.dto.ts
- src/api/services/channels/whatsapp.baileys.service.ts
- src/api/services/channels/whatsapp.business.service.ts
Modified the WhatsApp baileys service to improve the overall functionality. This change aims to enhance the user experience and maintain code quality.
Please note that only the 'src/api/services/channels/whatsapp.baileys.service.ts' file has been modified.
- Updated the group metadata cache to improve performance.
- Added verbose logging for cache updates and requests.
- Affected file: `whatsapp.baileys.service.ts`.
Please note that this change does not alter the functionality or behavior of the application. It is a maintenance task to optimize cache management.
Refactored WhatsappBaileysService to update group metadata cache when a participants update event is triggered. This will improve the accuracy of the group metadata and ensure that it stays up-to-date with the latest changes in the group.
Modified:
- src/api/services/channels/whatsapp.baileys.service.ts
In this commit, we have fixed an issue related to the generation of the pairing code. The changes include modifying the `whatsapp.baileys.service.ts` file, where we have updated the `connectToWhatsapp` method to accept a phone number parameter. Additionally, we have made changes to the `browser` variable to handle phone number and browser options. These changes improve the reliability of the pairing code generation.
In this commit, several changes were made to improve the codebase and update privacy settings. Specifically, the following changes were made:
- The `PrivacySetting` class was refactored to `PrivacySettingDto` in `chat.dto.ts`.
- The `put` method was changed to `post` in `chat.router.ts` for updating the profile picture.
- Several methods in `channel.service.ts` were refactored to improve performance and readability. Specifically, the `setWebhook`, `setRabbitmq`, `setSqs`, `fetchContacts`, and `fetchMessages` methods were improved.
- The `updatePrivacySettings` method in `whatsapp.baileys.service.ts` was refactored to reduce complexity and improve readability.
These changes were made to improve the overall performance and maintainability of the codebase. Additionally, the privacy settings for the WhatsApp client were updated to provide better control over user data.
Updated dependencies in package.json to ensure compatibility and performance. Enhanced functionality in channel.service.ts and whatsapp.baileys.service.ts for better service handling and reliability. This update aims to improve overall system stability and performance.
Modified the WhatsApp Baileys service in channels to fix an issue. This change addresses a bug that was causing incorrect message handling. The update ensures more reliable communication through the WhatsApp API.
Added TypeScript types to functions in use-multi-file-auth-state-prisma.ts to improve type safety and code readability. This change helps catch type-related errors during development and enhances the maintainability of the codebase.
Refactored sendMessage.controller.ts, chat.dto.ts, and sendMessage.dto.ts to improve message handling. Updated chatwoot.service.ts and sendMessage.router.ts for better integration with Chatwoot. Enhanced whatsapp.baileys.service.ts for more reliable WhatsApp communication. Adjusted chat.schema.ts and message.schema.ts for validation improvements. These changes enhance the overall messaging functionality and reliability.
Added a check to prevent group calls by throwing a BadRequestException when a group JID is detected. This change ensures that only individual calls are processed, preventing unsupported group call attempts and improving error handling.
Modified instance.router.ts to change HTTP method from PUT to POST for 'restart' route. Updated whatsapp.baileys.service.ts to correct cache configuration logic, ensuring proper usage of cached group metadata. Removed obsolete Typebot-related schema definitions from instance.schema.ts for cleaner validation. These changes improve API functionality and maintainability.
Updated the Baileys library reference in package.json and refactored imports across multiple files to use the new library. Added a new feature to handle fake calls in sendMessage.controller.ts and related DTOs. This change improves the integration with the Baileys library and introduces the ability to simulate calls, enhancing the testing capabilities. Main files modified: package.json, instance.controller.ts, sendMessage.controller.ts, chat.dto.ts, instance.dto.ts, sendMessage.dto.ts, chatwoot.service.ts, chatwoot-import-helper.ts, sendMessage.router.ts, cache.service.ts, channel.service.ts, whatsapp.baileys.service.ts, whatsapp.business.service.ts, wa.types.ts, rediscache.ts, use-multi-file-auth-state-prisma.ts, use-multi-file-auth-state-provider-files.ts, use-multi-file-auth-state-redis-db.ts, message.schema.ts.
Updated the default values for TOKEN_WEBHOOK, URL, and VERSION in the WA_BUSINESS configuration. This change ensures that the application has more meaningful default settings, improving the initial setup experience. The impact is limited to default behavior when environment variables are not set.
Updated the baileys version in package.json to ensure compatibility with the latest features and bug fixes. This change is necessary to maintain the stability and performance of the application.
Increased retryRequestDelayMs, added maxMsgRetryCount, and updated connectTimeoutMs and qrTimeout values for better performance. Adjusted transactionOpts for more efficient retries. These changes aim to enhance connection stability and message handling efficiency.