Commit Graph

404 Commits

Author SHA1 Message Date
Davidson Gomes
5d6a34ad3f fix: websocket emit 2024-08-23 16:57:44 -03:00
Davidson Gomes
1b9fec6c27 fix: s3 saving media sent from me 2024-08-23 15:48:34 -03:00
Davidson Gomes
e809f38865 fix: fixed send messages in groups 2024-08-23 15:36:59 -03:00
Davidson Gomes
0fca8c0746 fix: set events 2024-08-23 14:56:33 -03:00
Davidson Gomes
d7b3230db9 break change: fix breakchange events in manager 2024-08-23 14:30:48 -03:00
Davidson Gomes
fcdee75f39 fix: set webhook 2024-08-23 14:24:32 -03:00
Davidson Gomes
1f0a5a2e09 fix: fixed proxy config in manager 2024-08-23 14:05:48 -03:00
Davidson Gomes
6a62ae85fc refactor: integration folders and fix manager bugs 2024-08-23 13:46:51 -03:00
Davidson Gomes
beafc62403 refactor: integration folders 2024-08-23 13:20:18 -03:00
Stênio Aníbal
9418faff30 Merge branch 'ev2' into v2.0.0 2024-08-23 11:41:28 -03:00
Stênio Aníbal
99161de094 Fix intrinsic type issues on chatbot controllers 2024-08-23 11:41:14 -03:00
Davidson Gomes
c3c1ffe7e5 fix: manager translate 2024-08-23 11:10:55 -03:00
Stênio Aníbal
03c32de743 Merge branch 'ev2' into v2.0.0 2024-08-23 10:56:17 -03:00
Stênio Aníbal
05ee65f422 Simplify events structure and fix minor issues 2024-08-23 10:53:31 -03:00
Davidson Gomes
6328c64192 fix: messageType null 2024-08-23 08:35:00 -03:00
Davidson Gomes
a83a358620 refactor: channel integration folders 2024-08-23 07:55:26 -03:00
Davidson Gomes
fff11ea452 fix: update baileys version 2024-08-22 23:08:42 -03:00
Davidson Gomes
0e9cd21981 feat: evolution channel in instance create 2024-08-22 19:49:51 -03:00
Davidson Gomes
2196f65b7a fix: dify agent integration 2024-08-22 18:15:30 -03:00
Davidson Gomes
0e6a78d011 feat: flowise integration 2024-08-21 17:21:23 -03:00
Davidson Gomes
61523c0a79 feat: generic chatbot 2024-08-21 16:37:24 -03:00
Stênio Aníbal
beb7942d7c Merge branch 'ev2' into v2.0.0 2024-08-21 15:02:52 -03:00
Stênio Aníbal
cca063dfed Fix not found event message for the event services 2024-08-21 15:02:40 -03:00
Davidson Gomes
16bc363d5f refactor: openai services 2024-08-21 14:58:48 -03:00
Stênio Aníbal
4aac2da253 Merge branch 'ev2' into v2.0.0 2024-08-21 14:56:55 -03:00
Stênio Aníbal
0aeecde847 Add BOT_CONTACT env option to Chatwoot 2024-08-21 14:56:41 -03:00
Stênio Aníbal
912df56c55 Remove event emit from channel service preventing exceptions 2024-08-21 14:56:12 -03:00
Stênio Aníbal
6585e8f0c2 Fix events structure to prevent "Instance not found" exception 2024-08-21 14:55:18 -03:00
Davidson Gomes
1bf76ecb94 refactor: dify services 2024-08-21 14:48:59 -03:00
Davidson Gomes
35bde8498b feat: generic chatbot 2024-08-21 14:42:26 -03:00
Davidson Gomes
73d65b0eb6
Merge branch 'v2.0.0' into v2-webhook-fix 2024-08-21 14:01:09 -03:00
Davidson Gomes
e7d971867b refactor: chatbot integration 2024-08-21 13:52:09 -03:00
Davidson Gomes
9209c9992d refactor: event integration 2024-08-21 13:47:41 -03:00
Davidson Gomes
edeb1efd2a refactor: chatbot integration 2024-08-21 13:37:22 -03:00
Judson Cairo
dcef6919cb Fix webhook validation 2024-08-21 11:04:18 -03:00
Davidson Gomes
8876797172 refactor: openai integration 2024-08-21 09:29:49 -03:00
Davidson Gomes
b58ad83c12
Merge pull request #800 from dev-luizf/fix/manage-webhook
Fix webhook creation
2024-08-21 07:23:04 -03:00
dev-luizf
68f57aa507 fix: fix webhook integration 2024-08-20 18:48:17 -03:00
Davidson Gomes
583ce33868 refactor: channel controller 2024-08-20 18:47:24 -03:00
Davidson Gomes
3b39f13180 refactor: adjusts in module init 2024-08-20 18:41:12 -03:00
Davidson Gomes
2ec0b842c1 refactor: integrations folder 2024-08-20 16:22:02 -03:00
Davidson Gomes
884362e70c refactor: channel folder 2024-08-20 15:49:32 -03:00
Davidson Gomes
df77aadd04 refactor: event folder 2024-08-20 15:36:55 -03:00
Davidson Gomes
7b79591e42 refactor: event folder 2024-08-20 15:27:32 -03:00
Davidson Gomes
64ed0faa83 refactor: integrations router folder structure 2024-08-20 13:13:49 -03:00
Davidson Gomes
d68d42b984 refactor: integrations folder structure 2024-08-20 12:27:04 -03:00
Stênio Aníbal
ec9e227413 Merge branch 'ev2' into v2.0.0 2024-08-20 11:26:34 -03:00
Stênio Aníbal
82634c0cb2 Merge websocket new events to the defaults 2024-08-20 11:26:05 -03:00
Davidson Gomes
8b5b4994f2
Merge pull request #789 from stenioanibal/v2.0.0
V2.0.0 - Refactor websocket structure
2024-08-20 11:19:36 -03:00
Davidson Gomes
ff52be5ac5 chore: adjusts in env for manager 2024-08-20 08:56:30 -03:00
Davidson Gomes
046c64c65d feat: translation in manager: English, Portuguese, Spanish and French 2024-08-20 07:29:14 -03:00
Davidson Gomes
9ae5255d5f fix: send pushName for openai assistant 2024-08-19 11:25:42 -03:00
Davidson Gomes
87a5663da7
Merge pull request #790 from judsonjuniorr/v2-advanced-operators-triggers
Advanced operators trigger for OpenAI/Dify/Typebot
2024-08-19 11:14:08 -03:00
Matheus Almeida
0cfd143db0 feat: adicionada capacidade de OpenAI para interpretar o contexto de contatos de maneira mais precisa 2024-08-17 23:03:55 -03:00
Judson Cairo
fcd038924d Advanced operators trigger fro OpenAI/Dify/Typebot 2024-08-17 08:32:05 -03:00
Stênio Aníbal
cb36f04534 Remove unused import and bad additional websocket event 2024-08-16 18:31:02 -03:00
Stênio Aníbal
fbff945d5b Merge branch 'ev2' into v2.0.0 2024-08-16 17:46:14 -03:00
Stênio Aníbal
dc04eb16fc Refactor websocket structure 2024-08-16 17:45:09 -03:00
Davidson Gomes
a77fa414e5 changelog 2024-08-16 17:07:34 -03:00
Davidson Gomes
b921a4d324 feat: IA send images and Sentry implemented 2024-08-16 11:31:46 -03:00
Davidson Gomes
3ef80bd6c5 feat: openai send images 2024-08-16 07:23:34 -03:00
Davidson Gomes
fb93c890ca feat: dify send images 2024-08-15 20:24:57 -03:00
Davidson Gomes
19f0296718 fix: chatwoot translations and s3 region 2024-08-15 15:41:30 -03:00
Davidson Gomes
38ec114fff
Merge pull request #779 from fabioselau077/bugfix/s3_upload_files
[v2] - Região no S3 e fix do size no uploadFile
2024-08-15 15:34:34 -03:00
Davidson Gomes
785a72cbc8 feat: openai now identifies images 2024-08-15 12:29:08 -03:00
Fabio
b475d1d5ea set region from env and fix size in uploadFile 2024-08-15 11:26:30 -04:00
Stênio Aníbal
000d8fd436 Merge branch 'ev2' into v2.0.0 2024-08-15 11:49:42 -03:00
Davidson Gomes
061696e140 feat: dify now identifies images 2024-08-15 11:12:07 -03:00
Stênio Aníbal
16b910f955 Merge branch 'ev2' into v2.0.0 2024-08-15 10:12:44 -03:00
Judson Cairo
1059c92583 Unification of integrations, Typebot & OpenAI & Dify 2024-08-14 17:47:31 -03:00
Stênio Aníbal
2772c2f31f Merge branch 'ev2' into v2.0.0 2024-08-14 17:02:40 -03:00
Davidson Gomes
360f8066a7 fix: crypto.randumUUID is not a function on Manager 2024-08-14 16:01:14 -03:00
Davidson Gomes
b3991cf6bb feat: Added ignoreJids in chatwoot settings 2024-08-14 14:59:47 -03:00
Davidson Gomes
1d31f533f4 Merge branch 'v2.0.0' of github.com:EvolutionAPI/evolution-api into v2.0.0 2024-08-14 11:28:33 -03:00
Davidson Gomes
881a011493 chore: Deprecate buttons and list in new Baileys version
Updated CHANGELOG.md, package.json, src/api/dto/chat.dto.ts, and src/api/services/channels/whatsapp.baileys.service.ts to deprecate buttons and list due to the new Baileys version. This change improves compatibility and maintainability of the codebase.
2024-08-14 11:27:54 -03:00
Stênio Aníbal
707ac9db2c Fix cors settings for websocket when it's set for any origin 2024-08-14 10:36:48 -03:00
Davidson Gomes
78da13fcab
Merge pull request #759 from judsonjuniorr/V2-duplicated-label-creation
Changed labels to be unique on the same instance
2024-08-13 15:56:24 -03:00
Judson Cairo
f0a6fb111e Removed console.log 2024-08-13 10:23:39 -03:00
Judson Cairo
48febec36a Changed labels to be unique on the same instance 2024-08-12 21:35:31 -03:00
Judson Cairo
041b3c5e1f Remove instance from redis even if using database 2024-08-12 21:03:51 -03:00
Davidson Gomes
dbb6ea9147 fix: adjusts 2.0.9 2024-08-12 13:24:19 -03:00
Davidson Gomes
6800b63945
Merge pull request #750 from judsonjuniorr/v2-path-mappings
V2 Path mapping & deps fix & bundler changed to tsup
2024-08-12 09:43:08 -03:00
Davidson Gomes
404edaa4e1
Merge pull request #747 from judsonjuniorr/v2-update-contacts-database
V2 update contacts database
2024-08-12 09:41:18 -03:00
Judson Cairo
32e58debc6 Path mapping & deps fix & bundler changed to tsup 2024-08-11 20:47:17 -03:00
Judson Cairo
7b1e4e9e3d Add chat name to fetch chats request 2024-08-11 15:49:43 -03:00
Judson Cairo
54e47c09c4 Fixed contacts update in the database 2024-08-10 23:43:53 -03:00
Judson Cairo
d31b2c7f97 Remove unnecessary logs 2024-08-10 23:16:14 -03:00
Judson Cairo
926197b1ba Save chat names for groups identification 2024-08-10 23:15:20 -03:00
Judson Cairo
668f477218 Validate if session exists before deleting it 2024-08-10 23:15:02 -03:00
Davidson Gomes
0f299993d9 chore: adjusts in docker files 2024-08-09 12:41:16 -03:00
Davidson Gomes
e7ff09752e fix: StopBotFromMe working with chatwoot 2024-08-09 09:55:50 -03:00
Davidson Gomes
9367be0fb1 chore: adjusting details 2024-08-09 06:53:43 -03:00
Davidson Gomes
56a165db54 feat: added general session button in typebot, dify and openai in manager 2024-08-08 23:14:51 -03:00
Davidson Gomes
9329330297
Merge pull request #744 from rcesar/v2.0.0
Fix conversationId when is dify agent
2024-08-08 22:16:34 -03:00
Davidson Gomes
4d9f6ef416 fix: import contacts with image in chatwoot 2024-08-08 22:09:23 -03:00
Davidson Gomes
6f2971cf24 feat: function for openai assistant added 2024-08-08 19:35:32 -03:00
Davidson Gomes
df3092b876 changelog 2024-08-08 19:24:51 -03:00
Davidson Gomes
26a974a239 feat: function for openai assistant added 2024-08-08 18:47:52 -03:00
Davidson Gomes
e7ca3cf254 Merge branch 'v2.0.0' of github.com:EvolutionAPI/evolution-api into v2.0.0 2024-08-08 17:51:27 -03:00
Davidson Gomes
59edf4ffb7 feat: Variables passed to the input in dify 2024-08-08 17:51:12 -03:00
Renan Cesar
0e4034ffac Fix conversationId when is dify agent 2024-08-08 16:28:40 -03:00
Felipe Medeiros
1c3bea4225 feat: add disconnection information to BaileysStartupService and Instance model
- Updated BaileysStartupService to include disconnection handling logic.
- Enhanced Instance model to store disconnection status and details.
2024-08-06 10:38:53 -03:00
Felipe Medeiros
258f56759c refactor: update reconnection logic to prevent reconnection in cases of banishment or blocking
Handled specific errors to improve reconnection logic:
- 401: Triggered logout to handle unauthorized access.
- 402: Recognized as temporary ban, reconnection attempts paused.
- 403: Recognized as forbidden, reconnection attempts stopped.
- 406: Recognized as permanent ban, reconnection attempts halted.
2024-08-06 01:48:42 -03:00
Davidson Gomes
de8e4a0ca3 fix(dify agent integration): Updated dify agent integration to use streaming response mode and handle message data in chunks. Modified CHANGELOG.md and src/api/integrations/dify/services/dify.service.ts.
This commit addresses an issue with the dify agent integration by updating it to use a streaming response mode. This allows for handling message data in smaller chunks, improving performance and reducing memory usage. The commit also includes updates to the CHANGELOG.md file and the dify.service.ts file, where the actual changes were implemented.
2024-08-03 14:04:39 -03:00
Davidson Gomes
2aa0e08ae4 fix: Added description column on typebot, dify and openai 2024-08-03 13:51:24 -03:00
Davidson Gomes
9c5eb4bfd1 fix: Session is now individual per instance and remoteJid
Changes made:
- Added `instanceId` to sessions in DifyService, OpenaiService, and TypebotService to ensure that sessions are individual per instance and remoteJid.
- Decreased delay time in BaileysStartupService from 2000ms to 1000ms.

