How to check if two users have been in a conversation together?

I am trying to query Twilio to see if 2 users have ever engaged in a conversation. I query conversations.user.userConversations to get a list of conversations the primary user has been in, then i filter that list to check where the participantSid of the main user in any of their conversations matches the sid of the participant user.

My function doesnt work, why?


const checkForExistingConversations = async (loggedInUserSid, participantUserSid) => 

{
  let existingConversations = await client.conversations.users(loggedInUserSid)
      .userConversations
      .list()
  existingConversations.filter((convo) =>  convo.participantSid === participantUserSid)  // here is the issue
  return existingConversations
}


If this is an emergency, please contact Twilio Support. This is not an official Support channel. https://support.twilio.com/
Have an urgent question?
Please contact Twilio Support. This is not an official Support channel.
Contact Support