Skip to content

Commit 867e849

Browse files
committed
fix: added cache to identify duplicated messages on events
- Update Docker image repository to evoapicloud/evolution-api - Modify contact email to contato@evolution-api.com - Update Docker Compose, Dockerfile, and workflow files - Add Docker image badge to README - Include additional content creator in README - Implement message deduplication cache in Baileys service
1 parent 8135994 commit 867e849

File tree

10 files changed

+33
-9
lines changed

10 files changed

+33
-9
lines changed

.github/workflows/publish_docker_image.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: meta
2121
uses: docker/metadata-action@v5
2222
with:
23-
images: atendai/evolution-api
23+
images: evoapicloud/evolution-api
2424
tags: type=semver,pattern=v{{version}}
2525

2626
- name: Set up QEMU

.github/workflows/publish_docker_image_homolog.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: meta
2121
uses: docker/metadata-action@v5
2222
with:
23-
images: atendai/evolution-api
23+
images: evoapicloud/evolution-api
2424
tags: homolog
2525

2626
- name: Set up QEMU

.github/workflows/publish_docker_image_latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
id: meta
2121
uses: docker/metadata-action@v5
2222
with:
23-
images: atendai/evolution-api
23+
images: evoapicloud/evolution-api
2424
tags: latest
2525

2626
- name: Set up QEMU

Docker/swarm/evolution_api_v2.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ version: "3.7"
22

33
services:
44
evolution_v2:
5-
image: atendai/evolution-api:v2.1.2
5+
image: evoapicloud/evolution-api:latest
66
volumes:
77
- evolution_instances:/evolution/instances
88
networks:

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ RUN apk update && \
55

66
LABEL version="2.2.3" description="Api to control whatsapp features through http requests."
77
LABEL maintainer="Davidson Gomes" git="https://github.com/DavidsonGomes"
8-
LABEL contact="contato@atendai.com"
8+
LABEL contact="contato@evolution-api.com"
99

1010
WORKDIR /evolution
1111

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ a. LOGO and copyright information: In the process of using Evolution API's front
88

99
b. Usage Notification Requirement: If Evolution API is used as part of any project, including closed-source systems (e.g., proprietary software), the user is required to display a clear notification within the system that Evolution API is being utilized. This notification should be visible to system administrators and accessible from the system's documentation or settings page. Failure to comply with this requirement may result in the necessity for a commercial license, as determined by the producer.
1010

11-
Please contact contato@atendai.com to inquire about licensing matters.
11+
Please contact contato@evolution-api.com to inquire about licensing matters.
1212

1313
2. As a contributor, you should agree that:
1414

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
<div align="center">
44

5+
[![Docker Image (https://img.shields.io/badge/Docker-Image-blue)](https://hub.docker.com/r/evoapicloud/evolution-api)]
56
[![Whatsapp Group](https://img.shields.io/badge/Group-WhatsApp-%2322BC18)](https://evolution-api.com/whatsapp)
67
[![Discord Community](https://img.shields.io/badge/Discord-Community-blue)](https://evolution-api.com/discord)
78
[![Postman Collection](https://img.shields.io/badge/Postman-Collection-orange)](https://evolution-api.com/postman)
@@ -87,6 +88,7 @@ https://github.com/sponsors/EvolutionAPI
8788
We are proud to collaborate with the following content creators who have contributed valuable insights and tutorials about Evolution API:
8889

8990
- [Promovaweb](https://www.youtube.com/@promovaweb)
91+
- [Sandeco](https://www.youtube.com/@canalsandeco)
9092
- [Comunidade ZDG](https://www.youtube.com/@ComunidadeZDG)
9193
- [Francis MNO](https://www.youtube.com/@FrancisMNO)
9294
- [Pablo Cabral](https://youtube.com/@pablocabral)
@@ -111,7 +113,7 @@ Evolution API is licensed under the Apache License 2.0, with the following addit
111113

112114
2. **Usage Notification Requirement**: If Evolution API is used as part of any project, including closed-source systems (e.g., proprietary software), the user is required to display a clear notification within the system that Evolution API is being utilized. This notification should be visible to system administrators and accessible from the system's documentation or settings page. Failure to comply with this requirement may result in the necessity for a commercial license, as determined by the producer.
113115

114-
Please contact contato@atendai.com to inquire about licensing matters.
116+
Please contact contato@evolution-api.com to inquire about licensing matters.
115117

116118
Apart from the specific conditions mentioned above, all other rights and restrictions follow the Apache License 2.0. Detailed information about the Apache License 2.0 can be found at [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0).
117119

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
services:
22
api:
33
container_name: evolution_api
4-
image: atendai/evolution-api:homolog
4+
image: evoapicloud/evolution-api:latest
55
restart: always
66
depends_on:
77
- redis

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
],
4242
"author": {
4343
"name": "Davidson Gomes",
44-
"email": "contato@atendai.com"
44+
"email": "contato@evolution-api.com"
4545
},
4646
"license": "Apache-2.0",
4747
"bugs": {

src/api/integrations/channel/whatsapp/whatsapp.baileys.service.ts

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1161,6 +1161,17 @@ export class BaileysStartupService extends ChannelStartupService {
11611161
await this.baileysCache.delete(received.key.id);
11621162
}
11631163

1164+
// Cache to avoid duplicate messages
1165+
const messageKey = `${this.instance.id}_${received.key.id}`;
1166+
const cached = await this.baileysCache.get(messageKey);
1167+
1168+
if (cached) {
1169+
this.logger.info(`Message duplicated ignored: ${received.key.id}`);
1170+
continue;
1171+
}
1172+
1173+
await this.baileysCache.set(messageKey, true, 30 * 60);
1174+
11641175
if (
11651176
(type !== 'notify' && type !== 'append') ||
11661177
received.message?.protocolMessage ||
@@ -1422,6 +1433,17 @@ export class BaileysStartupService extends ChannelStartupService {
14221433
continue;
14231434
}
14241435

1436+
const updateKey = `${this.instance.id}_${key.id}_${update.status}`;
1437+
1438+
const cached = await this.baileysCache.get(updateKey);
1439+
1440+
if (cached) {
1441+
this.logger.info(`Message duplicated ignored: ${key.id}`);
1442+
continue;
1443+
}
1444+
1445+
await this.baileysCache.set(updateKey, true, 30 * 60);
1446+
14251447
if (status[update.status] === 'READ' && key.fromMe) {
14261448
if (this.configService.get<Chatwoot>('CHATWOOT').ENABLED && this.localChatwoot?.enabled) {
14271449
this.chatwootService.eventWhatsapp(

0 commit comments

Comments
 (0)