File tree Expand file tree Collapse file tree 1 file changed +7
-18
lines changed
src/api/integrations/chatwoot/services Expand file tree Collapse file tree 1 file changed +7
-18
lines changed 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