Skip to content

An email marketing AI agent that automates the entire email marketing workflow, from data collection to AI-powered email generation, tracking, and automated follow-up.

Notifications You must be signed in to change notification settings

danieladdisonorg/email-marketing-ai-agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Email Marketing AI Agent

System Architecture Diagram

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           EMAIL MARKETING AI AGENT WORKFLOW                         β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚   Data Sources   β”‚    β”‚   AI Processing  β”‚    β”‚   Output Systems β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                STEP 1: DATA COLLECTION                              β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Zoho CRM  β”‚ ──────▢│ get_emails  │────────▢│ zoho_emails β”‚
    β”‚ (Existing   β”‚         β”‚    .py      β”‚         β”‚   .csv      β”‚
    β”‚ Customers)  β”‚         β”‚             β”‚         β”‚             β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                β”‚                 β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ prospects   β”‚                β”‚                 β”‚ Google      β”‚
    β”‚   .csv      │────────────────┼───────────────▢│ Sheets      β”‚
    β”‚ (New Leads) β”‚                β”‚                 β”‚ (Email DB)  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                β”‚                 β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚   Domain    β”‚
                            β”‚ Comparison  β”‚
                            β”‚  Analysis   β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                           STEP 2: AI EMAIL GENERATION                               β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚   Domain    β”‚   YES   β”‚ Personalizedβ”‚         β”‚   OpenAI    β”‚
    β”‚   Match?    │────────▢│   Email     │───────▢│   GPT-4     β”‚
    β”‚             β”‚         β”‚ Generation  β”‚         β”‚             β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
           β”‚                                               β”‚
           β”‚ NO                                            β”‚
           β–Ό                                               β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  Generic    β”‚         β”‚   Email     β”‚         β”‚ Generated   β”‚
    β”‚   Email     │────────▢│ Templates   │───────▢│ Email with  β”‚
    β”‚ Generation  β”‚         β”‚             β”‚         β”‚ Tracking    β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                         STEP 3: EMAIL SENDING & TRACKING                            β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Google      β”‚         β”‚ Google Apps β”‚         β”‚   Email     β”‚
    β”‚ Sheets      │────────▢│   Script    │───────▢│ Recipients  β”‚
    β”‚ (Email DB)  β”‚         β”‚ (Sender)    β”‚         β”‚             β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚                        β”‚
                                   β”‚                        β”‚
                                   β–Ό                        β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚  Tracking   │◀───────│   Email     β”‚
                            β”‚   Pixel     β”‚         β”‚   Opens     β”‚
                            β”‚  (Web App)  β”‚         β”‚             β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚
                                   β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚ Update Open β”‚
                            β”‚ Count in    β”‚
                            β”‚ Sheets      β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                      STEP 4: ENGAGEMENT ANALYSIS & FOLLOW-UP                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Email Opens β”‚         β”‚   Opens     β”‚   YES   β”‚ AI Call     β”‚
    β”‚ Monitoring  │───────▢│   > 5?      │────────▢│ Script      β”‚
    β”‚             β”‚         β”‚             β”‚         β”‚ Generation  β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                   β”‚                        β”‚
                                   β”‚ NO                     β”‚
                                   β–Ό                        β–Ό
                            β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                            β”‚ Continue    β”‚         β”‚ Upload to   β”‚
                            β”‚ Monitoring  β”‚         β”‚ Call Script β”‚
                            β”‚             β”‚         β”‚   Sheet     β”‚
                            β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                                                           β”‚
                                                           β–Ό
                                                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                                                    β”‚ Upload to   β”‚
                                                    β”‚ Zoho CRM    β”‚
                                                    β”‚ (Lead Data) β”‚
                                                    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                              SYSTEM COMPONENTS                                      β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Python      β”‚  β”‚ Google Apps β”‚  β”‚ Google      β”‚  β”‚ OpenAI      β”‚  β”‚ Zoho CRM    β”‚
β”‚ Scripts     β”‚  β”‚ Script      β”‚  β”‚ Sheets API  β”‚  β”‚ GPT-4 API   β”‚  β”‚ API         β”‚
β”‚             β”‚  β”‚             β”‚  β”‚             β”‚  β”‚             β”‚  β”‚             β”‚
β”‚β€’ get_emails β”‚  β”‚β€’ Email      β”‚  β”‚β€’ Data       β”‚  β”‚β€’ Email      β”‚  β”‚β€’ Customer   β”‚
β”‚β€’ clean_and_ β”‚  β”‚  Sending    β”‚  β”‚  Storage    β”‚  β”‚  Generation β”‚  β”‚  Data       β”‚
β”‚  gen_call_  β”‚  β”‚β€’ Tracking   β”‚  β”‚β€’ Open       β”‚  β”‚β€’ Call       β”‚  β”‚β€’ Lead       β”‚
β”‚  script     β”‚  β”‚  Pixel      β”‚  β”‚  Logging    β”‚  β”‚  Scripts    β”‚  β”‚  Management β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                                 KEY FEATURES                                        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

