NodeOSC for controlling nodes via OpenSoundControl

Hello,
I found a way to record keyframes with the data coming in from OSC handler (nodeOSC) using keyframes_insert

For example, for location I create 2 osc handler

1: for create keyframes
address: /objects/Cube/location
datapath: bpy.data.objects[‘Cube’].keyframe_insert(“location”, frame=bpy.context.scene.frame_current)

2: for route incoming message:

address: /objects/Cube/location
datapath: bpy.data.objects[‘Cube’].location

also works with shader nodes:

address: /materials/caja/nodes/Principled_BSDF/inputs/0/default_value
datapath: bpy.data.materials[‘caja’].node_tree.nodes[“cajaMat”].inputs[0].keyframe_insert(“default_value”,frame = bpy.context.scene.frame_current)

address: /materials/caja/nodes/Principled_BSDF/inputs/0/default_value
datapath: bpy.data.materials[‘caja’].node_tree.nodes[“cajaMat”].inputs[0].default_value

(I think it should work with any other property that can be animated)

If you know of a more efficient way to do this please tell me.