@@ -955,8 +955,8 @@ export class ChatwootService {
955955
956956 if ( replyToIds . in_reply_to || replyToIds . in_reply_to_external_id ) {
957957 const content = JSON . stringify ( {
958- ...replyToIds
959- } )
958+ ...replyToIds ,
959+ } ) ;
960960 data . append ( 'content_attributes' , content ) ;
961961 }
962962 }
@@ -1613,7 +1613,16 @@ export class ChatwootService {
16131613 thumbnailUrl : string ;
16141614 sourceUrl : string ;
16151615 }
1616- const adsMessage : AdsMessage | undefined = msg . extendedTextMessage ?. contextInfo ?. externalAdReply ;
1616+
1617+ const adsMessage : AdsMessage | undefined = {
1618+ title : msg . extendedTextMessage ?. contextInfo ?. externalAdReply ?. title || msg . contextInfo ?. externalAdReply ?. title ,
1619+ body : msg . extendedTextMessage ?. contextInfo ?. externalAdReply ?. body || msg . contextInfo ?. externalAdReply ?. body ,
1620+ thumbnailUrl :
1621+ msg . extendedTextMessage ?. contextInfo ?. externalAdReply ?. thumbnailUrl ||
1622+ msg . contextInfo ?. externalAdReply ?. thumbnailUrl ,
1623+ sourceUrl :
1624+ msg . extendedTextMessage ?. contextInfo ?. externalAdReply ?. sourceUrl || msg . contextInfo ?. externalAdReply ?. sourceUrl ,
1625+ } ;
16171626
16181627 return adsMessage ;
16191628 }
@@ -1911,7 +1920,7 @@ export class ChatwootService {
19111920
19121921 const isMedia = this . isMediaMessage ( body . message ) ;
19131922
1914- const adsMessage = this . getAdsMessage ( body . message ) ;
1923+ const adsMessage = this . getAdsMessage ( body ) ;
19151924
19161925 const reactionMessage = this . getReactionMessage ( body . message ) ;
19171926
@@ -2059,11 +2068,13 @@ export class ChatwootService {
20592068 fileStream . push ( null ) ;
20602069
20612070 const truncStr = ( str : string , len : number ) => {
2071+ if ( ! str ) return '' ;
2072+
20622073 return str . length > len ? str . substring ( 0 , len ) + '...' : str ;
20632074 } ;
20642075
20652076 const title = truncStr ( adsMessage . title , 40 ) ;
2066- const description = truncStr ( adsMessage . body , 75 ) ;
2077+ const description = truncStr ( adsMessage ? .body , 75 ) ;
20672078
20682079 const send = await this . sendData (
20692080 getConversation ,
0 commit comments