Automatically apply template/ clone webflow site through hybrid app

I’m creating a hybrid app and in order for the app to provide its functionality, the user needs to have a specific website structure and elements. I’ve created this webflow site which I can publish on the “Made in Webflow” page or on the template marketplace. I’m trying to find a way to automatically apply the template or clone the website for the user through the app. I couldn’t find any relevant API in the docs. Please note that I’m aware that I can use the API to create pages and the required elements but that seems very cumbersome at the moment and I’m trying to find an alternative.

You could look into the possibility of populating the clipboard with your structure and then triggering a paste.

Can you please elaborate your approach?
Here’s what I understood: First, I’ll need to write the HTML and CSS for the webflow template website I’ve built. Then, the app populates the user’s clipboard with the HTML and then triggers a paste on the user’s designer. Is my understanding correct?

No. If you’re familiar with how component libs like Relume work, they use Webflow’s undocumented clipboard format to capture HTML/CSS from one site and transfer it to another. The same as if you copy pasted between two designer windows showing two different sites.

If your script can push content to the clipboard, and trigger a paste keyboard sequence, then you may be able to short circuit the entire element-by-element build process.

I did not know that. Thanks a lot for sharing.
I’ve been experimenting with this over the past few days and I was able to replicate the copy function of these libraries but the automatic pasting part seems to be the roadblock here. Webflow apps are hosted inside an iframe which doesn’t have access to the designer window. The only option we have to interact with the designer is the “webflow object”. But, it doesn’t provide any method to execute events inside the designer. Any ideas on how to get this to work?

Webflow doesn’t offer an API to automatically clone or apply a template to a user’s account, but a workaround is to provide users with a “Clone” link to your Webflow project hosted on the “Made in Webflow” page. You can automate onboarding by guiding users to click the link and duplicate the project in their account. If deeper automation is required, consider using Webflow’s CMS and API to programmatically create necessary elements after setup, or explore third-party automation tools like Zapier or Make to streamline the process.

Again this is all theoretical, I haven’t tried this with Webflow Apps- but if there are no API functions to paste from clipboard, you’d look for a way to inject script into the designer. That may be possible or it may be specifically restricted and difficult to do, but your goal is to be able to focus the designer and send a paste sequence.

My guess is this shortcut is not going to be easy or clean, and there’s even a chance that if you succeed, it could prevent the app from passing acceptance checks.

Have you contacted support yet to see what the official options are?

Hi Fiza, Guiding the users to clone my website is the backup plan, but that doesn’t seem like a good UX. I didn’t want to use the API to manually create each element because that seems like a lot of work for an MVP. Do you have any experience with the ‘Bulk Add Elements’ API?

Hi Michael, I haven’t contacted support yet. I posted it here to find out if someone had already done it. Your idea of using the clipboard format came really close… But you’re right, even if I get it working, it probably won’t get approved. So I guess my best bet is to make the template cloneable for now and later I can write the code to create the elements programmatically.