Links:
https://www.codemeetsnocode.com
Use the code
//Define input variables
let record = input.config();
console.log(record);
//CREATE A LIVE ITEM (Adjust fields to work for you)
let webflowAPIcall = await fetch (`https://api.webflow.com/collections/[Collection ID]/items?live=true`,
{
method: 'POST',
body: JSON.stringify({
fields: {
"name": record.name,
"airtable-id":record.airtableId,
"hero-title":record.heroTitle,
"hero-description":record.heroDescription,
"_archived":false,
"_draft":false
}
}),
headers:{
'Content-Type':'application/json',
'Authorization':'Bearer [API KEY]',
'accept-version':'1.0.0'
}
});
console.log(webflowAPIcall);
let response = await webflowAPIcall.json();
console.log (response);
//Define output set
output.set ('Webflow Item ID', response["_id"]),
output.set ('Slug', response.slug),
output.set ('Status', webflowAPIcall.status)
output.set ('Value', webflowAPIcall.statusText)