The bug fix ensures that sessions are unique per instance and remoteJid, which improves the overall functionality of the application. The delay time reduction in BaileysStartupService speeds up the pairing code request process.

The modified files are DifyService, OpenaiService, TypebotService, and BaileysStartupService.
2024-08-03 13:36:31 -03:00
Davidson Gomes
819ef70b7b fix: Resolve issue with connecting to instance
Corrected an issue with connecting to the instance by updating the connection status in the Whatsapp Baileys service.

Modified files:
- Whatsapp Baileys service (src/api/services/channels/whatsapp.baileys.service.ts)
2024-08-03 13:20:22 -03:00
Davidson Gomes
9f2801d289 Fix: Resolved issue with connecting to instance
Modified: index.router.ts, whatsapp.baileys.service.ts

Fixed an issue with connecting to the instance by modifying the code in index.router.ts and whatsapp.baileys.service.ts. This change resolves a critical problem that was preventing the application from connecting to the necessary instance.
2024-08-03 13:17:02 -03:00
Davidson Gomes
c6db03ffa2 fix: Adjusts in restart instance 2024-08-03 12:54:23 -03:00
Davidson Gomes
7ad96f54ca fix: update typebot, openai and dify 2024-08-02 19:42:54 -03:00
Davidson Gomes
671b677569 fix: fetchInstances with clientName parameter 2024-08-02 19:22:44 -03:00
Davidson Gomes
3fa6b1fcc5 fix: get models openai 2024-08-02 10:49:06 -03:00
Davidson Gomes
67409e1bf5 Add speech-to-text functionality using OpenAI
This commit introduces a new feature that transcribes audio messages to text using OpenAI's Whisper model. The following files were modified to implement this feature:

