GPT3 AI Content from Airtable to Webflow
🤖

GPT3 AI Content from Airtable to Webflow

Created
Dec 6, 2022 02:55 PM
Tags
Status
Updated: 9 Apr 2024
I am no longer using the Airtable script. I have resorted to copy pasting content from Claude or ChatGPT into the Airtable table, and then triggering the Zapier flow to Webflow
 
notion image
 

YouTube Video

Video preview

Steps

  1. Create accounts
  1. For Semi-automated
    1. Script code (original)
      Script code (modified) for multiple lines
      let str = data.choices[0].text;
  1. For Fully automated
      • Upgrade to Pro Plan of Airtable
      Script code for “Run as script”
      // Change this to the name of a table in your base let table = base.getTable('Resume Keywords'); let view = table.getView('Generate Content'); let openaiUrl = "https://api.openai.com/v1/engines/text-davinci-003/completions"; let inputConfig = input.config(); let pageName = table.getField("Page Name"); console.log(pageName,"Page Name") let results = await view.selectRecordsAsync({fields: table.fields}); console.log(results,"Results") for (let record of results.records) { let pageName = record.getCellValue("Page Name"); console.log(pageName,"Page Name 1") // Construct the body // Change the field name to match yours. let keywords = { "prompt": "List down 10 " + pageName + "\n\nskill keywords separated by commas", // "prompt": "List down 10 " + record.("Page Name") + "\n\nskill keywords separated by commas", "temperature": 0.7, "max_tokens": 512, "top_p": 1.0, "frequency_penalty": 0.0, "presence_penalty": 0.0 } console.log(pageName,"Page Name") // Make a request to OpenAI API // Add your own API key in the place of Xses. let response = await fetch(openaiUrl, { method: 'POST', body: JSON.stringify(keywords), headers: { 'Content-Type': 'application/json', 'Authorization': 'Bearer xx', }, }); let keyData = await response.json(); // Comment this out if you don't want to see any outputs console.log(keyData) let str = /[^A-Za-z0-9](.+)/.exec(keyData.choices[0].text)[1]; // for multi-line output use the below //let str = keyData.choices[0].text; // Write to a cell, change field name to match your table. await table.updateRecordAsync(record,{ 'Resume Keywords': str,}); }
 
Follow me on Twitter @kavirkaycee
Subscribe on YouTube youtube.com/@kavirkaycee
 
If you liked this post, subscribe to my newsletter: