Streaming live at 10am (PST)

Accessing CMS through Javascript Embed Block

Hi everyone,

How do I access my collection and loop through them in the Javascript Embed Block?

Should I approach this through JQuery or Webflow API. If I use Webflow API, I’m stuck when I add
const Webflow = require(‘webflow-api’); //Probably due to require

What is the best route?

You don’t. CORS will block you and you would be exposing your API credentials anyway. Spin up an express server and build out your own API on with Node. You could also look at XANO as an option but you would need to import your data.

@Ray_Lee you’re not allowed to use the Javascript API from the client (web browser), Webflow prevents this.

The typical approach is to use a “glue service” to create, read, update, or delete your CMS info.

If you use Integromat, you can simply return your CMS info via the “Webhook Response” module. You’ll need to have some custom Javascript code display that to the screen, but that’s fairly common and you should be able to find some existing examples to get you started.

The tricky bit is knowing “which” CMS item you’d like to use.

Unfortunately Webflow only allows you to get CMS items by their autogenerated “item id”.

To get past that, the typical approach is to use Lookup Tables. If this whole process is of interest to you, here’s a tutorial that I’ve written in the past to help: