Skip to content

Commit 44d4781

Browse files
committed
Ignore events that are not messages
1 parent e304b1d commit 44d4781

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/api/integrations/chatbot/chatwoot/services/chatwoot.service.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1898,6 +1898,12 @@ export class ChatwootService {
18981898

18991899
public async eventWhatsapp(event: string, instance: InstanceDto, body: any) {
19001900
try {
1901+
// Ignora eventos que não são mensagens (como EPHEMERAL_SYNC_RESPONSE)
1902+
if (body?.type && body.type !== 'message' && body.type !== 'conversation') {
1903+
this.logger.verbose(`Ignoring non-message event type: ${body.type}`);
1904+
return;
1905+
}
1906+
19011907
const waInstance = this.waMonitor.waInstances[instance.instanceName];
19021908

19031909
if (!waInstance) {
@@ -2270,6 +2276,12 @@ export class ChatwootService {
22702276
}
22712277

22722278
if (event === 'messages.edit' || event === 'send.message.update') {
2279+
// Ignora eventos que não são mensagens (como EPHEMERAL_SYNC_RESPONSE)
2280+
if (body?.type && body.type !== 'message') {
2281+
this.logger.verbose(`Ignoring non-message event type: ${body.type}`);
2282+
return;
2283+
}
2284+
22732285
if (!body?.key?.id) {
22742286
this.logger.warn(`body.key.id is null or undefined in messages.edit. Full body object: ${JSON.stringify(body)}`);
22752287
return;

0 commit comments

Comments
 (0)