Merge pull request #1919 from EvolutionAPI/revert-1732-testmsg

Revert "Ignore events that are not messages (like EPHEMERAL_SYNC_RESPONSE)"
This commit is contained in:
Davidson Gomes 2025-09-08 14:49:20 -03:00 committed by GitHub
commit 9cb703a427
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -567,13 +567,6 @@ export class ChatwootService {
}
public async createConversation(instance: InstanceDto, body: any) {
if (!body?.key) {
this.logger.warn(
`body.key is null or undefined in createConversation. Full body object: ${JSON.stringify(body)}`,
);
return null;
}
const isLid = body.key.previousRemoteJid?.includes('@lid') && body.key.senderPn;
const remoteJid = body.key.remoteJid;
const cacheKey = `${instance.instanceName}:createConversation-${remoteJid}`;
@ -1900,12 +1893,6 @@ export class ChatwootService {
public async eventWhatsapp(event: string, instance: InstanceDto, body: any) {
try {
// Ignore events that are not messages (like EPHEMERAL_SYNC_RESPONSE)
if (body?.type && body.type !== 'message' && body.type !== 'conversation') {
this.logger.verbose(`Ignoring non-message event type: ${body.type}`);
return;
}
const waInstance = this.waMonitor.waInstances[instance.instanceName];
if (!waInstance) {
@ -1951,11 +1938,6 @@ export class ChatwootService {
}
if (event === 'messages.upsert' || event === 'send.message') {
if (!body?.key) {
this.logger.warn(`body.key is null or undefined. Full body object: ${JSON.stringify(body)}`);
return;
}
if (body.key.remoteJid === 'status@broadcast') {
return;
}
@ -2278,23 +2260,10 @@ export class ChatwootService {
}
if (event === 'messages.edit' || event === 'send.message.update') {
// Ignore events that are not messages (like EPHEMERAL_SYNC_RESPONSE)
if (body?.type && body.type !== 'message') {
this.logger.verbose(`Ignoring non-message event type: ${body.type}`);
return;
}
if (!body?.key?.id) {
this.logger.warn(
`body.key.id is null or undefined in messages.edit. Full body object: ${JSON.stringify(body)}`,
);
return;
}
const editedText = `${
body?.editedMessage?.conversation || body?.editedMessage?.extendedTextMessage?.text
}\n\n_\`${i18next.t('cw.message.edited')}.\`_`;
const message = await this.getMessageByKeyId(instance, body.key.id);
const message = await this.getMessageByKeyId(instance, body?.key?.id);
const key = message.key as {
id: string;
fromMe: boolean;