Complete System · Step by Step

Jewelry Business
AI Automation

Daily market research, top trends, 20 B2B leads + cold emails + follow-ups — fully automated using Claude AI. Runs every morning while you sleep.
6 AM
Daily auto-run
20
B2B leads/day
5+
Trend insights
3
APIs needed
System Overview

What This Automation Does Every Day

1
6:00 AM
Market Research (Auto)
Searches Google Trends, Reddit r/jewelry, industry news for today's top jewelry trends. What's selling: gold chains, lab diamonds, bridal sets, etc.
2
6:05 AM
Claude Analyzes & Ranks
Claude AI reads all research and outputs: Top 5 products to stock today, top 3 trends, what's NOT selling, pricing signals from competitor data.
3
6:10 AM
Lead Generation (20 B2B Leads)
Finds jewelry retailers, boutiques, wedding planners, hotel gift shops from India Mart, LinkedIn, Justdial. Extracts name, email, company, location.
4
6:15 AM
Personalized Emails Written by Claude
Claude writes a unique cold email for each lead — mentions their business type, references today's trending products, includes your catalog link.
5
6:20 AM
Gmail Sends All Emails
All 20 emails automatically sent from your Gmail. Each lead logged in Google Sheets with sent date, email content, follow-up date.
6
Day 3 & Day 7
Auto Follow-ups
If no reply after 3 days, Claude writes a gentle follow-up. Day 7: final follow-up with a special offer. Replied leads are automatically removed from queue.
Step 1 — Environment

Install Everything First

Complete these in order. Each step takes 5–15 minutes. Check off as you go.
1
Install Python 3.11+
Free
Why Python?
Python is the language all our scripts are written in. It runs Claude API, Gmail, web scraping — everything.
WINDOWS
# Go to python.org/downloads → download Python 3.11
# During install: CHECK "Add Python to PATH" box

# Verify install — open Command Prompt and run:
python --version
# Should show: Python 3.11.x
MAC
# Open Terminal and run:
brew install python@3.11
python3 --version
Python installedpython --version shows 3.11+
pip workingpip --version shows a version number
2
Install VS Code (Code Editor)
Free

VS Code is where you'll write and run your Python scripts. Download from code.visualstudio.com

After Install — Open Terminal in VS Code
# In VS Code: View → Terminal
# Create your project folder:

mkdir jewelry_ai_system
cd jewelry_ai_system

# Create virtual environment (keeps libraries clean):
python -m venv venv

# Activate it:
# Windows: venv\Scripts\activate
# Mac/Linux: source venv/bin/activate

# You'll see (venv) in your terminal — good!
3
Install All Required Libraries
Terminal
requirements.txt — Create this file first
anthropic==0.34.0
google-auth==2.28.0
google-auth-oauthlib==1.2.0
google-api-python-client==2.120.0
requests==2.31.0
beautifulsoup4==4.12.3
gspread==6.0.2
python-dotenv==1.0.1
schedule==1.2.1
pandas==2.2.0
TERMINAL — Run this command
pip install -r requirements.txt
What each library does
anthropic → Talk to Claude AI
google-api-python-client → Send emails via Gmail
gspread → Write data to Google Sheets
beautifulsoup4 → Scrape websites for leads
schedule → Run script automatically every day
python-dotenv → Keep API keys safe in .env file
4
Create .env File (Store API Keys Safely)
Security
IMPORTANT: Never put API keys directly in code
Always store them in a .env file. Never commit .env to GitHub. Add .env to .gitignore file.
.env FILE — Create in your project folder
# Copy this, fill in your actual keys

ANTHROPIC_API_KEY=sk-ant-api03-XXXXXXXXXXXXXXXXXXXXXXXXXX

GMAIL_SENDER_EMAIL=yourname@gmail.com

SERPAPI_KEY=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

GOOGLE_SHEETS_ID=1BxiMVs0XRA5nFMdKvBdBZjgmUUqptlbs74OgVE2upms

YOUR_COMPANY_NAME=Sharma Jewellers
YOUR_CATALOG_URL=https://yourwebsite.com/catalog
YOUR_PHONE=+91-9876543210
YOUR_CITY=Jaipur
.gitignore FILE — Create this too
.env
venv/
__pycache__/
*.pyc
credentials.json
token.json
Step 2 — API Keys

Get These 3 APIs (Takes ~30 Minutes Total)

