Is it possible to run n8n in iframe?

Is it possible to run n8n in an iframe?
can I control permission so I can decide if the workflow is editable or view-only for a specific user?
do we have API that can download workflow JSON, load JSON, And more?

I don’t see why you can’t put the execution result in an iframe that will be ready only, but I’m confident it cant be done by different users yet, as n8n doesn’t support that, just yet.

because I want to give to my employee that supports customers, to only view the workflow and not edit

You could load n8n in an iframe but it is going to do what you are after.

Even if you can stop the user from interacting with the iframe itself you would need to embed the credentials as well, it would take a couple of seconds to view the page source then extract the credentials.

If you just want users to be able to view the workflow you could take a screenshot of the flow and show that unless you want users to be able to interact with it as well.

Best bet would be to wait for the user management feature to come in.

1 Like

why do I need to embed the credentials?
is it possible to inject all the UI of Nathan’s to HTML without an iframe?

@Asaf_Shay you are right I made an assumption that you have your n8n instance behind the basic authentication option which may not be the case as if you were when you try to load your iframe it would ask the user to login leaving the only workaround on that approach to embed the credentials in the URL so https://user:[email protected] which has the problem I was referring to.

You could inject the UI if you saved the pages contents as HTML and loaded that but I suspect what you really want is an option to convert the JSON to the same UI view at the moment I can’t think of an easy way to do this but it might be worth keeping an eye on this: GitHub - n8n-io/discourse-n8n-wf: Discourse plugin for pretty rendering of n8n workflow code

It looks like the n8n team are working on a Discourse plugin to render the JSON to the same view you get in the editor which would do what you are after.

1 Like

not working, after I save as HTML it open blank page

“is an option to convert the JSON to the same UI view”

In that case you would need to write your own conversion system or pull the bits out of the n8n code to handle it.

That Discourse plugin is extremely cool. It’s cool that it renders the workflow without really being connected to a particular n8n instance. Great for illustrating what’s going on.

1 Like

I took a look at the code and can’t figure out where the n8n-demo markup is implemented.

<n8n-demo workflow='${encodeURIComponent(JSON.stringify(json)).replaceAll("'", '%27')}' frame=true ></n8n-demo>