The telephone was patented by Alexander Graham Bell in 1876 and its setup is way more complicated that I’ve previously thought. It isn’t just a simple rope/wire with some cups at the ends. It involves a battery, water, wires and a drum too.
How did the first telephone work? You needed a battery from which current would flow into a liquid. From that liquid the current would flow through a rod wire that was attached to a drum and then trough a wire attached to that rod. From there on the current would flow to a receiver, an electromagnet, where the sound was replicated.
Basically, when Bell spoke into the mouthpiece the air vibrated and then made the drum vibrate too. The rod attached to the drum would enter in the liquid thus affecting the flow of current through it. Since there was a difference in the current flowing in the wire the electromagnet at the receiving end would generate different types of vibrations in the drum that was used in that receiving end. Thus sound was created.