You need exactly 3 APIs. Two are free, one has a small cost. Follow each card's steps exactly.
Claude API (Anthropic)
  • Go to console.anthropic.com
  • Sign up with email
  • Go to "API Keys" in sidebar
  • Click "Create Key" → copy it
  • Add billing ($5 prepaid to start)
  • Paste key in .env as ANTHROPIC_API_KEY
Go to console.anthropic.com →
Gmail API (Google)
Free — 500 emails/day
  • Go to console.cloud.google.com
  • Create new project "JewelryAI"
  • Enable "Gmail API" in Library
  • Create OAuth 2.0 credentials
  • Download credentials.json file
  • Put credentials.json in project folder
Go to Google Cloud Console →
🔍
SerpAPI (Google Search)
Free 100 searches/month
  • Go to serpapi.com
  • Sign up free (100 searches free)
  • Dashboard → copy API Key
  • Paste in .env as SERPAPI_KEY
  • Used for market research automation
Go to serpapi.com →
📊
Google Sheets API
Free — store all data
  • Same Google Cloud project as Gmail
  • Enable "Google Sheets API" in Library
  • Create a Google Sheet for leads
  • Copy the Sheet ID from URL
  • Share sheet with your service account email
  • Paste Sheet ID in .env
Create Google Sheet →
Gmail Setup — Extra Steps (One Time Only)
After downloading credentials.json, run your script once. It will open a browser asking you to approve Gmail access. Say yes. This creates a token.json file that remembers permission forever. After this, Gmail sends automatically without any browser popup.
Step 3 — Claude Prompts

Exact Prompts to Use (Copy As-Is)

