@@ -567,13 +567,6 @@ export class ChatwootService {
567567 }
568568
569569 public async createConversation ( instance : InstanceDto , body : any ) {
570- if ( ! body ?. key ) {
571- this . logger . warn (
572- `body.key is null or undefined in createConversation. Full body object: ${ JSON . stringify ( body ) } ` ,
573- ) ;
574- return null ;
575- }
576-
577570 const isLid = body . key . previousRemoteJid ?. includes ( '@lid' ) && body . key . senderPn ;
578571 const remoteJid = body . key . remoteJid ;
579572 const cacheKey = `${ instance . instanceName } :createConversation-${ remoteJid } ` ;
@@ -1900,12 +1893,6 @@ export class ChatwootService {
19001893
19011894 public async eventWhatsapp ( event : string , instance : InstanceDto , body : any ) {
19021895 try {
1903- // Ignore events that are not messages (like EPHEMERAL_SYNC_RESPONSE)
1904- if ( body ?. type && body . type !== 'message' && body . type !== 'conversation' ) {
1905- this . logger . verbose ( `Ignoring non-message event type: ${ body . type } ` ) ;
1906- return ;
1907- }
1908-
19091896 const waInstance = this . waMonitor . waInstances [ instance . instanceName ] ;
19101897
19111898 if ( ! waInstance ) {
@@ -1951,11 +1938,6 @@ export class ChatwootService {
19511938 }
19521939
19531940 if ( event === 'messages.upsert' || event === 'send.message' ) {
1954- if ( ! body ?. key ) {
1955- this . logger . warn ( `body.key is null or undefined. Full body object: ${ JSON . stringify ( body ) } ` ) ;
1956- return ;
1957- }
1958-
19591941 if ( body . key . remoteJid === 'status@broadcast' ) {
19601942 return ;
19611943 }
@@ -2278,23 +2260,10 @@ export class ChatwootService {
22782260 }
22792261
22802262 if ( event === 'messages.edit' || event === 'send.message.update' ) {
2281- // Ignore events that are not messages (like EPHEMERAL_SYNC_RESPONSE)
2282- if ( body ?. type && body . type !== 'message' ) {
2283- this . logger . verbose ( `Ignoring non-message event type: ${ body . type } ` ) ;
2284- return ;
2285- }
2286-
2287- if ( ! body ?. key ?. id ) {
2288- this . logger . warn (
2289- `body.key.id is null or undefined in messages.edit. Full body object: ${ JSON . stringify ( body ) } ` ,
2290- ) ;
2291- return ;
2292- }
2293-
22942263 const editedText = `${
22952264 body ?. editedMessage ?. conversation || body ?. editedMessage ?. extendedTextMessage ?. text
22962265 } \n\n_\`${ i18next . t ( 'cw.message.edited' ) } .\`_`;
2297- const message = await this . getMessageByKeyId ( instance , body . key . id ) ;
2266+ const message = await this . getMessageByKeyId ( instance , body ? .key ? .id ) ;
22982267 const key = message . key as {
22992268 id : string ;
23002269 fromMe : boolean ;
0 commit comments