Adding an HTMLEmbed type element with Designer Extension API

I’m trying to set or access the “Code Embed settings” for an HTMLEmbed element with the Designer API v2. I can create a new Code Embed and set it’s styles, but I can’t figure out what property or method exposes updating the code that will render that’s found in “Code Embed settings” in the UI??

I’m using the preset element: webflow.elementPresets.HtmlEmbed

Is this accessible via the API or am I wasting my time trying to build an app that can insert a custom HTMLembed element?

Hey @immber, great question! Sorry for the late reply here, and welcome to the community!

Right now, we don’t publicly expose a way to set an HTMLEmbed’s code content via the Designer APIs. The preset creates the container and Webflow-native element for an HTMLEmbed, so that if added via the Designer API in your app, the end-user could go into that HTMLEmbed element and edit the Code Embed settings via the Designer UI. We do have plans to create custom code via Designer APIs on our roadmap, but we’re still discussing security considerations around this feature.

The recommended way to add custom code would be through the Data APIs here: where your backend would call into the registered_scripts endpoint to add either inline or your own hosted code. This means your app would need to be a Hybrid App if you still want to have a Designer Extension as part of your Webflow App experience.

Can you maybe explain then, how to work with custom code applied to site?

I made everything accordingly to instruction
Registered script and then added it to site

Everything works fine if website is published to webfolw free domain
when code is exported, my registeredHostedScript is not included in the code, how to fix that?
Because I don’t see a reason to not include custom code in the exported html …