How to safely use TRRS socket in order to transfer signal
simulate this circuit &ndash; Schematic created using CircuitLab

Figure 1. A traditional connection.

Assuming the socket is on the powered device (rather than on the keyboard) the traditional approach seems best to me. 


You need to be confident that you can short TX to +5V without damage. If that's OK then, as shown in Figure 1, nothing bad can happen until the tip reaches the +5V tip. 
As it does so it may short TX to +5V. 
It may also apply the +5V to the keyboard before the ground connects. If this happens the whole keyboard will be at +5V and so +5V may come back on the RX.
Possibly the worst case is +5V connected, GND not connected and TX driven low. You'll need to check if the circuitry can tolerate that.