Telegraph refers to the technology and the communications system. A telegram is a message sent via telegraph.
Though both words are used as verbs meaning to send a telegram, telegraph is more common in this use. Telegraph is also used figuratively to mean to make known in advance or unintentionally. The technology may be obsolete, but these words still appear in historical writing, and the figurative sense of telegraph is still going strong.
Examples
Literal uses
The telegraph, after all, changed everything when it was popularized in the 1840s. [Los Angeles Times]
But in a telegram sent in the summer of 1918, Lockhart appears to discuss the possibility of an assassination with Lord Curzon. [Daily Mail]
While ostensibly working in 1875 on a device to send multiple telegraph signals over the same wire by using harmonics, he heard a twang. [Wired]
Shortly after the announcement of the birth, telegrams and gifts began arriving for Princess Margaret. [New York Times]
Figurative use
Manager Mike Quade officially named Wells as the fourth starter, a move that had been telegraphed for two weeks. [Chicago Tribune]
Then go over it, and reduce the chances of an interception by not telegraphing the pass in any way. [Guardian]