@@ -732,6 +732,8 @@ export class ChatwootService {
732732 file : string ,
733733 messageType : 'incoming' | 'outgoing' | undefined ,
734734 content ?: string ,
735+ source_id ?: string ,
736+ source_reply_id ?: string ,
735737 ) {
736738 this . logger . verbose ( 'send data to chatwoot' ) ;
737739
@@ -748,6 +750,12 @@ export class ChatwootService {
748750 this . logger . verbose ( 'temp file found' ) ;
749751 data . append ( 'attachments[]' , createReadStream ( file ) ) ;
750752
753+ this . logger . verbose ( 'message context: ' + source_id ) ;
754+ data . append ( 'source_id' , source_id ) ;
755+
756+ this . logger . verbose ( 'message reply context: ' + source_reply_id ) ;
757+ data . append ( 'source_reply_id' , source_reply_id ) ;
758+
751759 this . logger . verbose ( 'get client to instance: ' + this . provider . instanceName ) ;
752760 const config = {
753761 method : 'post' ,
@@ -1170,10 +1178,10 @@ export class ChatwootService {
11701178 documentMessage : msg . documentMessage ?. contextInfo ?. stanzaId ,
11711179 documentWithCaptionMessage : msg . documentWithCaptionMessage ?. message ?. documentMessage ?. contextInfo ?. stanzaId ,
11721180 audioMessage : msg . audioMessage ?. contextInfo ?. stanzaId ,
1173- contactMessage : msg . contactMessage ?. vcard ,
1174- contactsArrayMessage : msg . contactsArrayMessage ,
1175- locationMessage : msg . locationMessage ,
1176- liveLocationMessage : msg . liveLocationMessage ,
1181+ contactMessage : msg . contactMessage ?. contextInfo ?. stanzaId ,
1182+ contactsArrayMessage : msg . contactsArrayMessage ?. contextInfo ?. stanzaId ,
1183+ locationMessage : msg . locationMessage ?. contextInfo ?. stanzaId ,
1184+ liveLocationMessage : msg . liveLocationMessage ?. contextInfo ?. stanzaId ,
11771185 } ;
11781186
11791187 this . logger . verbose ( 'type message: ' + types ) ;
@@ -1182,7 +1190,7 @@ export class ChatwootService {
11821190 }
11831191
11841192 private getContextMessageContent ( types : any ) {
1185- this . logger . verbose ( 'get message content' ) ;
1193+ this . logger . verbose ( 'get message context content' ) ;
11861194 const typeKey = Object . keys ( types ) . find ( ( key ) => types [ key ] !== undefined ) ;
11871195
11881196 const result = typeKey ? types [ typeKey ] : undefined ;
@@ -1393,7 +1401,7 @@ export class ChatwootService {
13931401 }
13941402
13951403 this . logger . verbose ( 'send data to chatwoot' ) ;
1396- const send = await this . sendData ( getConversion , fileName , messageType , content ) ;
1404+ const send = await this . sendData ( getConversion , fileName , messageType , content , source_id , source_reply_id ) ;
13971405
13981406 if ( ! send ) {
13991407 this . logger . warn ( 'message not sent' ) ;
@@ -1414,7 +1422,14 @@ export class ChatwootService {
14141422 this . logger . verbose ( 'message is not group' ) ;
14151423
14161424 this . logger . verbose ( 'send data to chatwoot' ) ;
1417- const send = await this . sendData ( getConversion , fileName , messageType , bodyMessage ) ;
1425+ const send = await this . sendData (
1426+ getConversion ,
1427+ fileName ,
1428+ messageType ,
1429+ bodyMessage ,
1430+ source_id ,
1431+ source_reply_id ,
1432+ ) ;
14181433
14191434 if ( ! send ) {
14201435 this . logger . warn ( 'message not sent' ) ;
0 commit comments