File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
src/api/integrations/chatwoot/services Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -1119,7 +1119,7 @@ export class ChatwootService {
11191119 conversationId : conversation ,
11201120 data : {
11211121 content : i18next . t ( 'cw.message.notsent' , {
1122- error : error . length > 0 ? `_${ error } _` : '' ,
1122+ error : error ? .length > 0 ? `_${ error } _` : '' ,
11231123 } ) ,
11241124 message_type : 'outgoing' ,
11251125 private : true ,
@@ -1295,6 +1295,11 @@ export class ChatwootService {
12951295 return { message : 'bot' } ;
12961296 }
12971297
1298+ if ( ! waInstance && body . conversation ?. id ) {
1299+ this . onSendMessageError ( instance , body . conversation ?. id , 'Instance not found' ) ;
1300+ return { message : 'bot' } ;
1301+ }
1302+
12981303 this . logger . verbose ( 'Format message to send' ) ;
12991304 let formatText : string ;
13001305 if ( senderName === null || senderName === undefined ) {
@@ -1370,6 +1375,9 @@ export class ChatwootService {
13701375 let messageSent : MessageRaw | proto . WebMessageInfo ;
13711376 try {
13721377 messageSent = await waInstance ?. textMessage ( data , true ) ;
1378+ if ( ! messageSent ) {
1379+ throw new Error ( 'Message not sent' ) ;
1380+ }
13731381
13741382 this . updateChatwootMessageId (
13751383 {
You can’t perform that action at this time.
0 commit comments