- `CHANGELOG.md`: Added a new entry under the 'Features' section to document the speech-to-text functionality.
- `prisma/postgresql-schema.prisma`: Added a new boolean field `speechToText` to the `OpenaiSetting` model.
- `src/api/integrations/openai/dto/openai.dto.ts`: Added a new optional boolean property `speechToText` to the `OpenaiSettingDto` class.
- `src/api/integrations/openai/services/openai.service.ts`: Implemented the `speechToText` method to handle the transcription process.
- `src/api/integrations/openai/validate/openai.schema.ts`: Added a new required boolean schema for the `speechToText` property in the `openaiSettingSchema`.
- `src/api/integrations/typebot/services/typebot.service.ts`: Updated the `audioMessage` property to consider the new `speechToText` field.
- `src/api/services/channels/whatsapp.baileys.service.ts` and `src/api/services/channels/whatsapp.business.service.ts`: Added logic to handle the transcription of audio messages when the `speechToText` setting is enabled.

The purpose of this change is to provide a more accessible way for users to interact with audio messages by converting them to text. This improvement will be particularly useful for users with hearing impairments or those in noisy environments.
2024-08-01 17:15:20 -03:00
Davidson Gomes
a49c63bc2b chore: Update CHANGELOG and API routes
Updated CHANGELOG.md with details of the current release.
Modified src/api/routes/index.router.ts to improve the API routing.