βœ… Multi-alias email sending
βœ… Real-time open tracking with hidden pixels
βœ… AI-powered personalized email generation
βœ… Automatic call script creation for high-engagement leads
βœ… Integration with Zoho CRM and Google Workspace
βœ… Domain-based customer relationship detection
βœ… Automated lead scoring and follow-up prioritization

This diagram shows the complete workflow of your email marketing AI agent, from data collection through AI-powered email generation, tracking, and automated follow-up. The system intelligently personalizes emails based on existing customer relationships and automatically generates call scripts for highly engaged prospects.

Demo Video For Email Tracking

demo.mp4

Repository Structure

app_script_email_automation/
β”œβ”€β”€ README.md
β”œβ”€β”€ requirements.txt
└── src/
    β”œβ”€β”€ app_script.js                 (Main Apps Script code)
    β”œβ”€β”€ credentials.json              (Credentials for external services)
    β”œβ”€β”€ get_emails.py                 (Fetches and uploads email data to Sheets)
    β”œβ”€β”€ clean_and_gen_call_script.py  (Cleans data & triggers call script creation)
    └── functions/
        β”œβ”€β”€ agent.py                 (AI-related logic)
        β”œβ”€β”€ config.py                (Configuration & constants)
        β”œβ”€β”€ create_call_script.py    (Generates call scripts)
        β”œβ”€β”€ create_email.py          (Builds email content)
        └── utlis.py                 (Utility functions)

Features

  • Send emails from multiple aliases.
  • Track opens with a web app and hidden pixel.
  • Log open counts and timestamps in Google Sheets.
  • Dynamically generate call scripts for emails exceeding five opens.
  • Append generated scripts to a separate Sheet for follow-up actions.

Getting Started

  1. Set Up Google Sheets: Create or update source/destination Sheets for email list and lead data.
  2. Deploy Web App: Host the code in Google Apps Script and enable the web endpoint for open tracking.
  3. Configure Credentials: Store any required credentials for third-party services (e.g., OpenAI API).
  4. Run & Track: Send emails, check open stats, and watch new call scripts appear in the leads Sheet.

Project Setup

  1. Clone the Repository
      git clone https://github.com/danieladdisonorg/email-marketing-ai-agent.git
      cd email-marketing-ai-agent
  1. Create Environment File (.env)

    • Add your OpenAI API key and other credentials.
    • Copy and paste the following into your .env file, replacing the placeholder values with your actual keys:
    OPENAI_API_KEY=your_key_here
    SHEET_API_KEY=your_sheet_key_here
  2. Install Dependencies

    • In local Python projects, run:
      pip install -r requirements.txt
  3. Create or Update config.py
    Place this file under src/helpers/ and store your credentials, Sheet IDs, and any other constants.
    For example:

    email_google_sheet = "YOUR_EMAIL_SHEET_ID"
    call_script_google_sheet = "YOUR_CALL_SCRIPT_SHEET_ID"
    CLIENT_ID = "YOUR_ZOHO_CLIENT_ID"
    CLIENT_SECRET = "YOUR_ZOHO_CLIENT_SECRET"
    REFRESH_TOKEN = "YOUR_ZOHO_REFRESH_TOKEN"
    ZOHO_API_BASE_URL = "https://www.zohoapis.com/crm/v2"
    TOKEN_URL = "https://accounts.zoho.com/oauth/v2/token"
  4. Configure Google Apps Script

    • Paste the .gs / app_script.js code into your Google Apps Script Editor.
    • Set up triggers or web app deployments as required.
  5. Deploy Production

    • Push your local changes to GitHub or your chosen repo host.
    • In Google Apps Script, deploy with appropriate permissions for the tracking pixel.

Setup and Usage

  • Configure your Google Apps Script project with the provided code.
  • Enable the web endpoint for handling the tracking pixel.
  • Create or update your Google Sheets for storing email data, tracking opens, and logging call scripts.
  • Set necessary environment variables (e.g., API keys) in your script or use a .env file locally.
  • Deploy as a web app; then run the main script to send emails and track opens.

Additional Steps to Run

  1. Activate your virtual environment (.venv) if needed, then run get_emails.py to gather and upload emails to a Google Sheet.
  2. Open the Google Apps Script editor and run app_script.js via the web interface to handle sending and tracking.

Workflow Overview (Step-by-Step)

  1. Data Import and Comparison

    • Import existing customers from Zoho CRM.
    • Import new customer data from a CSV file.
    • Compare the domains of existing and new customers.
  2. AI-Powered Email Generation

    • If a domain match is found, generate a personalized email using AI.
    • Otherwise, generate a generic marketing email.
  3. Email Upload and Sending

    • Upload generated emails to a Google Sheet.
    • Send all emails from the Sheet using Google Apps Script.
  4. Email Tracking

    • Track email activity via Google Apps Script.
    • Update the Sheet with open status whenever an email is opened.
  5. Engagement Analysis and Call Script Generation

    • If an email’s open rate exceeds the threshold:
      • Generate a personalized call script via AI.
      • Save this call script to another Google Sheet for follow-up.

Resources

License

This project is licensed under the MIT License.

About

An email marketing AI agent that automates the entire email marketing workflow, from data collection to AI-powered email generation, tracking, and automated follow-up.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published