File tree Expand file tree Collapse file tree 2 files changed +8
-19
lines changed
src/api/integrations/chatwoot/services Expand file tree Collapse file tree 2 files changed +8
-19
lines changed Original file line number Diff line number Diff line change 4949 "amqplib" : " ^0.10.3" ,
5050 "aws-sdk" : " ^2.1499.0" ,
5151 "axios" : " ^1.6.5" ,
52- "baileys" : " ^6.7.1 " ,
52+ "baileys" : " ^6.7.2 " ,
5353 "class-validator" : " ^0.14.1" ,
5454 "compression" : " ^1.7.4" ,
5555 "cors" : " ^2.8.5" ,
Original file line number Diff line number Diff line change @@ -789,26 +789,15 @@ export class ChatwootService {
789789 return null ;
790790 }
791791
792- const payload = [
793- [ 'inbox_id' , inbox . id . toString ( ) ] ,
794- [ 'contact_id' , contact . id . toString ( ) ] ,
795- [ 'status' , 'open' ] ,
796- ] ;
792+ const conversations = ( await client . contacts . listConversations ( {
793+ accountId : this . provider . account_id ,
794+ id : contact . id ,
795+ } ) ) as any ;
797796
798797 return (
799- (
800- ( await client . conversations . filter ( {
801- accountId : this . provider . account_id ,
802- payload : payload . map ( ( item , i , payload ) => {
803- return {
804- attribute_key : item [ 0 ] ,
805- filter_operator : 'equal_to' ,
806- values : [ item [ 1 ] ] ,
807- query_operator : i < payload . length - 1 ? 'AND' : null ,
808- } ;
809- } ) ,
810- } ) ) as { payload : conversation [ ] }
811- ) . payload [ 0 ] || undefined
798+ conversations . payload . find (
799+ ( conversation ) => conversation . inbox_id === inbox . id && conversation . status === 'open' ,
800+ ) || undefined
812801 ) ;
813802 }
814803
You can’t perform that action at this time.
0 commit comments