These changes are part of the ongoing maintenance and improvement of the project.
2024-07-30 18:38:13 -03:00
Davidson Gomes
8118c68dce v2.0.4-rc 2024-07-30 17:07:45 -03:00
Davidson Gomes
bb65b566e5 chore: Update dify and openai services
Modified the implementation of Dify and OpenAI services to improve overall functionality. These changes aim to enhance the stability and performance of the integration layer, although no new features have been added.

Changes affected the following files:
- dify.service.ts
- openai.service.ts
2024-07-30 15:38:27 -03:00
Davidson Gomes
881c1c2aa6 v2.0.4-rc 2024-07-30 14:52:19 -03:00
Davidson Gomes
a5d72a0dfd feat: Integration with Dify
Adds support for Dify integration, including new routes, services, and controllers. The configuration for Dify has been added to the environment file, and the necessary changes have been made to the `.env.example` file. Additionally, the WhatsApp Baileys service has been updated to handle Dify notifications.

Modified files:
- `.env.example`
- `package.json`
- `src/api/integrations/openai/services/openai.service.ts`
- `src/api/routes/index.router.ts`
- `src/api/server.module.ts`
- `src/api/services/channel.service.ts`
- `src/api/services/channels/whatsapp.baileys.service.ts`
- `src/config/env.config.ts`
- `src/validate/validate.schema.ts`

