created function to get chats for a user