SAN FRANCISCO — Facebook has said that political data firm Cambridge Analytica improperly harvested the public profile data of up to 87 million of its users, including their political beliefs, interests and friends’ information.

Now the social network has revealed that the extent of the harvesting went even further — it included people’s private messages, too.

On Monday, Facebook began informing people whose data may have been compromised by Cambridge Analytica through an app developed by the researcher Aleksandr Kogan. In its notifications, Facebook said that while the information harvested was largely limited to what was on people’s public profiles, “a small number of people” also shared information from their Facebook timeline, posts and messages.