Introduced files:
- `src/api/integrations/dify/`
- `src/api/integrations/dify/controllers/dify.controller.ts`
- `src/api/integrations/dify/dto/dify.dto.ts`
- `src/api/integrations/dify/routes/dify.router.ts`
- `src/api/integrations/dify/services/dify.service.ts`
- `src/api/integrations/dify/validate/dify.schema.ts`
2024-07-30 13:34:35 -03:00
Davidson Gomes
66814b403e chore: Update monitor service and instance controller
Refactored the instance controller and monitor service to improve the connection handling and management of WhatsApp instances.

- Modified the instance controller to close the WebSocket connection and restart the instance instead of reloading it.
- Updated the monitor service to remove the instance from the `waInstances` object and emit an event to clean up and remove the instance data.
- Fixed an issue where the instance was not being removed from the `waInstances` object.

Files affected:
- CHANGELOG.md
- src/api/controllers/instance.controller.ts
- src/api/services/monitor.service.ts
2024-07-30 11:15:21 -03:00
Davidson Gomes
95bc5e6b21 chore: Updated dependencies and added new manager
In this commit, the following changes were made:

- Updated the version of the project to 2.0.4-beta.
- Added the new manager with version 2.0.0.
- Updated the Baileys version.
- Modified several files such as CHANGELOG.md, Dockerfile, package.json, src/api/routes/index.router.ts, and src/api/routes/view.router.ts.
- Deleted the views/manager.hbs file and added the manager/ folder.

These changes update the dependencies and include a new manager, which may impact the application's functionality.
2024-07-30 09:17:49 -03:00
Davidson Gomes
5047e6281a fix: Correct openai session deletion and pause functionality
This commit fixes an issue where openai sessions were not being properly deleted or paused. It updates the `openai.service.ts` and `openai.schema.ts` files to correctly handle session deletion and pausing.

The `openai.service.ts` file now includes additional checks for session status before deleting or updating. The `openai.schema.ts` file has been updated to include a new 'delete' status option.

These changes ensure that openai sessions are properly managed and that the bot can be paused and resumed as intended. This improves the overall functionality and user experience of the application.
2024-07-29 19:07:26 -03:00
Davidson Gomes
7ba1f2fdf4 fix: Correct pause and listen to my messages from Typebot integration
This commit fixes an issue where the bot was not pausing and listening to my messages from the Typebot integration. The changes include modifying the Typebot service, Typebot schema, and WhatsApp Baileys and Business services to properly handle the pause and message listening functionality. The affected files are typebot.service.ts, typebot.schema.ts, and both WhatsApp services.

The specific modifications include adding a new 'delete' status option in the Typebot schema, updating the Typebot service to handle the 'delete' status, and adjusting the WhatsApp services to properly send Typebot messages based on the new schema. This ensures that the bot can pause and listen to messages from Typebot integration, providing a better user experience.
2024-07-29 17:53:18 -03:00
Davidson Gomes
7bfb4f93bb Fix: Corrected openai trigger validation
Corrected an issue in the validation of openai triggers by changing the 'findFirst' method to 'findMany' and implementing a loop to find the correct trigger match. This change improves the accuracy of trigger validation and ensures that all possible matches are considered.

Impact: This fix ensures that the correct trigger is identified, improving the overall functionality of the openai integration.

Affected files:
- openai.service.ts
2024-07-29 17:29:55 -03:00
Davidson Gomes
c03e0cc954 fix: corrected typebot trigger validation
Explanation:
This commit fixes an issue in the validation of typebot triggers. The 'findFirst' method was used to search for triggers, but it only returns the first match found. To solve this problem, the 'findMany' method was used instead, and a loop was added to search for all matches. This change ensures that all triggers that match the validation criteria are returned.

The modified file is:
- typebot.service.ts: this is the main file where the changes were made. It was necessary to modify the function that validates the triggers, replacing the 'findFirst' method with the 'findMany' method and adding a loop to search for all matches.

