How to add a button to nextcloud office document editor

I have a collabora CODE server running and a next cloud 25 installation, and I have the two connected fine via the richdocuments app.

I’d like to add my own button to the Write or calc interfaces to pull data in from a custom data source.

Could someone give me a pointer as to where/how best to add that.

I am happy enough writing JS/Python/PHP to be able to create the code I need, but I’m not sure where best to include in within the “framework” of the integration.

Is it something I have to create and define on the next cloude side of the fence?
Is it something I should create on my CODE server?
If on the CODE server is there something I need to do to get next cloud to recongnise it in the interface.

I’ve started going through the repo’s but if someone could give me a pointer it’d would be much appreciated.