How can I programmatically generate nodes in a flow?

I've done a search and the answer is pretty much no but in the spirit of the truly lazy programmer I will again ask! :wink:

I know you must hate this question but I'm interested in adding a set of nodes (mqtt topic and a button). I can build a json template file of the 3 nodes from an existing node set. Modify the json so it's easy to regexp but the tricky part is adding it to an existing flow (or a new flow if that's easier) then deploying it, all programmatically.

Are there any APIs for the node editor that would allow me do to this?

Perhaps just a way to programmatically add a new flow to the existing flows file and then manually deploy?