Webflow API "Hello World" Example (Windows/Node js/Visual Studio)

No way to find “simple” API example out there.

Step 1 - Set up node.js & NPM (Google it).
node.js

Step 2 - Create folder
Create folder Webflow_API_Hello_World
image

Step 3 - Install Webflow API package
visual studio code editor => Terminal Inside this folder & Install the package via NPM or YARN:

npm install --save webflow-api

image

Step 4 - Get API TOKEN

Webflow side

Webflow Setting => Get API token

Get your website id

One way - open some hosted file:
image

Step 5 - Run app.js
Create app.js file and run some examples from here:
https://developers.webflow.com/

Example [1] Get Site name:

const api_token = "116127120864ecb987a6350ad903041942a9c1fd686f7059b9f609ecbdb0811e";
const siteId = "61bea8a5f91134eaccf6623e";
/* webflow API */
const Webflow = require('webflow-api')
const webflow = new Webflow({ token: api_token });

// Promise <Get Site Name>
const site = webflow.site({ siteId });
site.then(s => console.log(s.name));

Run:
image

Output:


** api_token value must be private/hidden on your server.

Full docs:

Realted: Zapier / integromat

Tools like Zapier -or- integromat cut the need of custom code in most cases (Generate Webflow CMS item when X happens).

Zapier “hello world” API example