A Boston pharmacist invented a machine to make medical lozenges. This was how conversation hearts got their start, as medical lozenges. Then the pharmacist switched to making circular candies with it.  This was in 1847.  In 1866, his brother came up with the idea to print messages on the candies.  So in 1902, they became heart-shaped.