This change improves the validation of typebot triggers, ensuring that all matches are returned, and prevents errors in the trigger validation process.
2024-07-29 17:29:18 -03:00
Davidson Gomes
2a7f9698d2 fix: adjusts for new manager 2024-07-29 15:09:40 -03:00
Davidson Gomes
c3bb632a1a fix: Fixed Typebot start call with active session by updating instanceId references in TypebotService
In this commit, I fixed an issue with the start call of Typebot when there is an active session. I noticed that there were inconsistencies in the way the instanceId was being referenced in the TypebotService.

To resolve this, I modified the TypebotService to update the instanceId references to the correct format. Specifically, I changed the following files:
- CHANGELOG.md: added a note about the fix for the Typebot start call with active session
- src/api/integrations/typebot/services/typebot.service.ts: updated the instanceId references in the startTypebot, createNewSession, and other related methods.

This change ensures that the Typebot start call with active session works as intended, improving the overall functionality of the Typebot integration.
2024-07-29 09:02:51 -03:00
Davidson Gomes
d00e3677f5 chore: adjust TriggerType for OpenAI and Typebot integrations
Modifies the TriggerType enum to include a 'none' option and updates the OpenAI and Typebot services to handle this new option. Additionally, the services now require a trigger operator and value when the trigger type is set to 'keyword'.

Modified files:
- prisma/postgresql-schema.prisma
- src/api/integrations/openai/services/openai.service.ts
- src/api/integrations/typebot/services/typebot.service.ts

Untracked file:
- prisma/migrations/20240729115127_modify_trigger_type_openai_typebot_table/
2024-07-29 08:53:15 -03:00
Davidson Gomes
f95d34a1da chore: Update WhatsApp Business service to stop processing read messages from non-broadcast and non-me jids
Modifies the WhatsApp Business service to skip processing read messages from non-broadcast and non-me jids, improving performance and reducing unnecessary computations. Affects src/api/services/channels/whatsapp.business.service.ts.
2024-07-28 19:54:45 -03:00
Davidson Gomes
0bb2b92853 feat: Sending template approval status webhook 2024-07-25 19:38:34 -03:00
Davidson Gomes
4746d3991e chore: Add webhookUrl to Message model, DTOs, and services
Adds webhookUrl field to Message model, SendMessageDto, SendTemplateDto, SendContactDto, and related services to enable sending messages to a specified webhook URL. This change allows for more flexible message handling and delivery options.

Modified files:
- prisma/postgresql-schema.prisma
- src/api/dto/sendMessage.dto.ts
- src/api/services/channels/whatsapp.business.service.ts
- src/validate/message.schema.ts

Untracked files:
- prisma/migrations/20240723200254_add_webhookurl_on_message/
2024-07-23 17:13:37 -03:00
Davidson Gomes
c1d3209f2f chore: equations and adjustments for the new manager 2024-07-23 12:34:58 -03:00
Davidson Gomes
f8e303f3a3 fix: Implement open chat completion and refactor code
Remove unnecessary initialization of empty arrays for systemMessages, assistantMessages, and userMessages in OpenaiService.
Also, implement a function to handle open chat completion and refactor the code for better readability and maintainability.
Affected files: openai.service.ts
2024-07-18 21:33:21 -03:00
Davidson Gomes
51749e8712 feat: Open AI assistants implemented 2024-07-18 21:11:46 -03:00
Davidson Gomes
29b9e688a8 chore: Crud openai complete 2024-07-18 10:14:53 -03:00
Davidson Gomes
aa2da01401 fix: Correction in start typebot, create it if not exists
- Corrected an issue where the start typebot function would throw an error if the typebot was not found.
- Added a condition to create a new typebot if it doesn't exist.
- Updated CHANGELOG.md with the details of the changes.

Files affected:
- CHANGELOG.md
- src/api/integrations/typebot/services/typebot.service.ts
2024-07-18 08:25:59 -03:00
Davidson Gomes
9aa2b1b3bf chore: Add apiKey and ServerUrl to prefilledVariables in typebot service
Update typebot.service.ts to add apiKey and ServerUrl to prefilledVariables.
This change is necessary for the typebot service to correctly prefill variables with the required credentials.
The deleted file .github/workflows/publish_docker_image_v2.yml was not related to this change.

Note: This change does not affect the current functionality but provides a better way to handle credentials.

