This project provides an n8n custom node for AI-powered creative ad testing using Microsoft TinyTroupe persona simulation. Perfect for marketers who need to test different versions of ad copy for the SAME product to determine which messaging resonates best with their target audience.
- A/B Test Headlines: Compare emotional vs. rational messaging approaches
- Optimize Copy Variations: Test different value propositions for the same product
- Pre-Campaign Testing: Validate ad copy before spending on paid advertising
- Message Positioning: Compare feature-focused vs. benefit-focused copy
- Audience Insights: Understand why certain copy resonates with different demographics
Example: Testing 3 different headlines for your SaaS product:
- "Boost Team Productivity by 40%" (metric-focused)
- "Stop Wasting Time on Endless Meetings" (problem-focused)
- "Join 50,000+ Teams Already Saving Time" (social proof-focused)
- n8n Custom Node: Drag-and-drop ad testing in n8n workflows
- AI Persona Simulation: Uses Microsoft TinyTroupe with OpenAI GPT-4
- Geographic Targeting: 7 different regions with culturally-aware personas
- Comprehensive Analysis: Sentiment, engagement scores, and improvement suggestions
- Production Ready: Full API backend with job queuing and result polling
- Node.js 18+ and npm
- Python 3.8+
- OpenAI API Key (Get one here)
- n8n (we'll install this)
# 1. Clone and navigate to backend
cd backend
# 2. Install Python dependencies
pip install -r requirements.txt
# 3. Set up environment variables
cp ../env.docker.example .env
# Edit .env and add your OPENAI_API_KEY
echo "OPENAI_API_KEY=your_openai_key_here" >> .env
# 4. Test TinyTroupe integration
python3 test_tinytroupe_integration.py
# 5. Start the backend server
python3 -m uvicorn main:app --host 0.0.0.0 --port 8000 --reload
β Verify Backend: Open http://localhost:8000/docs - you should see the FastAPI documentation.
# Install n8n globally
npm install -g n8n
# Verify installation
n8n --version
# Navigate to the n8n node directory
cd n8n-node
# Build the node
npm run build
# Link for development (easier than packaging)
npm link
# Verify linking
npm list -g | grep creative-ad-tester
Alternative: Package Installation Method
# If linking doesn't work, use packaging:
npm pack
npm install -g n8n-nodes-creative-ad-tester-1.0.2.tgz
π IMPORTANT: After installing the node, you MUST restart n8n to load it properly.
# IMPORTANT: Kill any existing n8n processes first
killall node 2>/dev/null || true
# Start n8n (it will automatically detect the custom node)
n8n start
# n8n will be available at: http://localhost:5678
π You should see n8n running at http://localhost:5678
β Verify Node Installation: In n8n, click the "+" to add a node and search for "Creative Ad Tester". If it doesn't appear, the installation didn't work.
- Open n8n: Go to http://localhost:5678
- Go to Settings: Click the settings icon in the bottom left
- Add Credentials:
- Click "Credentials" β "New Credential"
- Search for "Creative Ad Tester API"
- Configure:
- API Key:
test-key-123
(any value works for local testing) - Base URL:
http://127.0.0.1:8000
- API Key:
- Test Connection: Click "Test" - should show "Connected successfully"
- Save: Give it a name like "Creative Ad Tester - Local"
n8n-node/TROUBLESHOOTING.md
for detailed solutions.
- Create New Workflow in n8n
- Add Manual Trigger (drag from the left panel)
- Add Creative Ad Tester Node:
- Click "+" to add a node
- Search for "Creative Ad Tester"
- If it doesn't appear, the installation failed - see troubleshooting guide
- Drag it to the canvas and connect to the manual trigger
- Configure the Node:
- Ad Copies: Add 2 text ads with any content
- Geography: Select "US-West-Coast"
- Persona Count: Set to 2-3 (for faster testing)
- Credentials: Select your saved credentials
- Execute the Test:
- Click "Execute Workflow" button
- The workflow will submit a job and poll for results
- Results should appear in 30-60 seconds for 2-3 personas
- You'll see detailed persona reactions, sentiment analysis, and winning ad determination
Try importing the pre-made workflow:
n8n-node/working-test-workflow.json
(recommended - tests 3 variations of the same product)
The workflow will return structured results like:
{
"job_id": "uuid",
"status": "completed",
"ad_results": [
{
"ad_title": "Tech Innovation Ad",
"ad_content": "Discover the future...",
"persona_reactions": [
{
"persona_name": "Liam Chen-Smith",
"reaction": "I find this ad compelling because...",
"sentiment": "positive",
"engagement_score": 0.8,
"reasoning": "..."
}
],
"overall_sentiment": "positive",
"average_engagement": 0.75,
"winning_elements": ["Strong value proposition", "Clear call-to-action"],
"improvement_suggestions": ["Add social proof", "Strengthen urgency"]
}
],
"test_metadata": {
"geography": "US-West-Coast",
"persona_count": 3,
"ad_count": 2,
"test_framework": "Microsoft TinyTroupe"
}
}
# Test backend directly - Testing 3 variations of copy for the same product
curl -X POST "http://localhost:8000/api/v1/test-ads" \
-H "Content-Type: application/json" \
-d '{
"ad_copies": [
{
"type": "text",
"content": "Boost your team productivity by 40% with our AI project management tool. Start free trial today!",
"title": "Metric-Focused Copy"
},
{
"type": "text",
"content": "Stop wasting time on endless meetings and unclear priorities. Our AI tool gets teams organized fast. Free trial available.",
"title": "Problem-Focused Copy"
},
{
"type": "text",
"content": "Join 50,000+ teams already using our AI project management solution. Proven 40% productivity boost. Try free for 14 days!",
"title": "Social Proof Copy"
}
],
"geography": "US-West-Coast",
"test_parameters": {
"persona_count": 3,
"simulation_depth": "detailed"
}
}'
# Check status (use job_id from response)
curl "http://localhost:8000/api/v1/jobs/{job_id}/status"
# Get results (when status is "completed")
curl "http://localhost:8000/api/v1/jobs/{job_id}/results"
# One-command setup with Docker
./setup-docker-dev.sh
# Test with provided script
./test-api.sh
US-West-Coast
- Tech professionals, environmentally consciousUS-East-Coast
- Business professionals, fashion-consciousUS-Midwest
- Family-oriented, value-consciousUS-South
- Traditional values, community-focusedUK
- Polite, understated, privacy-consciousCanada
- Environmentally aware, polite, healthcare-consciousAustralia
- Casual, direct, outdoor lifestyle
- Age Range:
18-24
,25-34
,35-44
,45-54
,55+
- Income Level:
low
,middle
,high
- Interests: Comma-separated (e.g., "technology, sustainability, fitness")
- Persona Count: 2-20 (more personas = more comprehensive but slower)
- Interaction Style:
quick
,detailed
,conversational
- Max Wait Time: 5-30 minutes
# Check if backend is running
curl http://localhost:8000/health
# Common fixes
rm backend/tinytroupe_api_cache.pickle # Clear corrupted cache
export OPENAI_API_KEY="your-key" # Set API key
pip install -r backend/requirements.txt # Reinstall dependencies
# Node not appearing in n8n
npm list -g | grep creative-ad-tester # Check if installed
killall node && n8n start # Restart n8n
# Reinstall node
npm uninstall -g n8n-nodes-creative-ad-tester
cd n8n-node && npm pack && npm install -g *.tgz
- Can't find workflow file: The file is located at
n8n-node/working-test-workflow.json
from the project root - Node shows "Install this node to use it": The custom node isn't installed - follow Step 3 again
- Credentials not available: Create credentials first (Step 5) before importing workflow
- Import button grayed out: Make sure you're selecting a
.json
file - Workflow doesn't load: Try creating a new workflow manually and adding the Creative Ad Tester node
- Node appears as "CUSTOM.creativeAdTester": This is correct - the node is properly installed
- Ensure Base URL is
http://127.0.0.1:8000
(no trailing slash) - use IPv4, not localhost - API Key can be any value for local testing
- Test connection before saving credentials
- If you get "ECONNREFUSED ::1:8000", change localhost to 127.0.0.1
- "Address already in use": Kill processes on port 8000:
lsof -ti:8000 | xargs kill
- "TinyTroupe errors": Check OpenAI API key and account billing
- "Node not found": Restart n8n completely after installing the node
- "API timeout": Increase max wait time or reduce persona count
- "Invalid URL": Check credentials - make sure Base URL is
http://127.0.0.1:8000
- "Status code 422": Node/API version mismatch - rebuild and reinstall the node
- 2-3 personas: ~30-60 seconds
- 5-8 personas: ~2-3 minutes
- 10+ personas: ~5-10 minutes
- API costs: ~$0.10-0.50 per test (depending on persona count)
See DEPLOYMENT_ROADMAP.md
for:
- AWS ECS Fargate deployment
- Real authentication system
- Rate limiting and monitoring
- Community node publication
- Image ad testing
- Multi-language support
- Custom persona creation
- Industry-specific templates
- API Documentation: http://localhost:8000/docs (when backend is running)
- TinyTroupe GitHub: https://github.com/microsoft/TinyTroupe
- n8n Community: https://community.n8n.io/
- OpenAI API: https://platform.openai.com/docs
Complete this checklist to verify everything is working:
- Backend starts without errors (
uvicorn main:app --reload
) - Health check responds (
curl localhost:8000/health
) - TinyTroupe test passes (
python3 test_tinytroupe_integration.py
) - n8n installs and starts (
n8n start
) - Creative Ad Tester node appears in n8n node list
- Credentials can be configured and tested
- Test workflow imports successfully
- Test workflow executes and returns results
- Results contain persona reactions and analysis
π If all items are checked, your Creative Ad Tester n8n node is fully operational!
Need help? Check the troubleshooting section or review the logs in both the backend terminal and n8n interface.