On January 6, 1838, Samuel Morse’s telegraph system is demonstrated for the first time at the Speedwell Iron Works in Morristown, New Jersey. The telegraph, a device which used electric impulses to transmit encoded messages over a wire, would eventually revolutionize long-distance communication, reaching the height of its popularity in the 1920s and 1930s.

Samuel Finley Breese Morse was born April 27, 1791, in Charlestown, Massachusetts. He attended Yale University, where he was interested in art, as well as electricity, still in its infancy at the time. After college, Morse became a painter. In 1832, while sailing home from Europe, he heard about the newly discovered electromagnet and came up with an idea for an electric telegraph. He had no idea that other inventors were already at work on the concept.

Morse spent the next several years developing a prototype and took on two partners, Leonard Gale and Alfred Vail, to help him. In 1838, he demonstrated his invention using Morse code, in which dots and dashes represented letters and numbers. In 1843, Morse finally convinced a skeptical Congress to fund the construction of the first telegraph line in the United States, from Washington, D.C., to Baltimore. In May 1844, Morse sent the first official telegram over the line, with the message: “What hath God wrought!”

Over the next few years, private companies, using Morse’s patent, set up telegraph lines around the Northeast. In 1851, the New York and Mississippi Valley Printing Telegraph Company was founded; it would later change its name to Western Union. In 1861, Western Union finished the first transcontinental line across the United States. Five years later, the first successful permanent line across the Atlantic Ocean was constructed and by the end of the century telegraph systems were in place in Africa, Asia and Australia.

Because telegraph companies typically charged by the word, telegrams became known for their succinct prose–whether they contained happy or sad news. The word “stop,” which was free, was used in place of a period, for which there was a charge. In 1933, Western Union introduced singing telegrams. During World War II, Americans came to dread the sight of Western Union couriers because the military used telegrams to inform families about soldiers’ deaths.

Over the course of the 20th century, telegraph messages were largely replaced by cheap long-distance phone service, faxes and email. Western Union delivered its final telegram in January 2006.

Samuel Morse died wealthy and famous in New York City on April 2, 1872, at age 80.