Confidence: 90%
2024-07-18 08:15:53 -03:00
Davidson Gomes
b907d85a7e Fix: Fixed global exchange name and updated database connection client name
This commit resolves an issue with the global exchange name and updates the database connection client name. The `.env.example`, `CHANGELOG.md`, and `src/api/integrations/rabbitmq/libs/amqp.server.ts` files were modified. The exchange name in the AMQP server and global queues initialization has been changed to use the value from the configuration service. Additionally, the database connection client name has been updated in the `.env.example` file. The change in the `CHANGELOG.md` file has been updated accordingly.
2024-07-17 18:55:35 -03:00
Davidson Gomes
7e9132fcfe chore: Remove DEL\_TEMP\_INSTANCES variable and related functionality
The DEL\_TEMP\_INSTANCES variable and its related functionality have been removed from the .env.example, CHANGELOG.md, and src/api/services/monitor.service.ts files. The `delInstanceFiles` and `deleteTempInstances` methods have been removed from the MonitoringService class. This change simplifies the codebase and removes unnecessary functionality that was not being used.

Please note that this change does not impact the current functionalities of the application. However, it's important to update the documentation and any other related files accordingly. Make sure to test the application thoroughly to ensure there are no unintended consequences from this change.
2024-07-17 18:52:40 -03:00
Davidson Gomes
d76816eb9c Fix: Resolve 'not find name' issue in WhatsApp service
Resolves an issue where a name was not being found in the WhatsApp service. This fix updates the 'name' property in the WhatsApp service to use 'remoteJid' instead of 'id' when searching for contacts. This change affects the 'src/api/services/channels/whatsapp.baileys.service.ts' file and is reflected in the latest CHANGELOG.md update.

Note: The 'not find name' issue was initially addressed in the previous CHANGELOG.md version but was reintroduced due to a change in the contacts search logic. This commit aims to definitively resolve the issue.
2024-07-17 18:49:39 -03:00
Davidson Gomes
1e96878e5f fix: Improve database saving functionality
This commit fixes an issue with data being inconsistently saved in the database. It introduces a new configuration option to enable/disable saving of chat and contact data, as well as message updates and historic data.

The following files were modified:
- .env.example
- CHANGELOG.md
- src/api/services/channels/whatsapp.baileys.service.ts
- src/config/env.config.ts

The 'DATABASE_SAVE_DATA_NEW_MESSAGE', 'DATABASE_SAVE_DATA_MESSAGE_UPDATE', 'DATABASE_SAVE_DATA_CONTACTS', 'DATABASE_SAVE_DATA_CHATS', and 'DATABASE_SAVE_DATA_HISTORIC' options have been added to the 'SaveData' interface in 'env.config.ts'. These options control whether new messages, message updates, contacts, chats, and historic data are saved in the database, respectively. The 'DATABASE_SAVE_DATA_HISTORIC' option is new and allows for more granular control over what data is saved.

The 'WhatsappBaileysService' in 'whatsapp.baileys.service.ts' has been updated to check these configuration options before saving data in the database. This ensures that data is only saved when explicitly allowed.

The 'CHANGELOG.md' has been updated to reflect these changes.
2024-07-17 18:41:11 -03:00
Davidson Gomes
19e9ff9cc8 Fix: Resolved issue with Chatwoot not receiving messages sent by Typebot
Modified: CHANGELOG.md, src/api/integrations/typebot/services/typebot.service.ts

This commit resolves an issue where Chatwoot was not receiving messages sent by Typebot. The necessary changes were made to the typebot service file and the changelog was updated accordingly.
2024-07-17 15:49:03 -03:00
Davidson Gomes
a03ce984f6 chore: Update telemetry and add new integrations
Refactored the telemetry guard to use a new sendTelemetry utility function,
which allows for easier tracking of API routes. Also, added telemetry events
for message sending in the Chatwoot and Typebot services.

Additionally, updated the README.md to include new content creators and
added new integrations with Typebot and Chatwoot services.

Modified:
- README.md
- package.json
- src/api/guards/telemetry.guard.ts
- src/api/integrations/chatwoot/services/chatwoot.service.ts
- src/api/integrations/typebot/services/typebot.service.ts

Added:
- src/utils/sendTelemetry.ts
2024-07-15 12:43:20 -03:00
Davidson Gomes
e33893d943 chore: Add telemetry system
Added new file 'telemetry.guard.ts' in 'src/api/guards' directory.
Modified 'index.router.ts' in 'src/api/routes' directory to integrate the new telemetry system.

This change improves the monitoring and data gathering capabilities of the application, allowing for better performance analysis and potential issue detection.
2024-07-15 09:25:40 -03:00
Davidson Gomes
484736facd fix: Updated media handling in WhatsApp Baileys and Typebot services
This commit fixes issues with media handling in the WhatsApp Baileys and Typebot services. Specifically, it updates the way media messages are processed and stored. The changes include:

