Facebook has considered profiling its users' personalities and using the information to target adverts.
A patent filed by the social network describes how personality characteristics, including emotional stability, could be determined from people's messages and status updates.
The firm is currently embroiled in a privacy scandal over the use of its data by a political consultancy.
Facebook says it has never used the personality test in its products.
The patent, first filed in 2012, is in the names of Michael Nowak and Dean Eckles.
Mr Nowak has worked for Facebook for 10 years, while Prof Eckles now teaches at the Massachusetts Institute of Technology.
The patent has been updated twice, most recently in 2016.
The BBC has seen emails from Mr Eckles and other Facebook staff to University of Cambridge psychologists in which they discuss analysis of data to infer personality traits, and talk of using such research to improve the product for users and advertisers.
The political consultancy Cambridge Analytica claimed that it used a similar technique, known as psychographics, in its work, though it has denied using data sourced from a Facebook personality quiz in the 2016 US presidential election.
Facebook's patent says potential sources of data could include "status updates, notes, messages, posts, comments, or any other communications from which linguistic data may be extracted".
It says the personality characteristics could then be stored in a user's profile and used "to select news stories, advertisements, or recommendations of actions presented to the user".
Prof Eckles told the BBC that his research had involved asking Facebook users to complete surveys that posed personality questions, adding that it had been made clear that the social network was behind the questionnaires.
He acknowledged that "psychographic [advertising] targeting raises some distinctive ethical concerns" but said he was doubtful it would ever have been effective.
Facebook has raised concerns about the work of University of Cambridge academics involved in similar research.
The Cambridge Psychometrics Centre has been banned from the platform while Facebook investigates allegations that it misused data.
The centre denies the allegation that it handed data gathered from a personality quiz for academic research to the commercial company Cubeyou.
"We have had several conversations and meetings with Facebook researchers going back as far as 2011," said a spokesman for the Psychometrics Centre.
"However, Facebook has chosen not to publish its research, and therefore users will be unaware how their data may be being used."
This is a separate case from the one in which another academic, Dr Aleksandr Kogan, is accused of breaking rules by passing data to Cambridge Analytica.
During congressional hearings earlier this month, Facebook's chief executive Mark Zuckerberg appeared to link the two cases, saying "we do need to know whether there was something bad going on at Cambridge University overall".
Academics at the Cambridge Psychometrics Centre published an influential paper in 2013 about predicting personality from Facebook likes, the result of research which had been under way for some years.
The BBC has seen a 2011 email from Prof Eckles, then a researcher at Facebook, to the Cambridge academics expressing interest in their work.
He describes undertaking similar research.
"We have been using analysis of linguistic data to infer personality traits," he wrote.
"We have a manuscript that is going through some revisions now."
Two years later in 2013, another Facebook employee wrote to the Cambridge academics, apparently unaware of the previous contact.
Srikant Ayyar wrote that he had read their recent paper with interest and continued: "Our group does similar work with the goal of improving our product for people who use it and advertisers. …..we are growing to keep pace with Facebook growth and growth in the data we collect."
This was followed by a conference call, but plans for collaboration came to nothing.
In a statement, Facebook said: "Like many companies we apply for a wide variety of patents to protect our intellectual property. The patent we applied for in this area was never used in any Facebook products or further developed."