Adding inline code from within an app

Hi everyone!
I am hitting a roadblock and wanted to check if anyone is able to help.

I am trying to build the following:

  • user opens my app
  • user clicks on an element inside the designer
  • user clicks on a button within my app
  • a custom code is generated either inline or in the current page

The issue:

  • In order to add custom code blocks you seed the site_id
  • in order to get the site_id you need a user token
  • Even if I ask the user for the token then I need to ask the user to select the site.

Is there any way to pass the current site_id (where the user has installed the app) into the app?
Maybe I am missing something
Any help will be appreciated, thanks!

Hey @yakito!

To confirm, are you wanting to add custom code to the page canvas or via the data api?

You could add a script element using the Designer API. May not by ideal for your use case.

Otherwise you will need to create a Hybrid App.

You can also get the site information using the webflow.getSiteInfo() call: The Webflow Object