These are the exact system prompts that go into the Python code. Tested and optimized for jewelry business.
📈 Prompt 1 — Daily Market Research Analyst System Prompt
You are an expert jewelry market research analyst specializing in the Indian jewelry industry. You have deep knowledge of: - Indian jewelry trends (gold, silver, kundan, polki, diamond, gemstone) - B2B jewelry wholesale market in Jaipur, Mumbai, Surat, Delhi - International jewelry trends from Dubai, Italy, USA that affect Indian market - Seasonal demand patterns (wedding season, festivals, export demand) Today's date: {TODAY_DATE} When given raw search results and news data, you will: 1. Extract the TOP 5 trending jewelry items right now (with specific details — e.g. "22kt yellow gold mangalsutra with black bead, 8-10g weight") 2. Identify what is NOT selling and should be avoided 3. Note any price movement in gold/silver/gemstones 4. Spot 2-3 emerging trends to watch next week 5. Give a "Today's Opportunity Score" out of 10 for B2B sales Output format: Clean JSON with keys: trending_items, avoid_items, price_signals, emerging_trends, opportunity_score, daily_summary
👥 Prompt 2 — B2B Lead Qualifier System Prompt
You are a B2B sales intelligence expert for a jewelry manufacturer in Jaipur, India. Your job is to analyze raw lead data (business names, websites, descriptions) and qualify them as potential buyers for wholesale jewelry. Good leads are: - Jewelry retailers with physical stores (especially in Tier 1 and Tier 2 Indian cities) - Boutique fashion stores that sell accessories - Wedding planners who source jewelry for clients - Hotel gift shops and luxury retail - Online jewelry sellers (Etsy, Amazon stores, Meesho sellers) - Export buyers from UAE, USA, UK Poor leads are: - Competitors who manufacture jewelry - Pawn shops - Gold loan companies - Very large corporations (won't buy from small manufacturer) For each lead provided, output JSON with: - company_name, contact_name (if found), email, phone, city - lead_quality: "hot" / "warm" / "cold" - reason: why you rated it this way (1 sentence) - best_product_fit: which of our products they likely need
Prompt 3 — Cold Email Writer System Prompt
You are a skilled B2B sales email writer for {COMPANY_NAME}, a jewelry manufacturer based in Jaipur specializing in high-quality gold and gemstone jewelry. Your emails must: - Be SHORT (under 120 words in body) — busy buyers don't read long emails - Feel personal and researched, not templated - Reference what we know about their specific business - Mention 1-2 trending products relevant to their customer base - Have ONE clear call to action (view catalog OR schedule a 10-min call) - Use professional but warm Hindi-English mix when appropriate DO NOT: - Use generic openers like "I hope this email finds you well" - List more than 2 products - Make it sound automated or mass-sent - Use excessive exclamation marks Our products: Gold chains (18kt, 22kt), Diamond pendants, Kundan sets, Polki earrings, Gemstone rings, Silver anklets, Bridal sets Catalog link: {CATALOG_URL} Phone: {PHONE} Write the email as JSON: { subject, body, ps_line }
🔄 Prompt 4 — Follow-up Email Writer System Prompt
You are writing a follow-up email for {COMPANY_NAME}. Context: - First email was sent {DAYS_AGO} days ago - No reply received - Lead type: {LEAD_TYPE} - First email was about: {FIRST_EMAIL_SUBJECT} Write a SHORT follow-up (under 80 words) that: - References the previous email briefly (don't re-send the same content) - Adds ONE new piece of value (a new trend, a limited offer, or a new product launch) - Is slightly more casual than the first email - Has a different call to action than the first (if first was "view catalog", this should be "5-minute call?") If this is Day 7 follow-up: mention a limited-time wholesale offer or a new collection just arrived. Output as JSON: { subject, body }
💬 Prompt 5 — Reply Handler System Prompt
You are a B2B sales assistant for {COMPANY_NAME}, a Jaipur jewelry manufacturer. A prospect just replied to our cold email. Analyze their reply and: 1. Classify intent: "interested" / "not_interested" / "price_query" / "sample_request" / "referral" / "out_of_office" 2. If interested or price_query: Write a warm, helpful reply that: - Thanks them for responding - Answers their specific question - Provides minimum order quantity (MOQ: 50,000 INR) - Offers to send samples or schedule a call - Keeps it under 150 words 3. If not interested: Write a gracious exit that leaves door open for future. 4. If sample request: Acknowledge, explain sample policy (samples available at 50% of wholesale price, refundable on first order), ask for their shipping address. Output as JSON: { intent, suggested_reply, action_needed }
Step 4 — Email Templates

Sample Emails Claude Will Generate

These are examples of what Claude produces automatically. The AI personalizes each one for the specific lead.
Cold Email
Day 3 Follow-up
Day 7 Final
Step 5 — The Code

Complete Python Scripts

Create these files in your project folder. Copy each one exactly.
A
main.py — The Complete Automation Script
Main File
main.py
"""
Jewelry AI Automation System
Runs daily at 6 AM — research, leads, emails, follow-ups
"""

import os, json, requests, schedule, time
from datetime import datetime, timedelta
from dotenv import load_dotenv
import anthropic
from gmail_helper import send_email, check_replies
from sheets_helper import log_lead, get_followup_leads, update_lead_status

load_dotenv()

client = anthropic.Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
TODAY = datetime.now().strftime("%B %d, %Y")

# ═══════════════════════════════════════
# STEP 1: MARKET RESEARCH
# ═══════════════════════════════════════

def fetch_jewelry_trends():
    """Search for today's jewelry market trends"""
    serpapi_key = os.getenv("SERPAPI_KEY")
    queries = [
        "jewelry trends India 2025 wholesale",
        "gold jewelry demand today India",
        "bridal jewelry trending this month"
    ]
    all_results = []
    for q in queries:
        r = requests.get("https://serpapi.com/search", params={
            "q": q, "api_key": serpapi_key, "num": 5
        })
        data = r.json()
        snippets = [x.get("snippet", "") for x in data.get("organic_results", [])]
        all_results.extend(snippets)
    return " | ".join(all_results[:12])

def analyze_market(raw_data):
    """Claude analyzes market data and returns insights"""
    with open("prompts/market_analyst.txt") as f:
        system = f.read().replace("{TODAY_DATE}", TODAY)
    
    response = client.messages.create(
        model="claude-sonnet-4-5",
        max_tokens=1500,
        system=system,
        messages=[{"role": "user", "content": f"Here is today's raw market data:\n\n{raw_data}\n\nAnalyze and give me the JSON output."}]
    )
    return json.loads(response.content[0].text)

# ═══════════════════════════════════════
# STEP 2: LEAD GENERATION
# ═══════════════════════════════════════

def find_jewelry_leads(market_insights):
    """Find 20 B2B leads from web search"""
    top_items = market_insights.get("trending_items", [])
    serpapi_key = os.getenv("SERPAPI_KEY")
    
    lead_queries = [
        "jewelry retailer store Delhi contact email",
        "bridal jewelry boutique Mumbai email",
        "wholesale jewelry buyer Bangalore contact",
        "fashion accessories store India email wholesale"
    ]
    
    raw_leads = []
    for q in lead_queries:
        r = requests.get("https://serpapi.com/search", params={
            "q": q, "api_key": serpapi_key, "num": 8
        })
        data = r.json()
        for result in data.get("organic_results", []):
            raw_leads.append({
                "title": result.get("title"),
                "link": result.get("link"),
                "snippet": result.get("snippet")
            })
    
    return qualify_leads(raw_leads[:30], market_insights)

def qualify_leads(raw_leads, market_insights):
    """Claude qualifies and scores leads"""
    with open("prompts/lead_qualifier.txt") as f:
        system = f.read()
    
    response = client.messages.create(
        model="claude-sonnet-4-5",
        max_tokens=3000,
        system=system,
        messages=[{"role": "user", "content": f"Qualify these leads. Return top 20 as JSON array.\n\nLeads:\n{json.dumps(raw_leads)}\n\nToday's trending products:\n{market_insights.get('trending_items', [])}"}]
    )
    return json.loads(response.content[0].text)

# ═══════════════════════════════════════
# STEP 3: WRITE AND SEND EMAILS
# ═══════════════════════════════════════

def write_and_send_emails(leads, market_insights):
    """Write personalized email for each lead and send"""
    with open("prompts/email_writer.txt") as f:
        system = f.read()
        system = system.replace("{COMPANY_NAME}", os.getenv("YOUR_COMPANY_NAME"))
        system = system.replace("{CATALOG_URL}", os.getenv("YOUR_CATALOG_URL"))
        system = system.replace("{PHONE}", os.getenv("YOUR_PHONE"))
    
    sent_count = 0
    for lead in leads[:20]:
        if not lead.get("email"):
            continue
        
        response = client.messages.create(
            model="claude-haiku-4-5",
            max_tokens=600,
            system=system,
            messages=[{"role": "user", "content": f"Write cold email for this lead:\n{json.dumps(lead)}\n\nToday's top trending item to mention:\n{market_insights['trending_items'][0] if market_insights.get('trending_items') else 'premium gold jewelry'}"}]
        )
        
        email_data = json.loads(response.content[0].text)
        
        send_email(
            to=lead["email"],
            subject=email_data["subject"],
            body=email_data["body"] + "\n\n" + email_data.get("ps_line", "")
        )
        
        lead["email_sent_date"] = TODAY
        lead["followup_date"] = (datetime.now() + timedelta(days=3)).strftime("%Y-%m-%d")
        lead["email_subject"] = email_data["subject"]
        log_lead(lead)
        sent_count += 1
        time.sleep(3)
    
    return sent_count

# ═══════════════════════════════════════
# STEP 4: FOLLOW-UPS
# ═══════════════════════════════════════

def send_followups():
    """Check who needs follow-up and send"""
    leads_to_followup = get_followup_leads()
    
    with open("prompts/followup_writer.txt") as f:
        system = f.read().replace("{COMPANY_NAME}", os.getenv("YOUR_COMPANY_NAME"))
    
    for lead in leads_to_followup:
        days_ago = lead.get("days_since_first_email", 3)
        
        response = client.messages.create(
            model="claude-haiku-4-5",
            max_tokens=400,
            system=system.replace("{DAYS_AGO}", str(days_ago))
                         .replace("{LEAD_TYPE}", lead.get("lead_quality", "warm"))
                         .replace("{FIRST_EMAIL_SUBJECT}", lead.get("email_subject", "")),
            messages=[{"role": "user", "content": f"Write follow-up for: {lead['company_name']}"}]
        )
        
        fu_data = json.loads(response.content[0].text)
        send_email(lead["email"], fu_data["subject"], fu_data["body"])
        update_lead_status(lead["email"], "followup_sent")
        time.sleep(2)

# ═══════════════════════════════════════
# DAILY JOB — runs everything
# ═══════════════════════════════════════

def daily_job():
    print(f"[{datetime.now()}] Starting daily jewelry automation...")
    
    print("→ Fetching market trends...")
    raw_data = fetch_jewelry_trends()
    
    print("→ Analyzing with Claude...")
    insights = analyze_market(raw_data)
    print(f"  Top trend: {insights.get('trending_items', ['N/A'])[0]}")
    
    print("→ Finding leads...")
    leads = find_jewelry_leads(insights)
    print(f"  Found {len(leads)} qualified leads")
    
    print("→ Writing and sending emails...")
    sent = write_and_send_emails(leads, insights)
    print(f"  Sent {sent} emails")
    
    print("→ Processing follow-ups...")
    send_followups()
    
    print("✓ Daily job complete!")

# Schedule to run at 6 AM every day
schedule.every().day.at("06:00").do(daily_job)

if __name__ == "__main__":
    print("Jewelry AI System started. Waiting for 6 AM...")
    daily_job()  # Run once immediately for testing
    while True:
        schedule.run_pending()
        time.sleep(60)
B
gmail_helper.py — Email Sender
Helper File
gmail_helper.py
import os, base64
from email.mime.text import MIMEText
from google.oauth2.credentials import Credentials
from google_auth_oauthlib.flow import InstalledAppFlow
from googleapiclient.discovery import build
from google.auth.transport.requests import Request

SCOPES = ['https://www.googleapis.com/auth/gmail.send',
          'https://www.googleapis.com/auth/gmail.readonly']

def get_gmail_service():
    creds = None
    if os.path.exists('token.json'):
        creds = Credentials.from_authorized_user_file('token.json', SCOPES)
    if not creds or not creds.valid:
        if creds and creds.expired:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file('credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        with open('token.json', 'w') as token:
            token.write(creds.to_json())
    return build('gmail', 'v1', credentials=creds)

def send_email(to, subject, body):
    service = get_gmail_service()
    sender = os.getenv("GMAIL_SENDER_EMAIL")
    message = MIMEText(body)
    message['to'] = to
    message['from'] = sender
    message['subject'] = subject
    raw = base64.urlsafe_b64encode(message.as_bytes()).decode()
    service.users().messages().send(userId='me', body={'raw': raw}).execute()
    print(f"  ✓ Email sent to {to}")
C
sheets_helper.py — Google Sheets Logger
Helper File
sheets_helper.py
import os, gspread
from datetime import datetime, timedelta
from google.oauth2.credentials import Credentials

def get_sheet():
    creds = Credentials.from_authorized_user_file('token.json')
    gc = gspread.authorize(creds)
    return gc.open_by_key(os.getenv("GOOGLE_SHEETS_ID")).sheet1

def log_lead(lead):
    sheet = get_sheet()
    row = [
        lead.get("company_name"), lead.get("contact_name"),
        lead.get("email"), lead.get("phone"), lead.get("city"),
        lead.get("lead_quality"), lead.get("best_product_fit"),
        lead.get("email_sent_date"), lead.get("followup_date"),
        lead.get("email_subject"), "sent"
    ]
    sheet.append_row(row)

def get_followup_leads():
    sheet = get_sheet()
    today = datetime.now().strftime("%Y-%m-%d")
    records = sheet.get_all_records()
    return [r for r in records
            if r.get("followup_date") <= today
            and r.get("status") == "sent"]

def update_lead_status(email, status):
    sheet = get_sheet()
    cell = sheet.find(email)
    if cell:
        sheet.update_cell(cell.row, 11, status)
Step 6 — Run It

How to Run the System

1
Test Run (First Time)
Terminal
TERMINAL
# Make sure you're in your project folder with venv activated
cd jewelry_ai_system
source venv/bin/activate  # Mac/Linux
# venv\Scripts\activate  # Windows

# Run the system once (for testing)
python main.py

# First run: browser will open for Gmail permission
# Click "Allow" → it saves token.json → never asks again
What you'll see in terminal
[2025-01-15 06:00:00] Starting daily jewelry automation...
→ Fetching market trends...
→ Analyzing with Claude...
  Top trend: 22kt gold temple jewelry sets
→ Finding leads...
  Found 20 qualified leads
→ Writing and sending emails...
  ✓ Email sent to buyer@rajasthanjewels.com
✓ Daily job complete!
2
Run 24/7 on a Cloud Server (Optional)

To run automatically every day without keeping your PC on, deploy to a small cloud server.

Deploy to Railway.app (Easiest Option — Free Tier Available)
# 1. Create account at railway.app
# 2. Install Railway CLI:
npm install -g @railway/cli

# 3. Login and deploy:
railway login
railway init
railway up

# 4. Set environment variables in Railway dashboard
#    (same as your .env file — paste each key)

# 5. Your system now runs 24/7 in the cloud!
#    Cost: Free tier
Alternative: Run on your PC but scheduled
On Windows: Use Task Scheduler to run "python main.py" at 6 AM daily.
On Mac: Use cron: 0 6 * * * cd ~/jewelry_ai_system && python main.py
Your Daily Google Sheet will look like this:
Company Name | Contact | Email | Phone | City | Quality | Best Product | Email Sent | Follow-up Date | Subject | Status

Rajasthan Jewels | Priya Sharma | priya@rajjewels.com | 9876543210 | Delhi | hot | Kundan bridal | 2025-01-15 | 2025-01-18 | Kundan sets trending... | sent