In a mesh network like SmartThings, this will happen automatically provided
both devices are the same protocol (Zigbee talks only to Zigbee, zwave talks only to zwave)
both devices have been successfully paired to the same hub
the devices are within one hop of each other (typically about 40 feet in a house with wooden walls)
at least one of the two devices is mains-powered (not battery powered)
the network’s address tables are all up to date
if one of the devices is a zwave lock, the other must support beaming
That’s all there is to it.
You don’t have to do anything – – when a device wants to send the message, it will check its address table to find a nearby neighbor that can relay the message if needed.
Where most people mess up is in pairing devices close to the hub and then moving them someplace else but not doing anything to update the address tables. Or in thinking that a battery-powered device can repeat for another battery-powered device.
But if you just check the six points above, everything happens automatically.