@@ -106,15 +106,37 @@ export class EvolutionBotService extends BaseChatbotService<EvolutionBot, Evolut
106106 } ;
107107 }
108108
109+ // Sanitize payload for logging (remove sensitive data)
110+ const sanitizedPayload = {
111+ ...payload ,
112+ inputs : {
113+ ...payload . inputs ,
114+ apiKey : payload . inputs . apiKey ? '[REDACTED]' : undefined ,
115+ } ,
116+ } ;
117+
118+ this . logger . debug ( `[EvolutionBot] Sending request to endpoint: ${ endpoint } ` ) ;
119+ this . logger . debug ( `[EvolutionBot] Request payload: ${ JSON . stringify ( sanitizedPayload , null , 2 ) } ` ) ;
120+
109121 const response = await axios . post ( endpoint , payload , {
110122 headers,
111123 } ) ;
112124
125+ this . logger . debug ( `[EvolutionBot] Response received - Status: ${ response . status } ` ) ;
126+
113127 if ( instance . integration === Integration . WHATSAPP_BAILEYS ) {
114128 await instance . client . sendPresenceUpdate ( 'paused' , remoteJid ) ;
115129 }
116130
117131 let message = response ?. data ?. message ;
132+ const rawLinkPreview = response ?. data ?. linkPreview ;
133+
134+ // Validate linkPreview is boolean and default to true for backward compatibility
135+ const linkPreview = typeof rawLinkPreview === 'boolean' ? rawLinkPreview : true ;
136+
137+ this . logger . debug (
138+ `[EvolutionBot] Processing response - Message length: ${ message ?. length || 0 } , LinkPreview: ${ linkPreview } ` ,
139+ ) ;
118140
119141 if ( message && typeof message === 'string' && message . startsWith ( "'" ) && message . endsWith ( "'" ) ) {
120142 const innerContent = message . slice ( 1 , - 1 ) ;
@@ -124,8 +146,19 @@ export class EvolutionBotService extends BaseChatbotService<EvolutionBot, Evolut
124146 }
125147
126148 if ( message ) {
127- // Use the base class method to send the message to WhatsApp
128- await this . sendMessageWhatsApp ( instance , remoteJid , message , settings ) ;
149+ // Send message directly with validated linkPreview option
150+ await instance . textMessage (
151+ {
152+ number : remoteJid . split ( '@' ) [ 0 ] ,
153+ delay : settings ?. delayMessage || 1000 ,
154+ text : message ,
155+ linkPreview, // Always boolean, defaults to true
156+ } ,
157+ false ,
158+ ) ;
159+ this . logger . debug ( `[EvolutionBot] Message sent successfully with linkPreview: ${ linkPreview } ` ) ;
160+ } else {
161+ this . logger . warn ( `[EvolutionBot] No message content received from bot response` ) ;
129162 }
130163
131164 // Send telemetry
0 commit comments