- Importing the `S3` class from the configuration in the Typebot service (`src/api/integrations/typebot/services/typebot.service.ts`).
- Modifying the `getTypeMessage` method in the Typebot service to handle media messages more efficiently.
- Refactoring the `BaileysStartupService` in the WhatsApp Baileys service (`src/api/services/channels/whatsapp.baileys.service.ts`) to handle media messages more consistently.

These changes improve the handling and storage of media messages, ensuring that they are processed correctly and efficiently.
2024-07-14 10:39:32 -03:00
Davidson Gomes
e6916acf45 chore: Improve 'getBase64FromMediaMessage' function in Whatsapp Baileys service
The 'getBase64FromMediaMessage' function in the Whatsapp Baileys service has been improved. Now, the 'getBuffer' parameter has a default value of 'false', making it optional. This change simplifies the function call and enhances readability.

Modified file:
- src/api/services/channels/whatsapp.baileys.service.ts
2024-07-13 16:15:55 -03:00
Davidson Gomes
d80b0d14ac chore: Whatsapp Baileys service - disable webhook media download when S3 is not enabled
This change disables the download of media messages through the Whatsapp Baileys service's local webhook when the S3 storage is not enabled. This is to prevent unnecessary media downloads and potential storage issues. The modified file is 'whatsapp.baileys.service.ts'.
2024-07-13 16:12:16 -03:00
Davidson Gomes
e73d9c1982 chore: Integration with MinIO and S3
Adds support for MinIO and S3 for storing media files. Modified several files to implement this feature, including package.json, prisma/postgresql-schema.prisma, src/api/integrations/typebot/services/typebot.service.ts, src/api/routes/index.router.ts, src/api/services/channels/whatsapp.baileys.service.ts, and src/config/env.config.ts. Added untracked files for the new S3 integration. Also added a new S3Controller and S3Service for handling S3 related operations.

This change allows for more flexible media storage options and enables the use of MinIO or S3 for storing media files.
2024-07-13 16:07:16 -03:00
Davidson Gomes
f7a731a193 chore: Add ignoreJid feature to typebot and improve comparison
Adds a new feature to the typebot integration that allows ignoring specific remote JIDs. Also improves the comparison functionality. The main changes are in the typebot controller, DTO, route, and service. Additionally, the WhatsApp Business Service and event configuration files have been updated.

The main files modified are:
- typebot.controller.ts
- typebot.dto.ts
- typebot.router.ts
- typebot.service.ts
- typebot.schema.ts
- whatsapp.business.service.ts
- event.config.ts
2024-07-13 13:55:42 -03:00
Davidson Gomes
e3a97d0071 refactor: using stream instead of temp files in chatwoot and repository services
This commit refactors the code in the `chatwoot.service.ts` and `repository.service.ts` files to use streams instead of temporary files. This change reduces the number of disk operations, making the application faster and more efficient.

In the `chatwoot.service.ts` file, the `createReadStream`, `unlinkSync`, and `writeFileSync` functions have been replaced with the `Readable` stream. The `sendData` method has been updated to accept a `fileStream` and `fileName` instead of a file path. The `processImage` method has been refactored to use a stream instead of writing the image to a file.

In the `repository.service.ts` file, the `initStoreFolders` method has been removed, as it is no longer needed.

These changes improve the maintainability of the codebase by reducing the number of disk operations and simplifying the code. This refactoring also makes the application more efficient and faster, as it reduces the number of disk operations.

Motivation:
The motivation behind this refactoring is to improve the performance and efficiency of the application by reducing the number of disk operations.

Impact:
This refactoring reduces the number of disk operations, making the application faster and more efficient. It also simplifies the codebase and improves its maintainability.
2024-07-13 08:10:36 -03:00
Davidson Gomes
b2bf5d2318 chore: Ignore specific JIDs in Typebot integration
Implements the ability to ignore specific JIDs in the Typebot integration, improving the flexibility of the feature. This change includes modifications in the Prisma schema, DTOs, services, and validation schema.

- Adds 'ignoreJids' field to the PostgreSQL schema (prisma/postgresql-schema.prisma).
- Updates TypebotDto and TypebotSettingDto to include 'ignoreJids' (src/api/integrations/typebot/dto/typebot.dto.ts).
- Modifies TypebotService to handle 'ignoreJids' when creating and updating Typebot instances (src/api/integrations/typebot/services/typebot.service.ts).
- Adds 'ignoreJids' to the Typebot validation schema (src/api/integrations/typebot/validate/typebot.schema.ts).

This update allows for more precise control over which JIDs are processed by the Typebot integration, reducing unnecessary processing and improving performance.
2024-07-12 20:14:57 -03:00