Who created the telegraph? In what year?
Joseph Henry (1797-1878) discovered the principles upon which the telegraph was built; at one point, he had constructed a working system that covered a mile's distance, this in the early 1830's. Morse modified the basic invention and made it commercially viable by the late 1840's. Like many inventions of the 19th century, the theorist sadly does not get the credit for developing the principles upon which the invention rests, even if they create a working prototype, as this tends to be overshadowed by the invention's widespread application by the businessman. Similarly, radio (wireless) which was invented by Tesla, is usually remembered as having been invented by Marconi, who made critical improvements many years later to enable a commercial success.
Samuel Morse and Alfred Vail are credited with developing the electrical telegraph in 1837, that was first tested in January of 1838. Morse had developed the technology while Vail had developed the alphabet system used to transmit messages. Though earlier people had developed telegraph systems that could transmit signals over the lengths of a few meters, it wasn't until Samuel Morse came along to make it widespread and commercially viable. This is very common with many early inventions. It is the person who makes a commercially productive invention that gets the credit.