Add ServiceTask to Palette at runtime

Hello! I’m developing a plugin for Camunda modeler. Basically, my plugin shows a modal letting the user input a rest endpoint, then, through a “Discover” button, it fetches some records from the configured rest endpoint, then it should iterate the records to add ServiceTasks to the palette for each record found.

So far I’m able to show the modal, save the rest endpoint in the config file, and fetch the records from the rest endpoint. But I can’t find a way to add ServiceTasks to the Palette dynamically (when the user clicks the “Discover” button).

I found some tutorials to add ServiceTasks to the palette but these are added when the plugin is first registered:

Thanks in advanced