build first ai automation

Building Your First AI Automation

๐Ÿ“˜ ai-automation-academy · Part 4 of 15 · Module 1 · Foundations
A free, step-by-step course on buying, selling & trading domains. View the full series →
Building Your First AI Automation
Key takeaways
  • Lead enrichment is an ideal first automation
  • Always add retry logic and JSON validation
  • Cost per lead is negligible with mini models
  • Both no-code and Python approaches work โ€” choose by team skill

Understanding build first ai automation is the foundation of this guide. Below we break it down step by step so you can act with confidence.

Time to build. This lesson walks you through creating a complete AI automation โ€” a lead enrichment pipeline that takes a company name and returns structured data about the business.

You will build it twice: once with no-code in Make.com, once with Python, so you can compare both approaches.

Build First Ai Automation: The Project: AI Lead Enrichment

When a new lead enters your CRM, you want to automatically:

  1. Take the company name and domain
  2. Use AI to research and summarize what the company does
  3. Extract industry, company size estimate, and potential needs
  4. Write the enriched data back to your CRM

This saves 5-10 minutes per lead and runs 24/7.

No-Code Build with Make.com

๐Ÿ”ฌ Demo: Lead Enrichment Scenario

Step-by-step Make.com setup:

  1. Create a new scenario. Add Webhooks โ†’ Custom Webhook as trigger
  2. Add HTTP โ†’ Make a Request to fetch the company homepage (GET the domain URL)
  3. Add OpenAI โ†’ Create Chat Completion with this system prompt:
  4. Add a JSON โ†’ Parse module to extract the structured fields
  5. Add your CRM module (HubSpot/Airtable/etc.) to update the record
System Prompt for the OpenAI module:
You are a B2B analyst. Given a company's homepage HTML, extract:
- industry (string)
- employee_estimate (string: "1-10", "11-50", "51-200", "201-500", "500+")
- summary (2 sentences about what they do)
- potential_needs (array of 3 services they might buy)

Reply ONLY with valid JSON, no markdown.

Test by sending a POST to your webhook URL with {"company": "Stripe", "domain": "stripe.com"}

Python Build

๐Ÿ”ฌ Demo: Lead Enrichment Script
import openai, os, json, requests
from bs4 import BeautifulSoup

client = openai.OpenAI(api_key=os.environ["OPENAI_API_KEY"])

def enrich_lead(company: str, domain: str) -> dict:
    # 1. Fetch homepage text
    try:
        resp = requests.get(f"https://{domain}", timeout=10, headers={"User-Agent": "Mozilla/5.0"})
        soup = BeautifulSoup(resp.text, "html.parser")
        text = soup.get_text(separator=" ", strip=True)[:3000]
    except Exception:
        text = f"Could not fetch {domain}"

    # 2. AI analysis
    completion = client.chat.completions.create(
        model="gpt-4o-mini",
        messages=[
            {"role": "system", "content": """You are a B2B analyst. Given company info, return JSON:
{"industry": "...", "employee_estimate": "...", "summary": "...", "potential_needs": ["...", "...", "..."]}
Reply ONLY with valid JSON."""},
            {"role": "user", "content": f"Company: {company}\nDomain: {domain}\nHomepage text: {text}"}
        ],
        temperature=0.3,
        max_tokens=300
    )

    # 3. Parse structured output
    return json.loads(completion.choices[0].message.content)

# Test it
result = enrich_lead("Stripe", "stripe.com")
print(json.dumps(result, indent=2))
# {
#   "industry": "Financial Technology",
#   "employee_estimate": "500+",
#   "summary": "Stripe builds payment infrastructure for the internet...",
#   "potential_needs": ["enterprise security", "compliance tools", "developer training"]
# }

Explore Crypto Trading

Cryptocurrency trading is one of the fastest-growing financial markets โ€” open 24/7, globally accessible, and full of opportunity for those who learn the fundamentals first.

  • Trade spot, futures & copy-trading on one platform
  • Start with as little as $10 โ€” practice risk-free on the testnet
  • Built-in TradingView charts, grid bots & DCA tools

Free Crypto Trading Academy → ยท Domain Trading Academy →

Adding Error Handling

Production automations need error handling. Here is the hardened version:

import time, json, openai

def enrich_with_retry(company: str, domain: str, retries: int = 3) -> dict:
    for attempt in range(retries):
        try:
            result = enrich_lead(company, domain)
            # Validate required fields
            assert all(k in result for k in ['industry', 'summary', 'potential_needs'])
            return result
        except json.JSONDecodeError:
            print(f"Attempt {attempt+1}: AI returned invalid JSON, retrying...")
            time.sleep(2 ** attempt)
        except openai.RateLimitError:
            wait = 2 ** (attempt + 2)
            print(f"Rate limited, waiting {wait}s...")
            time.sleep(wait)
        except Exception as e:
            print(f"Attempt {attempt+1} failed: {e}")
            time.sleep(2 ** attempt)

    return {"error": "enrichment_failed", "company": company}

WSOT 2026: Squad Leader Slots Are Open โ€” Up to $128,000 per Leader

Join Now

Connecting to Your CRM

Push the enriched data to your CRM via API:

import requests

def update_crm_lead(lead_id: str, enrichment: dict):
    """Example: update a HubSpot contact with enriched data."""
    requests.patch(
        f"https://api.hubapi.com/crm/v3/objects/contacts/{lead_id}",
        headers={"Authorization": f"Bearer {os.environ['HUBSPOT_KEY']}"},
        json={"properties": {
            "industry": enrichment.get("industry", ""),
            "company_size": enrichment.get("employee_estimate", ""),
            "ai_summary": enrichment.get("summary", ""),
        }}
    )

When evaluating build first ai automation, start with the fundamentals: what problem it solves, who it serves, and how it compares to the alternatives buyers consider first.

Start with the fundamentals. Define who you are serving, the single outcome you want, and the budget you are comfortable committing before you compare any options.

A practical rule is to favour clarity over cleverness. The choice that is easiest to understand, spell, remember and act on tends to win over the long run.

Context changes the answer. What is optimal for a fast-moving startup is rarely optimal for an established brand, so weigh your own stage, market and ambitions.

Avoid the common mistakes: rushing the decision, copying competitors blindly, and ignoring the total cost of ownership beyond the very first year of use.

Think in terms of trade-offs rather than a single perfect answer. Every option trades memorability, cost, reach and flexibility in a slightly different mix.

Document your reasoning. Writing down why you chose one path makes it far easier to revisit the decision later and to explain it to partners and investors.

Test with real people. A quick check with a handful of your actual customers will surface problems that no amount of internal debate ever reveals.

Plan for growth. The option that fits today should still make sense when your audience, catalogue or team is several times larger than it is right now.

Frequently asked questions

How much does this cost per lead?

About $0.001-0.003 per lead with GPT-4o-mini. At 1,000 leads/month, that is roughly $3.

Can I use Claude instead of OpenAI?

Yes. Replace the openai client with the anthropic client. The prompt structure is nearly identical.

What if the company website is behind a login?

The script falls back gracefully. AI still generates useful output from just the company name and domain.

Free Courses โ€” Learn New Skills

No sign-up · No fees · Learn at your own pace

Start Trading

Trade crypto and premium domains โ€” digital assets with real opportunities.

Find your name on Atom

DominantBrand curates the best premium, brandable names from Atom.com — the marketplace with a free AI appraisal, a USPTO trademark check, and secure escrow. Every listing even ships with a designed logo.

Browse Domains