Skip to main content
Question

Integration with AI to be able to analyze and provide insights of the data in the bases


Forum|alt.badge.img+3

Hi Community

 

I have created my bases to keep track of our cold email campaigns. Now I have a lot of data that I would like analyzed as much as possible in an automated way. Can you suggest a workflow where I can have AI go trough the data and provide a summary of all the content of the base as well as suggestions for optimization.

As an example I would need AI to analyze all 500+ replies that have been received, shortlist the personas that show the most interest, the messaging that works best, what industries are the most engaged. I have tested 2 approaches thus far:

  1. I have created a custom prompt indicating exactly what I need to happen using the AI feature of Airtable. This is the response I get 
  2. I have also tried using Data Fetcher to integrate with Open AI but it suggest messaging rather than analyzing the information

 

2 replies

Forum|alt.badge.img+1
  • Participating Frequently
  • 5 replies
  • April 2, 2025

• Run the automation whenever a new reply is added.

• The AI-generated analysis will be saved in the “AI Insights” field.

• You can extend this script to classify industries, job titles, and messaging effectiveness.
 

let table = base.getTable("Email Replies"); // Change this to your actual table name or table id
let query = await table.selectRecordsAsync();
let apiKey = "your_openai_api_key"; // Get your OpenAI API key from platform.openai.com

for (let record of query.records) {
    let replyText = record.getCellValue("Reply Message");

    if (!replyText) continue; // Skip empty replies

    let prompt = `Analyze this email reply. Categorize as Interested, Neutral, or Not Interested. Extract key objections and suggest improvements:
    Email Reply: "${replyText}"`;

    let response = await fetch("https://api.openai.com/v1/chat/completions", {
        method: "POST",
        headers: {
            "Content-Type": "application/json",
            "Authorization": `Bearer ${apiKey}`
        },
        body: JSON.stringify({
            model: "gpt-4", // Use gpt-4 or gpt-3.5-turbo
            messages: [{ role: "system", content: "You are an email marketing analyst." }, 
                       { role: "user", content: prompt }],
            temperature: 0.3
        })
    });

    let data = await response.json();
    let aiAnalysis = data.choices[0]?.message?.content || "No analysis available";

    // Update Airtable with the AI-generated insights
    await table.updateRecordAsync(record.id, {
        "AI Insights": aiAnalysis
    });
}

output.set("AI Analysis Completed & Saved in Airtable");

 


Forum|alt.badge.img+3
  • Author
  • New Participant
  • 4 replies
  • April 3, 2025

@Sannit Vartak thanks for this. I have tested out this script, but it does not run results. I have set up to update every Monday. Can this be the root cause why I am not seeing the result. Just as a pointer - the tests I run of the script do not produce errors, but they do not output a result either. Eventually the test results in: ”Script exceeded execution time limit of 120 seconds”. What am I doing wrong:

let table = base.getTable("Email Replies"); 

let query = await table.selectRecordsAsync();

let apiKey = "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";

 

for (let record of query.records) {

    let replyText = record.getCellValue("Status");

    let copyStep = record.getCellValue("Copy Step");

    let copyVersion = record.getCellValue("Copy Version");

    let headcount = record.getCellValue("Head Count");

    let industry = record.getCellValue("Industry");

    let jobTitle = record.getCellValue("Prospects Job Title");

    let campaignName = record.getCellValue("Campaign Name");

 

    if (!replyText) continue;

 

    let prompt = `Analyze email campaign performance based on responses received. Identify top-performing and underperforming elements:

    

    - Copy Step: ${copyStep}

    - Copy Version: ${copyVersion}

    - Head Count: ${headcount}

    - Industry: ${industry}

    - Prospects Job Title: ${jobTitle}

    - Campaign Name: ${campaignName}

    - Status: "${replyText}"

    

    Key insights required:

    1. Determine if this reply is Interested, Maybe Later, Neutral, or Not Interested.

    2. Identify which copy versions, steps, industries, and job titles drive the highest positive engagement.

    3. Highlight what elements contribute to negative responses.

    4. Recommend optimizations to improve future campaign success.`;

 

    let response = await fetch("https://api.openai.com/v1/chat/completions", {

        method: "POST",

        headers: {

            "Content-Type": "application/json",

            "Authorization": `Bearer ${apiKey}`

        },

        body: JSON.stringify({

            model: "gpt-4",

            messages: [

                { role: "system", content: "You are an advanced email marketing analyst." },

                { role: "user", content: prompt }

            ],

            temperature: 0.3

        })

    });

 

    let data = await response.json();

    let aiAnalysis = data.choices[0]?.message?.content || "No analysis available";

 

    await table.updateRecordAsync(record.id, {

        "AI Insights": aiAnalysis

    });

}

 

output.set("Email Campaign Analysis Completed & Saved in Airtable");


Reply