The telegram was invented by Samuel Morse and is used to refer to the message received using a telegraph. The code used on a telegraph machine to send a telegram is called Morse code, named after the inventor.
Morse invented the telegraph in 1832. While there had been earlier attempts to create a similar machine that could send messages long distances, Morse's machine was the first successful one. He sent the famous message "what hath God wrought" in 1844 from Washington, D.C., to Baltimore, Md. Morse was not alone in his invention as he had an assistant named Alfred Vail. Vail, and later Leonard Gail, helped Morse refine his machine.