mirror of
https://github.com/thecyberlearn/quantum-ai.git
synced 2026-08-18 08:53:00 +00:00
🤖 Implement comprehensive N8N workflow management system
- Add N8N workflow directory structure for webhook-based agents - Create workflow management scripts (import/export/sync/backup) - Add comprehensive documentation for each agent's workflow setup - Clarify N8N deployment architecture (separate hosting from Django) - Update deployment guides with clear separation warnings - Add workflow deployment automation scripts Architecture clarification: - Django app deploys to Railway - N8N runs separately (N8N Cloud, separate Railway project, or self-hosted) - Communication via HTTP webhook URLs only 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
c5d87ccbaa
commit
2c129708d9
1
.gitignore
vendored
1
.gitignore
vendored
@ -232,3 +232,4 @@ nextjs/
|
||||
netcop-ai-hub/
|
||||
temp/
|
||||
five-whys-agent-new.html
|
||||
django_server.pid
|
||||
|
||||
64
CLAUDE.md
64
CLAUDE.md
@ -76,6 +76,27 @@ python manage.py test_webhook
|
||||
python manage.py cleanup_uploads
|
||||
```
|
||||
|
||||
### N8N Workflow Management
|
||||
```bash
|
||||
# List all workflows (local and N8N instance)
|
||||
python manage_n8n_workflows.py list
|
||||
|
||||
# Import specific agent workflow to N8N
|
||||
python manage_n8n_workflows.py import data_analyzer
|
||||
|
||||
# Export workflow from N8N to local files
|
||||
python manage_n8n_workflows.py export social_ads_generator
|
||||
|
||||
# Sync all workflows between local and N8N
|
||||
python manage_n8n_workflows.py sync
|
||||
|
||||
# Backup all workflows with timestamp
|
||||
python manage_n8n_workflows.py backup
|
||||
|
||||
# Deploy all workflows (recommended for production)
|
||||
./deploy_n8n_workflows.sh
|
||||
```
|
||||
|
||||
## Architecture Overview
|
||||
|
||||
### Agent System Architecture (`agent_base/`)
|
||||
@ -89,8 +110,14 @@ python manage.py cleanup_uploads
|
||||
- `templates/agent_base/` - Marketplace and agent catalog templates
|
||||
|
||||
**Agent Types:**
|
||||
1. **Webhook Agents** - Process requests via external webhook APIs (e.g., weather_reporter)
|
||||
1. **Webhook Agents** - Process requests via external N8N webhook APIs (require N8N workflows)
|
||||
- `data_analyzer` - File analysis and insights
|
||||
- `social_ads_generator` - Social media ad creation
|
||||
- `job_posting_generator` - Professional job postings
|
||||
- `five_whys_analyzer` - Root cause analysis
|
||||
2. **API Agents** - Direct API integration for immediate responses
|
||||
- `weather_reporter` - OpenWeather API integration
|
||||
- `email_writer` - Custom email composition logic
|
||||
|
||||
**Individual Agent Apps:**
|
||||
Each agent is a separate Django app following this structure:
|
||||
@ -99,6 +126,41 @@ Each agent is a separate Django app following this structure:
|
||||
- `views.py` - Agent detail page and request handling
|
||||
- `templates/[agent_name]/detail.html` - Agent interface
|
||||
- `urls.py` - Agent-specific URL routing
|
||||
- `n8n_workflows/` - N8N workflow configurations (webhook agents only)
|
||||
- `workflow.json` - Production workflow
|
||||
- `README.md` - Setup and configuration documentation
|
||||
|
||||
### N8N Workflow Architecture
|
||||
|
||||
⚠️ **IMPORTANT**: N8N runs on a SEPARATE server from your Django application. They communicate via HTTP webhooks.
|
||||
|
||||
**System Architecture:**
|
||||
```
|
||||
User Request → Django App (Railway) → HTTP POST → N8N Instance (Separate Hosting) → AI Processing → JSON Response → Django → User Display
|
||||
```
|
||||
|
||||
**Hosting Separation:**
|
||||
- **Django App**: Deployed on Railway (your main application)
|
||||
- **N8N Instance**: Deployed separately (N8N Cloud, separate Railway project, or self-hosted)
|
||||
- **Communication**: HTTP POST requests between the two systems
|
||||
|
||||
**Webhook Agent Integration:**
|
||||
- Django application sends POST requests to N8N webhook URLs (external server)
|
||||
- N8N workflows process requests using AI services (OpenAI GPT-4)
|
||||
- N8N workflows return structured JSON responses back to Django
|
||||
- Environment variables configure webhook URLs pointing to your N8N instance
|
||||
|
||||
**Workflow Management:**
|
||||
- `manage_n8n_workflows.py` - Import, export, sync, and backup workflows
|
||||
- `deploy_n8n_workflows.sh` - Automated deployment script
|
||||
- Individual agent README files document setup and configuration
|
||||
- Version control tracks workflow changes alongside agent code
|
||||
|
||||
**Environment Configuration:**
|
||||
- `N8N_WEBHOOK_DATA_ANALYZER` - Data analysis workflow URL
|
||||
- `N8N_WEBHOOK_SOCIAL_ADS` - Social ads generation workflow URL
|
||||
- `N8N_WEBHOOK_JOB_POSTING` - Job posting generation workflow URL
|
||||
- `N8N_WEBHOOK_FIVE_WHYS` - Five whys analysis workflow URL
|
||||
|
||||
### Core System Architecture
|
||||
|
||||
|
||||
@ -3,6 +3,24 @@
|
||||
## Overview
|
||||
This guide will help you deploy your Quantum Tasks AI Django application to Railway.app. Your application is already optimized for Railway deployment with the existing `railway.json` configuration.
|
||||
|
||||
### 🏗️ Architecture Overview (Important!)
|
||||
|
||||
**What Deploys to Railway:**
|
||||
- ✅ Django Application (Quantum Tasks AI)
|
||||
- ✅ PostgreSQL Database (automatic)
|
||||
- ✅ Redis Cache (optional but recommended)
|
||||
|
||||
**What DOES NOT Deploy to Railway:**
|
||||
- ❌ N8N Instance (runs on separate server)
|
||||
- ❌ N8N Workflows (hosted elsewhere)
|
||||
|
||||
**How They Connect:**
|
||||
```
|
||||
Railway Django App → HTTP POST Requests → N8N Instance (Separate Hosting) → AI Processing → Response → Railway Django App
|
||||
```
|
||||
|
||||
Your Django app only needs the N8N webhook URLs as environment variables to connect to your separately-hosted N8N instance.
|
||||
|
||||
## 📋 Pre-Deployment Checklist
|
||||
|
||||
### Required Accounts & Services
|
||||
@ -60,9 +78,10 @@ N8N_WEBHOOK_DATA_ANALYZER=https://your-n8n.com/webhook/data-analyzer
|
||||
N8N_WEBHOOK_FIVE_WHYS=https://your-n8n.com/webhook/five-whys
|
||||
N8N_WEBHOOK_JOB_POSTING=https://your-n8n.com/webhook/job-posting
|
||||
N8N_WEBHOOK_SOCIAL_ADS=https://your-n8n.com/webhook/social-ads
|
||||
N8N_WEBHOOK_FAQ_GENERATOR=https://your-n8n.com/webhook/faq-generator
|
||||
```
|
||||
|
||||
**Note**: Only webhook-based agents need N8N workflows. API-based agents (weather_reporter, email_writer) work independently.
|
||||
|
||||
#### 🗄️ Database Configuration
|
||||
Railway automatically provides `DATABASE_URL` - no manual configuration needed!
|
||||
|
||||
@ -80,7 +99,57 @@ REDIS_URL=redis://your-redis-url:6379
|
||||
1. Click "New" → "Database" → "Add Redis"
|
||||
2. Railway automatically sets the `REDIS_URL` environment variable
|
||||
|
||||
### Step 5: Custom Domain (Optional)
|
||||
### Step 5: Set Up N8N Instance (Separate Hosting)
|
||||
|
||||
⚠️ **IMPORTANT**: N8N is NOT deployed to Railway with your Django app. N8N runs on a separate server and your Django app connects to it via webhooks.
|
||||
|
||||
#### Architecture Overview:
|
||||
```
|
||||
User → Django App (Railway) → HTTP POST → N8N Webhooks (Separate Server) → AI Processing → Response → Django → User
|
||||
```
|
||||
|
||||
#### N8N Hosting Options (Choose One):
|
||||
|
||||
**Option A: N8N Cloud (Recommended - Easiest)**
|
||||
1. Sign up at [n8n.cloud](https://n8n.cloud)
|
||||
2. Create a new workflow instance
|
||||
3. Import your workflow JSON files
|
||||
4. Copy webhook URLs for environment variables
|
||||
|
||||
**Option B: Deploy N8N on Railway (Separate Project)**
|
||||
1. Create a NEW Railway project (separate from your Django app)
|
||||
2. Deploy N8N using Railway's N8N template
|
||||
3. Configure OpenAI API credentials in N8N
|
||||
4. Import workflows and get webhook URLs
|
||||
|
||||
**Option C: Self-Hosted N8N**
|
||||
1. Deploy N8N on DigitalOcean, AWS, or VPS
|
||||
2. Use Docker: `docker run -it --rm --name n8n -p 5678:5678 n8nio/n8n`
|
||||
3. Configure and import workflows
|
||||
4. Ensure server is publicly accessible for webhooks
|
||||
|
||||
#### Deploy Workflows to Your N8N Instance:
|
||||
```bash
|
||||
# Set connection details for YOUR N8N instance
|
||||
export N8N_BASE_URL=https://your-n8n-instance.com # Your N8N URL
|
||||
export N8N_API_KEY=your-api-key # Your N8N API key
|
||||
|
||||
# Deploy all workflows to your N8N instance
|
||||
./deploy_n8n_workflows.sh
|
||||
```
|
||||
|
||||
#### Configure Django App to Connect to N8N:
|
||||
1. Copy webhook URLs from your N8N instance
|
||||
2. Add these URLs to your Railway Django project environment variables:
|
||||
```
|
||||
N8N_WEBHOOK_DATA_ANALYZER=https://your-n8n.com/webhook/data-analyzer
|
||||
N8N_WEBHOOK_SOCIAL_ADS=https://your-n8n.com/webhook/social-ads
|
||||
N8N_WEBHOOK_JOB_POSTING=https://your-n8n.com/webhook/job-posting
|
||||
N8N_WEBHOOK_FIVE_WHYS=https://your-n8n.com/webhook/five-whys
|
||||
```
|
||||
3. Verify workflows are active in your N8N instance
|
||||
|
||||
### Step 6: Custom Domain (Optional)
|
||||
1. Go to project Settings → Domains
|
||||
2. Add your custom domain (e.g., `quantumtaskai.com`)
|
||||
3. Update DNS records as instructed by Railway
|
||||
|
||||
@ -32,14 +32,23 @@ STRIPE_SECRET_KEY=sk_live_your_stripe_secret_key_here
|
||||
STRIPE_WEBHOOK_SECRET=whsec_your_webhook_endpoint_secret
|
||||
```
|
||||
|
||||
### 🤖 N8N AI Agent Webhooks
|
||||
### 🤖 N8N AI Agent Webhooks (External Server URLs)
|
||||
|
||||
⚠️ **IMPORTANT**: These URLs point to your SEPARATE N8N instance, NOT hosted on Railway with Django.
|
||||
|
||||
```bash
|
||||
# N8N Webhook URLs - Replace with your N8N instance
|
||||
N8N_WEBHOOK_DATA_ANALYZER=https://your-n8n-instance.com/webhook/data-analyzer
|
||||
N8N_WEBHOOK_FIVE_WHYS=https://your-n8n-instance.com/webhook/five-whys
|
||||
N8N_WEBHOOK_JOB_POSTING=https://your-n8n-instance.com/webhook/job-posting
|
||||
N8N_WEBHOOK_SOCIAL_ADS=https://your-n8n-instance.com/webhook/social-ads
|
||||
N8N_WEBHOOK_FAQ_GENERATOR=https://your-n8n-instance.com/webhook/faq-generator
|
||||
# N8N Webhook URLs - Replace with your actual N8N instance URLs
|
||||
# Option A: N8N Cloud
|
||||
N8N_WEBHOOK_DATA_ANALYZER=https://yourworkspace.app.n8n.cloud/webhook/data-analyzer
|
||||
N8N_WEBHOOK_FIVE_WHYS=https://yourworkspace.app.n8n.cloud/webhook/five-whys
|
||||
N8N_WEBHOOK_JOB_POSTING=https://yourworkspace.app.n8n.cloud/webhook/job-posting
|
||||
N8N_WEBHOOK_SOCIAL_ADS=https://yourworkspace.app.n8n.cloud/webhook/social-ads
|
||||
|
||||
# Option B: Self-hosted or separate Railway N8N project
|
||||
# N8N_WEBHOOK_DATA_ANALYZER=https://your-n8n-server.com/webhook/data-analyzer
|
||||
# N8N_WEBHOOK_FIVE_WHYS=https://your-n8n-server.com/webhook/five-whys
|
||||
# N8N_WEBHOOK_JOB_POSTING=https://your-n8n-server.com/webhook/job-posting
|
||||
# N8N_WEBHOOK_SOCIAL_ADS=https://your-n8n-server.com/webhook/social-ads
|
||||
```
|
||||
|
||||
### 🌤️ External API Keys
|
||||
@ -79,10 +88,27 @@ print(get_random_secret_key())
|
||||
5. Create webhook endpoint: `https://your-domain.railway.app/wallet/stripe/webhook/`
|
||||
6. Copy the webhook signing secret (starts with `whsec_`)
|
||||
|
||||
### Step 4: N8N Webhook URLs
|
||||
1. Deploy your N8N instance (can use Railway, Heroku, or self-hosted)
|
||||
2. Create workflows for each AI agent
|
||||
3. Copy the webhook URLs from each workflow
|
||||
### Step 4: N8N Webhook URLs (Separate Server)
|
||||
|
||||
⚠️ **N8N RUNS SEPARATELY** from your Django app. Choose one hosting option:
|
||||
|
||||
**Option A: N8N Cloud (Easiest)**
|
||||
1. Sign up at [n8n.cloud](https://n8n.cloud)
|
||||
2. Import your workflow JSON files from agent directories
|
||||
3. Configure OpenAI API credentials in N8N
|
||||
4. Copy webhook URLs from each workflow
|
||||
5. Add URLs to Railway environment variables
|
||||
|
||||
**Option B: Separate Railway Project for N8N**
|
||||
1. Create a NEW Railway project (different from your Django app)
|
||||
2. Deploy N8N using Railway's template or Docker
|
||||
3. Import workflows and configure credentials
|
||||
4. Copy webhook URLs and add to Django app environment
|
||||
|
||||
**Option C: Self-Hosted N8N**
|
||||
1. Deploy N8N on DigitalOcean, AWS, VPS, or local server
|
||||
2. Ensure server is publicly accessible for webhook calls
|
||||
3. Import workflows and get webhook URLs
|
||||
4. Ensure N8N workflows are active and accessible
|
||||
|
||||
### Step 5: OpenWeather API
|
||||
|
||||
79
data_analyzer/n8n_workflows/README.md
Normal file
79
data_analyzer/n8n_workflows/README.md
Normal file
@ -0,0 +1,79 @@
|
||||
# Data Analyzer Agent - N8N Workflow
|
||||
|
||||
## Overview
|
||||
This directory contains the N8N workflow configuration for the Data Analyzer Agent, which processes uploaded files (CSV, Excel, PDF) and provides intelligent data analysis.
|
||||
|
||||
## Workflow Files
|
||||
- `workflow.json` - Production workflow for N8N import
|
||||
- `workflow_dev.json` - Development/testing version (optional)
|
||||
- `workflow_backup.json` - Backup version for disaster recovery
|
||||
|
||||
## Webhook Configuration
|
||||
- **Webhook URL**: Configured via `N8N_WEBHOOK_DATA_ANALYZER` environment variable
|
||||
- **HTTP Method**: POST
|
||||
- **Expected Data Format**:
|
||||
```json
|
||||
{
|
||||
"file_name": "data.csv",
|
||||
"file_content": "base64_encoded_content",
|
||||
"analysis_type": "statistical",
|
||||
"user_request": "Analyze sales trends"
|
||||
}
|
||||
```
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Import Workflow to N8N
|
||||
1. Open your N8N instance
|
||||
2. Click "Import from File" or "Import from URL"
|
||||
3. Upload the `workflow.json` file
|
||||
4. Configure credentials (OpenAI API key, etc.)
|
||||
5. Activate the workflow
|
||||
|
||||
### 2. Configure Webhook URL
|
||||
1. Copy the webhook URL from N8N
|
||||
2. Set environment variable: `N8N_WEBHOOK_DATA_ANALYZER=https://your-n8n.com/webhook/data-analyzer`
|
||||
3. Restart your Django application
|
||||
|
||||
### 3. Test the Workflow
|
||||
```bash
|
||||
# Test via Django application
|
||||
python manage.py test_webhook data_analyzer
|
||||
|
||||
# Or test directly via curl
|
||||
curl -X POST https://your-n8n.com/webhook/data-analyzer \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"file_name":"test.csv","file_content":"dGVzdA==","analysis_type":"basic"}'
|
||||
```
|
||||
|
||||
## Workflow Components
|
||||
- **Webhook Node**: Receives requests from Django application
|
||||
- **AI Processing**: Uses OpenAI GPT-4 for data analysis
|
||||
- **Response Node**: Returns structured analysis results
|
||||
- **Error Handling**: Manages failures and timeouts
|
||||
|
||||
## Expected Response Format
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"analysis": {
|
||||
"summary": "Data analysis summary",
|
||||
"insights": ["Key insight 1", "Key insight 2"],
|
||||
"recommendations": ["Recommendation 1", "Recommendation 2"],
|
||||
"charts": [{"type": "bar", "data": {...}}]
|
||||
},
|
||||
"processing_time": 1.5
|
||||
}
|
||||
```
|
||||
|
||||
## Troubleshooting
|
||||
- **Webhook not responding**: Check N8N workflow is active and URL is correct
|
||||
- **Authentication errors**: Verify OpenAI API credentials in N8N
|
||||
- **Timeout issues**: Increase workflow timeout settings for large files
|
||||
- **Rate limiting**: Monitor OpenAI API usage limits
|
||||
|
||||
## Maintenance
|
||||
- Regularly backup workflow configurations
|
||||
- Monitor workflow execution logs in N8N
|
||||
- Update AI prompts based on user feedback
|
||||
- Scale webhook handling based on usage patterns
|
||||
316
data_analyzer/n8n_workflows/pdf_data_analyzer.json
Normal file
316
data_analyzer/n8n_workflows/pdf_data_analyzer.json
Normal file
@ -0,0 +1,316 @@
|
||||
{
|
||||
"name": "pdf_data_analyzer",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"content": "## Error Handling\n\nIf processing fails, the workflow will return an error response with details about what went wrong.",
|
||||
"height": 120,
|
||||
"width": 280
|
||||
},
|
||||
"id": "03452a38-11bc-40e4-abfd-66a3b2d28d10",
|
||||
"name": "Error Info",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
560,
|
||||
2840
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Handle any errors that occur during processing\nconst error = $input.item(0).json.error || 'Unknown error occurred';\n\nreturn {\n json: {\n status: 'error',\n error_message: error,\n timestamp: new Date().toISOString(),\n help: 'Make sure you are uploading a valid PDF file using the \"file\" form field'\n }\n};"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-1000,
|
||||
2360
|
||||
],
|
||||
"id": "9888231c-5de1-4160-a53c-a951ca30417d",
|
||||
"name": "Error Handler"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"content": "## Simple PDF Processor\n\n**Purpose:** Upload PDF → Extract Text → AI Analysis → JSON Response\n\n**Usage:**\n```bash\ncurl -X POST https://your-n8n.com/webhook/simple-pdf-processor \\\n -F \"file=@document.pdf\"\n```\n\n**Response:** AI analysis of PDF content in JSON format",
|
||||
"height": 280,
|
||||
"width": 350
|
||||
},
|
||||
"id": "cb3831b1-8b8f-4726-991f-0de535bbdc9c",
|
||||
"name": "Workflow Overview1",
|
||||
"type": "n8n-nodes-base.stickyNote",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-740,
|
||||
2500
|
||||
]
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "json",
|
||||
"responseBody": "={{$('Error Handler').item.json}}",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
-780,
|
||||
2360
|
||||
],
|
||||
"id": "6603a971-fb15-41a3-b5b9-001bb13305ad",
|
||||
"name": "Return Error Response1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Simple PDF file preparation\nconst items = $input.all();\n\nif (!items || items.length === 0) {\n throw new Error('No input data received');\n}\n\nconst item = items[0];\nconsole.log('Processing PDF upload...');\n\n// Check if we have binary data\nif (!item.binary || !item.binary.file) {\n throw new Error('No PDF file found in upload. Make sure to use \"file\" as the form field name.');\n}\n\nconst fileData = item.binary.file;\nconst fileName = fileData.fileName || 'uploaded.pdf';\nconst fileSize = fileData.fileSize || 0;\n\nconsole.log(`File: ${fileName}, Size: ${fileSize} bytes`);\n\n// Prepare data for PDF extraction\nreturn {\n json: {\n filename: fileName,\n fileSize: fileSize,\n uploadedAt: new Date().toISOString(),\n status: 'ready_for_processing'\n },\n binary: {\n // Use the key expected by extractFromFile node\n 'pdf_file': fileData\n }\n};"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
100,
|
||||
2040
|
||||
],
|
||||
"id": "93f3dc69-190e-4c32-8175-e9d098873e8e",
|
||||
"name": "Prepare PDF Data"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"jsCode": "// Ultra-simple n8n formatting code\nconst items = $input.all();\nconst text = items[0].json.text;\n\n// Split by headings and format\nconst sections = text.split('### ').filter(part => part.trim());\n\nconst formatted = sections.map(section => {\n const lines = section.trim().split('\\n');\n const heading = lines[0];\n const content = lines.slice(1).join('\\n');\n \n return {\n heading: heading,\n content: content\n };\n});\n\nreturn [{\n json: {\n sections: formatted,\n timestamp: new Date().toISOString()\n }\n}];"
|
||||
},
|
||||
"type": "n8n-nodes-base.code",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
916,
|
||||
2040
|
||||
],
|
||||
"id": "5b160fd8-0a8b-4494-9935-7d9bf7db880f",
|
||||
"name": "Format Response"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"respondWith": "json",
|
||||
"responseBody": "={{$('Format Response').item.json}}",
|
||||
"options": {
|
||||
"responseHeaders": {
|
||||
"entries": [
|
||||
{
|
||||
"name": "Content-Type",
|
||||
"value": "application/json"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
},
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1136,
|
||||
2040
|
||||
],
|
||||
"id": "1bc45e3e-b86b-4a7d-9970-e8464d09f9a1",
|
||||
"name": "Return JSON Response"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "simple-pdf-processor",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 2,
|
||||
"position": [
|
||||
-120,
|
||||
2040
|
||||
],
|
||||
"id": "c380ce52-58c5-4c38-946b-7e86a2c645c3",
|
||||
"name": "PDF Upload Webhook1",
|
||||
"webhookId": "simple-pdf-processor"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"operation": "pdf",
|
||||
"binaryPropertyName": "pdf_file",
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.extractFromFile",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
320,
|
||||
2040
|
||||
],
|
||||
"id": "bcd3c33b-5376-43b6-9312-3570fb2799ca",
|
||||
"name": "Extract PDF Text1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "={{ $json.text }}",
|
||||
"messages": {
|
||||
"messageValues": [
|
||||
{
|
||||
"type": "AIMessagePromptTemplate",
|
||||
"message": "You are a helpful document analysis assistant. Analyze the provided PDF text content and provide useful insights."
|
||||
},
|
||||
{
|
||||
"message": "Please analyze this PDF document and provide:\n\n1. **Summary**: A brief overview of the document content\n2. **Key Points**: Main topics or important information found\n3. **Document Type**: What type of document this appears to be\n4. **Insights**: Any notable findings or analysis\n\nDocument text to analyze:\n{{ $json.text }}\n\nPlease provide your analysis in a clear, structured format."
|
||||
}
|
||||
]
|
||||
},
|
||||
"batching": {}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.chainLlm",
|
||||
"typeVersion": 1.7,
|
||||
"position": [
|
||||
540,
|
||||
2040
|
||||
],
|
||||
"id": "76ac82c9-1843-4ebe-98f7-bdd9b45d3610",
|
||||
"name": "AI Document Analyzer1"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"model": "llama-3.3-70b-versatile",
|
||||
"options": {
|
||||
"maxTokensToSample": 2000,
|
||||
"temperature": 0.3
|
||||
}
|
||||
},
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatGroq",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
628,
|
||||
2260
|
||||
],
|
||||
"id": "d3fce174-1ef1-4b0f-84f3-477c49a80840",
|
||||
"name": "Groq Chat Model1",
|
||||
"credentials": {
|
||||
"groqApi": {
|
||||
"id": "9HviwDANITBPqb1I",
|
||||
"name": "Groq account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"formTitle": "FIle Upload",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "file",
|
||||
"fieldType": "file",
|
||||
"multipleFiles": false
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.2,
|
||||
"position": [
|
||||
-120,
|
||||
2400
|
||||
],
|
||||
"id": "de020e99-cde6-4575-afb0-c568fe0e5d63",
|
||||
"name": "On form submission",
|
||||
"webhookId": "98b18862-a0e7-4760-9c5e-8fcaef9e2904"
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"Error Handler": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Return Error Response1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Prepare PDF Data": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Extract PDF Text1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Format Response": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Return JSON Response",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"PDF Upload Webhook1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Prepare PDF Data",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Extract PDF Text1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Document Analyzer1",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"AI Document Analyzer1": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Format Response",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Groq Chat Model1": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Document Analyzer1",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "bbc54db8-5559-4e50-ac33-01638aa0eec0",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "b419dceeef095c7882b7f3bc7ba03f620c77ec1f3d9d0518174b97d631dd49fa"
|
||||
},
|
||||
"id": "52D41BRLEfcyh22J",
|
||||
"tags": [
|
||||
{
|
||||
"createdAt": "2025-07-01T13:54:51.754Z",
|
||||
"updatedAt": "2025-07-01T13:54:51.754Z",
|
||||
"id": "2ji4EAexY8bmiTeM",
|
||||
"name": "AI Agent"
|
||||
}
|
||||
]
|
||||
}
|
||||
55
deploy_n8n_workflows.sh
Executable file
55
deploy_n8n_workflows.sh
Executable file
@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
# N8N Workflow Deployment Script for Quantum Tasks AI
|
||||
# This script helps deploy N8N workflows during application deployment
|
||||
|
||||
set -e
|
||||
|
||||
echo "🚀 Deploying N8N Workflows for Quantum Tasks AI"
|
||||
echo "================================================="
|
||||
|
||||
# Check environment variables
|
||||
if [ -z "$N8N_BASE_URL" ]; then
|
||||
echo "⚠️ N8N_BASE_URL not set, using default: http://localhost:5678"
|
||||
export N8N_BASE_URL="http://localhost:5678"
|
||||
fi
|
||||
|
||||
if [ -z "$N8N_API_KEY" ]; then
|
||||
echo "⚠️ N8N_API_KEY not set - some operations may fail"
|
||||
fi
|
||||
|
||||
# Check if Python script exists
|
||||
if [ ! -f "manage_n8n_workflows.py" ]; then
|
||||
echo "❌ manage_n8n_workflows.py not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# List available workflows
|
||||
echo "📋 Checking available workflows..."
|
||||
python3 manage_n8n_workflows.py list
|
||||
|
||||
echo ""
|
||||
echo "🔄 Starting workflow sync..."
|
||||
|
||||
# Sync all workflows
|
||||
python3 manage_n8n_workflows.py sync
|
||||
|
||||
echo ""
|
||||
echo "💾 Creating backup of current workflows..."
|
||||
|
||||
# Create backup
|
||||
python3 manage_n8n_workflows.py backup
|
||||
|
||||
echo ""
|
||||
echo "✅ N8N workflow deployment completed!"
|
||||
echo ""
|
||||
echo "📝 Next steps:"
|
||||
echo "1. Verify workflows are active in your N8N instance"
|
||||
echo "2. Test webhook endpoints with your Django application"
|
||||
echo "3. Monitor workflow execution logs"
|
||||
echo ""
|
||||
echo "🔗 Webhook URLs should be configured in environment variables:"
|
||||
echo " - N8N_WEBHOOK_DATA_ANALYZER"
|
||||
echo " - N8N_WEBHOOK_SOCIAL_ADS"
|
||||
echo " - N8N_WEBHOOK_JOB_POSTING"
|
||||
echo " - N8N_WEBHOOK_FIVE_WHYS"
|
||||
219
five_whys_analyzer/n8n_workflows/5_whys.json
Normal file
219
five_whys_analyzer/n8n_workflows/5_whys.json
Normal file
File diff suppressed because one or more lines are too long
141
five_whys_analyzer/n8n_workflows/README.md
Normal file
141
five_whys_analyzer/n8n_workflows/README.md
Normal file
@ -0,0 +1,141 @@
|
||||
# Five Whys Analyzer Agent - N8N Workflow
|
||||
|
||||
## Overview
|
||||
This directory contains the N8N workflow configuration for the Five Whys Analyzer Agent, which conducts systematic root cause analysis using the proven Five Whys methodology.
|
||||
|
||||
## Workflow Files
|
||||
- `workflow.json` - Production workflow for N8N import
|
||||
- `workflow_dev.json` - Development/testing version (optional)
|
||||
- `workflow_backup.json` - Backup version for disaster recovery
|
||||
|
||||
## Webhook Configuration
|
||||
- **Webhook URL**: Configured via `N8N_WEBHOOK_FIVE_WHYS` environment variable
|
||||
- **HTTP Method**: POST
|
||||
- **Expected Data Format**:
|
||||
```json
|
||||
{
|
||||
"problem": "Website conversion rate dropped by 30%",
|
||||
"context": "E-commerce site, occurred after recent update",
|
||||
"industry": "retail",
|
||||
"stakeholders": ["marketing team", "dev team", "customers"],
|
||||
"additional_info": "Peak season, mobile traffic increased"
|
||||
}
|
||||
```
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Import Workflow to N8N
|
||||
1. Open your N8N instance
|
||||
2. Click "Import from File" or "Import from URL"
|
||||
3. Upload the `workflow.json` file
|
||||
4. Configure credentials (OpenAI API key, etc.)
|
||||
5. Activate the workflow
|
||||
|
||||
### 2. Configure Webhook URL
|
||||
1. Copy the webhook URL from N8N
|
||||
2. Set environment variable: `N8N_WEBHOOK_FIVE_WHYS=https://your-n8n.com/webhook/five-whys`
|
||||
3. Restart your Django application
|
||||
|
||||
### 3. Test the Workflow
|
||||
```bash
|
||||
# Test via Django application
|
||||
python manage.py test_webhook five_whys_analyzer
|
||||
|
||||
# Or test directly via curl
|
||||
curl -X POST https://your-n8n.com/webhook/five-whys \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"problem":"Customer complaints increased","context":"After product launch","industry":"saas"}'
|
||||
```
|
||||
|
||||
## Workflow Components
|
||||
- **Webhook Node**: Receives requests from Django application
|
||||
- **Problem Analysis**: Systematic Five Whys questioning process
|
||||
- **AI Processing**: Uses OpenAI GPT-4 for intelligent analysis
|
||||
- **Root Cause Identification**: Identifies underlying causes
|
||||
- **Action Planning**: Generates actionable recommendations
|
||||
- **Response Node**: Returns structured analysis results
|
||||
- **Error Handling**: Manages analysis failures and edge cases
|
||||
|
||||
## Expected Response Format
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"analysis": {
|
||||
"problem_statement": "Website conversion rate dropped by 30%",
|
||||
"five_whys_sequence": [
|
||||
{
|
||||
"question": "Why did the conversion rate drop?",
|
||||
"answer": "Users are abandoning checkout process"
|
||||
},
|
||||
{
|
||||
"question": "Why are users abandoning checkout?",
|
||||
"answer": "Page loading times increased significantly"
|
||||
},
|
||||
{
|
||||
"question": "Why did loading times increase?",
|
||||
"answer": "New payment integration is slow"
|
||||
},
|
||||
{
|
||||
"question": "Why is the payment integration slow?",
|
||||
"answer": "Third-party API has latency issues"
|
||||
},
|
||||
{
|
||||
"question": "Why wasn't this tested before deployment?",
|
||||
"answer": "Load testing didn't include payment flow"
|
||||
}
|
||||
],
|
||||
"root_causes": [
|
||||
"Inadequate load testing procedures",
|
||||
"Third-party API performance issues",
|
||||
"Missing performance monitoring for payment flow"
|
||||
],
|
||||
"immediate_actions": [
|
||||
"Switch to backup payment provider",
|
||||
"Optimize payment integration code",
|
||||
"Add performance monitoring"
|
||||
],
|
||||
"long_term_solutions": [
|
||||
"Implement comprehensive load testing",
|
||||
"Establish SLA requirements for third parties",
|
||||
"Create performance regression testing"
|
||||
],
|
||||
"prevention_strategies": [
|
||||
"Include all critical paths in testing",
|
||||
"Monitor third-party dependencies",
|
||||
"Establish performance baselines"
|
||||
]
|
||||
},
|
||||
"confidence_level": "high",
|
||||
"recommended_timeline": "immediate: 1-2 days, long-term: 2-4 weeks"
|
||||
}
|
||||
```
|
||||
|
||||
## Analysis Categories
|
||||
- **Technical Issues**: Software bugs, performance problems
|
||||
- **Process Problems**: Workflow inefficiencies, communication gaps
|
||||
- **Human Factors**: Training gaps, resource constraints
|
||||
- **External Factors**: Market changes, supplier issues
|
||||
- **System Issues**: Infrastructure, tools, technology stack
|
||||
|
||||
## Industry Applications
|
||||
- Software Development (bugs, performance)
|
||||
- Manufacturing (quality issues, downtime)
|
||||
- Customer Service (complaint resolution)
|
||||
- Marketing (campaign performance)
|
||||
- Operations (process inefficiencies)
|
||||
- Sales (conversion problems)
|
||||
|
||||
## Troubleshooting
|
||||
- **Shallow analysis**: Provide more context and stakeholder info
|
||||
- **Generic recommendations**: Include industry-specific details
|
||||
- **Missing root causes**: Ensure problem description is comprehensive
|
||||
- **Incomplete action items**: Specify timeline and resource constraints
|
||||
|
||||
## Best Practices
|
||||
- Provide comprehensive problem context
|
||||
- Include all relevant stakeholders
|
||||
- Specify industry for targeted analysis
|
||||
- Be specific about problem symptoms
|
||||
- Include timeline and impact information
|
||||
- Follow up on recommended actions
|
||||
- Document lessons learned for future reference
|
||||
300
job_posting_generator/n8n_workflows/Job_Posting_Generator.json
Normal file
300
job_posting_generator/n8n_workflows/Job_Posting_Generator.json
Normal file
@ -0,0 +1,300 @@
|
||||
{
|
||||
"name": "Job Posting Generator",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "gpt-4o"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "8bc1629f-d935-4fa8-bbb9-b55403207400",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
968,
|
||||
1020
|
||||
],
|
||||
"typeVersion": 1.2,
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "uzyuJ5c9nml2NneC",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"sessionIdType": "customKey",
|
||||
"sessionKey": "={{ $('Set Web Input').item.json.body.sessionId }}",
|
||||
"contextWindowLength": 50
|
||||
},
|
||||
"id": "93a19f8c-f3e3-4094-bbe7-019bcb5bdd0e",
|
||||
"name": "Simple Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
1088,
|
||||
1020
|
||||
],
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "={{ $json.body.message.text }}",
|
||||
"options": {
|
||||
"systemMessage": "=You are an expert recruitment copywriter. Your task is to craft engaging and compelling job postings that attract top talent. For each job posting, use the provided input details (such as job title, responsibilities, qualifications, company information, and benefits) to:\n\nWrite a clear and enticing job title.\n\nSummarize the company and its culture in a way that excites candidates.\n\nClearly describe the role’s responsibilities and day-to-day tasks.\n\nList the Job title, About us, Job Overview, Responsibilities, required qualifications and preferred skills, Location and How to Apply in an appealing, concise manner.\n\nHighlight unique benefits and growth opportunities.\n\nUse inclusive, positive, and motivating language throughout.\n\nEnsure the posting is well-structured, easy to read, and free of jargon.\n\nYour goal is to make each job posting stand out and appeal to high-quality candidates, while accurately reflecting the role and company."
|
||||
}
|
||||
},
|
||||
"id": "1838d72d-12da-4351-beea-8625f60ff88d",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
940,
|
||||
800
|
||||
],
|
||||
"typeVersion": 1.9
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{$('Telegram Trigger').first().json.message.chat.id}}",
|
||||
"text": "={{ $json.output }}",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "ce2d4d37-c3cb-4dd0-9b70-9e1db9830e74",
|
||||
"name": "Send Response To Telegram",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"position": [
|
||||
500,
|
||||
440
|
||||
],
|
||||
"webhookId": "702bcdca-5297-4faf-9759-4f570d127052",
|
||||
"typeVersion": 1.2,
|
||||
"disabled": true
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "43f84411-eaaa-488c-9b1f-856e90d0aaf6",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
500,
|
||||
800
|
||||
],
|
||||
"id": "a02855f5-0b5c-47de-b098-19cd10932d88",
|
||||
"webhookId": "43f84411-eaaa-488c-9b1f-856e90d0aaf6"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"name": "Set Web Input",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
720,
|
||||
800
|
||||
],
|
||||
"id": "8c87b34b-9119-4f29-baea-9a6b74efc937"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"name": "Respond to Web",
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1316,
|
||||
800
|
||||
],
|
||||
"id": "e8ae02fc-93c3-476e-b01c-e60656ccfaac"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"formTitle": "Job Posting",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Job title"
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Company Name"
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Describe what you'd like to generate",
|
||||
"fieldType": "textarea"
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Seniority",
|
||||
"fieldType": "dropdown",
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Junior"
|
||||
},
|
||||
{
|
||||
"option": "Mid-level"
|
||||
},
|
||||
{
|
||||
"option": "Senior"
|
||||
},
|
||||
{
|
||||
"option": "Lead"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Contract Type",
|
||||
"fieldType": "dropdown",
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Full-Time"
|
||||
},
|
||||
{
|
||||
"option": "Part-Time"
|
||||
},
|
||||
{
|
||||
"option": "Freelance"
|
||||
},
|
||||
{
|
||||
"option": "Internship"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Location",
|
||||
"fieldType": "dropdown",
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Remote"
|
||||
},
|
||||
{
|
||||
"option": "On-Site"
|
||||
},
|
||||
{
|
||||
"option": "Hybrid"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Language"
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Company Website"
|
||||
},
|
||||
{
|
||||
"fieldLabel": "How to Apply"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.2,
|
||||
"position": [
|
||||
500,
|
||||
180
|
||||
],
|
||||
"id": "0ad79a28-0909-4b88-bba0-e013cf4eae6d",
|
||||
"name": "On form submission",
|
||||
"webhookId": "75ac3236-9040-478a-88b4-e0bcce17fdf1",
|
||||
"disabled": true
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Web",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Simple Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Web Input",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Web Input": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "b0e25b31-2e02-4d60-9ee3-4b512dc25fad",
|
||||
"meta": {
|
||||
"instanceId": "b419dceeef095c7882b7f3bc7ba03f620c77ec1f3d9d0518174b97d631dd49fa"
|
||||
},
|
||||
"id": "nHrugmW7FvbKSlen",
|
||||
"tags": [
|
||||
{
|
||||
"createdAt": "2025-07-01T13:54:51.754Z",
|
||||
"updatedAt": "2025-07-01T13:54:51.754Z",
|
||||
"id": "2ji4EAexY8bmiTeM",
|
||||
"name": "AI Agent"
|
||||
}
|
||||
]
|
||||
}
|
||||
120
job_posting_generator/n8n_workflows/README.md
Normal file
120
job_posting_generator/n8n_workflows/README.md
Normal file
@ -0,0 +1,120 @@
|
||||
# Job Posting Generator Agent - N8N Workflow
|
||||
|
||||
## Overview
|
||||
This directory contains the N8N workflow configuration for the Job Posting Generator Agent, which creates comprehensive, professional job postings that attract qualified candidates.
|
||||
|
||||
## Workflow Files
|
||||
- `workflow.json` - Production workflow for N8N import
|
||||
- `workflow_dev.json` - Development/testing version (optional)
|
||||
- `workflow_backup.json` - Backup version for disaster recovery
|
||||
|
||||
## Webhook Configuration
|
||||
- **Webhook URL**: Configured via `N8N_WEBHOOK_JOB_POSTING` environment variable
|
||||
- **HTTP Method**: POST
|
||||
- **Expected Data Format**:
|
||||
```json
|
||||
{
|
||||
"position": "Senior Python Developer",
|
||||
"company": "Tech Startup Inc",
|
||||
"location": "New York, NY",
|
||||
"experience_level": "senior",
|
||||
"salary_range": "$120,000 - $150,000",
|
||||
"responsibilities": ["API development", "Team leadership"],
|
||||
"skills": ["Python", "Django", "PostgreSQL"],
|
||||
"industry": "fintech"
|
||||
}
|
||||
```
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Import Workflow to N8N
|
||||
1. Open your N8N instance
|
||||
2. Click "Import from File" or "Import from URL"
|
||||
3. Upload the `workflow.json` file
|
||||
4. Configure credentials (OpenAI API key, etc.)
|
||||
5. Activate the workflow
|
||||
|
||||
### 2. Configure Webhook URL
|
||||
1. Copy the webhook URL from N8N
|
||||
2. Set environment variable: `N8N_WEBHOOK_JOB_POSTING=https://your-n8n.com/webhook/job-posting`
|
||||
3. Restart your Django application
|
||||
|
||||
### 3. Test the Workflow
|
||||
```bash
|
||||
# Test via Django application
|
||||
python manage.py test_webhook job_posting_generator
|
||||
|
||||
# Or test directly via curl
|
||||
curl -X POST https://your-n8n.com/webhook/job-posting \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"position":"Software Engineer","company":"Acme Corp","location":"Remote","experience_level":"mid"}'
|
||||
```
|
||||
|
||||
## Workflow Components
|
||||
- **Webhook Node**: Receives requests from Django application
|
||||
- **AI Processing**: Uses OpenAI GPT-4 for job posting generation
|
||||
- **Industry Optimization**: Tailors language for specific industries
|
||||
- **Compliance Check**: Ensures legal compliance and inclusive language
|
||||
- **Response Node**: Returns structured job posting content
|
||||
- **Error Handling**: Manages generation failures and validation errors
|
||||
|
||||
## Expected Response Format
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"job_posting": {
|
||||
"title": "Senior Python Developer",
|
||||
"company_overview": "Join our innovative fintech startup...",
|
||||
"job_description": "We are seeking an experienced Python developer...",
|
||||
"key_responsibilities": [
|
||||
"Design and implement scalable APIs",
|
||||
"Lead technical discussions and code reviews",
|
||||
"Mentor junior developers"
|
||||
],
|
||||
"requirements": {
|
||||
"required": ["5+ years Python experience", "Django framework"],
|
||||
"preferred": ["PostgreSQL", "AWS experience", "Team leadership"]
|
||||
},
|
||||
"benefits": [
|
||||
"Competitive salary and equity",
|
||||
"Health, dental, vision insurance",
|
||||
"Flexible work arrangements"
|
||||
],
|
||||
"application_instructions": "Send resume and cover letter to...",
|
||||
"equal_opportunity_statement": "We are an equal opportunity employer..."
|
||||
},
|
||||
"seo_keywords": ["python developer", "django", "fintech"],
|
||||
"posting_platforms": ["linkedin", "indeed", "glassdoor"]
|
||||
}
|
||||
```
|
||||
|
||||
## Industry Specializations
|
||||
- Technology/Software
|
||||
- Healthcare
|
||||
- Finance/Fintech
|
||||
- Marketing/Advertising
|
||||
- Manufacturing
|
||||
- Education
|
||||
- Non-profit
|
||||
- Government
|
||||
|
||||
## Compliance Features
|
||||
- Equal opportunity language
|
||||
- ADA compliance considerations
|
||||
- Salary transparency requirements
|
||||
- Location-specific labor law compliance
|
||||
- Inclusive language recommendations
|
||||
|
||||
## Troubleshooting
|
||||
- **Generic postings**: Provide more company and role specifics
|
||||
- **Compliance warnings**: Review generated content for bias
|
||||
- **Missing requirements**: Ensure all mandatory fields are provided
|
||||
- **Industry mismatch**: Verify industry parameter is correct
|
||||
|
||||
## Best Practices
|
||||
- Provide detailed company culture information
|
||||
- Specify exact technical requirements
|
||||
- Include growth opportunities and career path
|
||||
- Use inclusive, welcoming language
|
||||
- Optimize for relevant job board algorithms
|
||||
- A/B test different posting variations
|
||||
268
manage_n8n_workflows.py
Executable file
268
manage_n8n_workflows.py
Executable file
@ -0,0 +1,268 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
N8N Workflow Management Script for Quantum Tasks AI
|
||||
|
||||
This script helps manage N8N workflows for webhook-based agents:
|
||||
- Import workflows to N8N instance
|
||||
- Export workflows from N8N instance
|
||||
- Sync workflows between local files and N8N
|
||||
- Backup and restore workflows
|
||||
|
||||
Usage:
|
||||
python manage_n8n_workflows.py import [agent_name]
|
||||
python manage_n8n_workflows.py export [agent_name]
|
||||
python manage_n8n_workflows.py sync
|
||||
python manage_n8n_workflows.py backup
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import json
|
||||
import requests
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
import argparse
|
||||
|
||||
# Configuration
|
||||
N8N_BASE_URL = os.getenv('N8N_BASE_URL', 'http://localhost:5678')
|
||||
N8N_API_KEY = os.getenv('N8N_API_KEY', '')
|
||||
|
||||
# Webhook-based agents that need N8N workflows
|
||||
WEBHOOK_AGENTS = [
|
||||
'data_analyzer',
|
||||
'social_ads_generator',
|
||||
'job_posting_generator',
|
||||
'five_whys_analyzer'
|
||||
]
|
||||
|
||||
class N8NWorkflowManager:
|
||||
def __init__(self):
|
||||
self.base_url = N8N_BASE_URL
|
||||
self.api_key = N8N_API_KEY
|
||||
self.headers = {
|
||||
'Content-Type': 'application/json',
|
||||
'X-N8N-API-KEY': self.api_key
|
||||
} if self.api_key else {'Content-Type': 'application/json'}
|
||||
|
||||
def get_workflow_path(self, agent_name):
|
||||
"""Get the workflow directory path for an agent"""
|
||||
return Path(f"{agent_name}/n8n_workflows")
|
||||
|
||||
def load_workflow_json(self, agent_name, filename='workflow.json'):
|
||||
"""Load workflow JSON from agent directory"""
|
||||
workflow_path = self.get_workflow_path(agent_name) / filename
|
||||
if not workflow_path.exists():
|
||||
print(f"❌ Workflow file not found: {workflow_path}")
|
||||
return None
|
||||
|
||||
try:
|
||||
with open(workflow_path, 'r') as f:
|
||||
return json.load(f)
|
||||
except json.JSONDecodeError as e:
|
||||
print(f"❌ Invalid JSON in {workflow_path}: {e}")
|
||||
return None
|
||||
|
||||
def save_workflow_json(self, agent_name, workflow_data, filename='workflow.json'):
|
||||
"""Save workflow JSON to agent directory"""
|
||||
workflow_path = self.get_workflow_path(agent_name)
|
||||
workflow_path.mkdir(exist_ok=True)
|
||||
|
||||
filepath = workflow_path / filename
|
||||
with open(filepath, 'w') as f:
|
||||
json.dump(workflow_data, f, indent=2)
|
||||
|
||||
print(f"✅ Workflow saved: {filepath}")
|
||||
|
||||
def import_workflow_to_n8n(self, agent_name):
|
||||
"""Import workflow from local file to N8N instance"""
|
||||
print(f"📥 Importing workflow for {agent_name}...")
|
||||
|
||||
workflow_data = self.load_workflow_json(agent_name)
|
||||
if not workflow_data:
|
||||
return False
|
||||
|
||||
# Create workflow in N8N
|
||||
try:
|
||||
response = requests.post(
|
||||
f"{self.base_url}/api/v1/workflows",
|
||||
headers=self.headers,
|
||||
json=workflow_data
|
||||
)
|
||||
|
||||
if response.status_code == 201:
|
||||
workflow_id = response.json().get('id')
|
||||
print(f"✅ Workflow imported successfully: ID {workflow_id}")
|
||||
|
||||
# Activate the workflow
|
||||
activate_response = requests.post(
|
||||
f"{self.base_url}/api/v1/workflows/{workflow_id}/activate",
|
||||
headers=self.headers
|
||||
)
|
||||
|
||||
if activate_response.status_code == 200:
|
||||
print(f"✅ Workflow activated successfully")
|
||||
else:
|
||||
print(f"⚠️ Workflow imported but activation failed: {activate_response.text}")
|
||||
|
||||
return True
|
||||
else:
|
||||
print(f"❌ Import failed: {response.status_code} - {response.text}")
|
||||
return False
|
||||
|
||||
except requests.RequestException as e:
|
||||
print(f"❌ Connection error: {e}")
|
||||
return False
|
||||
|
||||
def export_workflow_from_n8n(self, agent_name, workflow_name=None):
|
||||
"""Export workflow from N8N instance to local file"""
|
||||
print(f"📤 Exporting workflow for {agent_name}...")
|
||||
|
||||
if not workflow_name:
|
||||
workflow_name = f"{agent_name.replace('_', ' ').title()} Agent"
|
||||
|
||||
try:
|
||||
# Get all workflows
|
||||
response = requests.get(
|
||||
f"{self.base_url}/api/v1/workflows",
|
||||
headers=self.headers
|
||||
)
|
||||
|
||||
if response.status_code != 200:
|
||||
print(f"❌ Failed to fetch workflows: {response.text}")
|
||||
return False
|
||||
|
||||
workflows = response.json()
|
||||
|
||||
# Find workflow by name
|
||||
target_workflow = None
|
||||
for workflow in workflows:
|
||||
if workflow.get('name', '').lower() == workflow_name.lower():
|
||||
target_workflow = workflow
|
||||
break
|
||||
|
||||
if not target_workflow:
|
||||
print(f"❌ Workflow '{workflow_name}' not found in N8N")
|
||||
print("Available workflows:")
|
||||
for wf in workflows:
|
||||
print(f" - {wf.get('name', 'Unnamed')}")
|
||||
return False
|
||||
|
||||
# Save workflow with timestamp
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
self.save_workflow_json(agent_name, target_workflow, f"workflow_exported_{timestamp}.json")
|
||||
|
||||
# Also save as main workflow file
|
||||
self.save_workflow_json(agent_name, target_workflow, "workflow.json")
|
||||
|
||||
return True
|
||||
|
||||
except requests.RequestException as e:
|
||||
print(f"❌ Connection error: {e}")
|
||||
return False
|
||||
|
||||
def backup_all_workflows(self):
|
||||
"""Backup all workflows to timestamped files"""
|
||||
print("🔄 Backing up all workflows...")
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
|
||||
for agent_name in WEBHOOK_AGENTS:
|
||||
workflow_path = self.get_workflow_path(agent_name)
|
||||
if (workflow_path / "workflow.json").exists():
|
||||
workflow_data = self.load_workflow_json(agent_name)
|
||||
if workflow_data:
|
||||
self.save_workflow_json(agent_name, workflow_data, f"workflow_backup_{timestamp}.json")
|
||||
print(f"✅ Backed up {agent_name} workflow")
|
||||
|
||||
def sync_workflows(self):
|
||||
"""Sync workflows between local files and N8N instance"""
|
||||
print("🔄 Syncing all workflows...")
|
||||
|
||||
for agent_name in WEBHOOK_AGENTS:
|
||||
print(f"\n--- {agent_name} ---")
|
||||
|
||||
# Check if local workflow exists
|
||||
if (self.get_workflow_path(agent_name) / "workflow.json").exists():
|
||||
print(f"📁 Local workflow found for {agent_name}")
|
||||
|
||||
# Try to import to N8N
|
||||
success = self.import_workflow_to_n8n(agent_name)
|
||||
if not success:
|
||||
print(f"⚠️ Failed to sync {agent_name} to N8N")
|
||||
else:
|
||||
print(f"❌ No local workflow found for {agent_name}")
|
||||
print(f"💡 Place your workflow JSON file at: {self.get_workflow_path(agent_name)}/workflow.json")
|
||||
|
||||
def list_workflows(self):
|
||||
"""List all workflows in N8N and local directories"""
|
||||
print("📋 Listing all workflows...\n")
|
||||
|
||||
# List N8N workflows
|
||||
try:
|
||||
response = requests.get(f"{self.base_url}/api/v1/workflows", headers=self.headers)
|
||||
if response.status_code == 200:
|
||||
workflows = response.json()
|
||||
print(f"🌐 N8N Instance ({len(workflows)} workflows):")
|
||||
for wf in workflows:
|
||||
status = "🟢 Active" if wf.get('active') else "🔴 Inactive"
|
||||
print(f" - {wf.get('name', 'Unnamed')} ({status})")
|
||||
else:
|
||||
print("❌ Could not connect to N8N instance")
|
||||
except requests.RequestException:
|
||||
print("❌ Could not connect to N8N instance")
|
||||
|
||||
print()
|
||||
|
||||
# List local workflows
|
||||
print("📁 Local Workflows:")
|
||||
for agent_name in WEBHOOK_AGENTS:
|
||||
workflow_path = self.get_workflow_path(agent_name)
|
||||
if workflow_path.exists():
|
||||
files = list(workflow_path.glob("*.json"))
|
||||
if files:
|
||||
print(f" {agent_name}: {len(files)} files")
|
||||
for file in files:
|
||||
print(f" - {file.name}")
|
||||
else:
|
||||
print(f" {agent_name}: No workflow files")
|
||||
else:
|
||||
print(f" {agent_name}: Directory not found")
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='N8N Workflow Management for Quantum Tasks AI')
|
||||
parser.add_argument('action', choices=['import', 'export', 'sync', 'backup', 'list'],
|
||||
help='Action to perform')
|
||||
parser.add_argument('agent', nargs='?', choices=WEBHOOK_AGENTS,
|
||||
help='Specific agent to operate on (for import/export)')
|
||||
parser.add_argument('--workflow-name', help='Workflow name in N8N (for export)')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
manager = N8NWorkflowManager()
|
||||
|
||||
if args.action == 'import':
|
||||
if not args.agent:
|
||||
print("❌ Please specify an agent name for import")
|
||||
print(f"Available agents: {', '.join(WEBHOOK_AGENTS)}")
|
||||
sys.exit(1)
|
||||
success = manager.import_workflow_to_n8n(args.agent)
|
||||
sys.exit(0 if success else 1)
|
||||
|
||||
elif args.action == 'export':
|
||||
if not args.agent:
|
||||
print("❌ Please specify an agent name for export")
|
||||
print(f"Available agents: {', '.join(WEBHOOK_AGENTS)}")
|
||||
sys.exit(1)
|
||||
success = manager.export_workflow_from_n8n(args.agent, args.workflow_name)
|
||||
sys.exit(0 if success else 1)
|
||||
|
||||
elif args.action == 'sync':
|
||||
manager.sync_workflows()
|
||||
|
||||
elif args.action == 'backup':
|
||||
manager.backup_all_workflows()
|
||||
|
||||
elif args.action == 'list':
|
||||
manager.list_workflows()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
97
social_ads_generator/n8n_workflows/README.md
Normal file
97
social_ads_generator/n8n_workflows/README.md
Normal file
@ -0,0 +1,97 @@
|
||||
# Social Ads Generator Agent - N8N Workflow
|
||||
|
||||
## Overview
|
||||
This directory contains the N8N workflow configuration for the Social Ads Generator Agent, which creates compelling social media advertisements for various platforms.
|
||||
|
||||
## Workflow Files
|
||||
- `workflow.json` - Production workflow for N8N import
|
||||
- `workflow_dev.json` - Development/testing version (optional)
|
||||
- `workflow_backup.json` - Backup version for disaster recovery
|
||||
|
||||
## Webhook Configuration
|
||||
- **Webhook URL**: Configured via `N8N_WEBHOOK_SOCIAL_ADS` environment variable
|
||||
- **HTTP Method**: POST
|
||||
- **Expected Data Format**:
|
||||
```json
|
||||
{
|
||||
"platform": "facebook",
|
||||
"product": "AI Marketing Tool",
|
||||
"audience": "small business owners",
|
||||
"tone": "professional",
|
||||
"features": ["automation", "analytics", "ROI tracking"],
|
||||
"requirements": "Include call-to-action"
|
||||
}
|
||||
```
|
||||
|
||||
## Setup Instructions
|
||||
|
||||
### 1. Import Workflow to N8N
|
||||
1. Open your N8N instance
|
||||
2. Click "Import from File" or "Import from URL"
|
||||
3. Upload the `workflow.json` file
|
||||
4. Configure credentials (OpenAI API key, etc.)
|
||||
5. Activate the workflow
|
||||
|
||||
### 2. Configure Webhook URL
|
||||
1. Copy the webhook URL from N8N
|
||||
2. Set environment variable: `N8N_WEBHOOK_SOCIAL_ADS=https://your-n8n.com/webhook/social-ads`
|
||||
3. Restart your Django application
|
||||
|
||||
### 3. Test the Workflow
|
||||
```bash
|
||||
# Test via Django application
|
||||
python manage.py test_webhook social_ads_generator
|
||||
|
||||
# Or test directly via curl
|
||||
curl -X POST https://your-n8n.com/webhook/social-ads \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"platform":"instagram","product":"Coffee Shop","audience":"coffee lovers","tone":"casual"}'
|
||||
```
|
||||
|
||||
## Workflow Components
|
||||
- **Webhook Node**: Receives requests from Django application
|
||||
- **AI Processing**: Uses OpenAI GPT-4 for ad content generation
|
||||
- **Platform Optimization**: Tailors content for specific social media platforms
|
||||
- **Response Node**: Returns structured ad content
|
||||
- **Error Handling**: Manages failures and content generation issues
|
||||
|
||||
## Expected Response Format
|
||||
```json
|
||||
{
|
||||
"success": true,
|
||||
"ad_content": {
|
||||
"headline": "Transform Your Business with AI",
|
||||
"body": "Discover how AI can revolutionize your marketing...",
|
||||
"call_to_action": "Start Free Trial",
|
||||
"hashtags": ["#AI", "#Marketing", "#Business"],
|
||||
"image_suggestions": ["professional team", "modern office"],
|
||||
"target_audience": "business professionals aged 25-45"
|
||||
},
|
||||
"platform_specs": {
|
||||
"character_limit": 280,
|
||||
"recommended_format": "image_post"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Supported Platforms
|
||||
- Facebook/Meta
|
||||
- Instagram
|
||||
- Twitter/X
|
||||
- LinkedIn
|
||||
- Google Ads
|
||||
- TikTok
|
||||
- Pinterest
|
||||
|
||||
## Troubleshooting
|
||||
- **Content not platform-optimized**: Check platform parameter is correct
|
||||
- **Generic content**: Provide more specific product/audience details
|
||||
- **API rate limits**: Monitor OpenAI usage and implement queuing
|
||||
- **Webhook timeouts**: Optimize prompts for faster generation
|
||||
|
||||
## Best Practices
|
||||
- Provide detailed product descriptions for better results
|
||||
- Specify target audience demographics clearly
|
||||
- Test generated content before publishing
|
||||
- A/B test different tone variations
|
||||
- Monitor ad performance and adjust prompts accordingly
|
||||
266
social_ads_generator/n8n_workflows/Social_Ads.json
Normal file
266
social_ads_generator/n8n_workflows/Social_Ads.json
Normal file
@ -0,0 +1,266 @@
|
||||
{
|
||||
"name": "Social Ads",
|
||||
"nodes": [
|
||||
{
|
||||
"parameters": {
|
||||
"model": {
|
||||
"__rl": true,
|
||||
"mode": "list",
|
||||
"value": "gpt-4o",
|
||||
"cachedResultName": "gpt-4o"
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"id": "5b2e2efd-32ab-4b6c-95cf-bfc73635ea2c",
|
||||
"name": "OpenAI Chat Model",
|
||||
"type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
|
||||
"position": [
|
||||
600,
|
||||
80
|
||||
],
|
||||
"typeVersion": 1.2,
|
||||
"credentials": {
|
||||
"openAiApi": {
|
||||
"id": "uzyuJ5c9nml2NneC",
|
||||
"name": "OpenAi account"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"sessionIdType": "customKey",
|
||||
"sessionKey": "={{ $('Set Web Input').item.json.body.sessionId }}",
|
||||
"contextWindowLength": 50
|
||||
},
|
||||
"id": "4240c19f-d502-43de-ab9a-3be9faa27bc3",
|
||||
"name": "Simple Memory",
|
||||
"type": "@n8n/n8n-nodes-langchain.memoryBufferWindow",
|
||||
"position": [
|
||||
780,
|
||||
100
|
||||
],
|
||||
"typeVersion": 1.3
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"promptType": "define",
|
||||
"text": "={{ $json.body.message.text }}",
|
||||
"options": {
|
||||
"systemMessage": "=You are an expert social media advertiser. Your task is to craft catchy social media ad copy based on the input provided. Each ad must capture attention instantly, using concise and persuasive messaging that motivates action. Focus on highlighting key benefits, unique selling points, or emotional triggers relevant to the input. Keep the tone engaging, positive, and tailored to the target audience. Avoid fluff and ensure the message is clear and impactful.\n\nFormat your response as follows:\n\nAd Copy:\n[Your concise, persuasive ad copy here]\n\nIf appropriate, include a strong call-to-action. Do not use hashtags or emojis unless specifically requested."
|
||||
}
|
||||
},
|
||||
"id": "8da21f34-ffaf-451b-8896-633fe84fa8ae",
|
||||
"name": "AI Agent",
|
||||
"type": "@n8n/n8n-nodes-langchain.agent",
|
||||
"position": [
|
||||
640,
|
||||
-180
|
||||
],
|
||||
"typeVersion": 1.9
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"chatId": "={{$('Telegram Trigger').first().json.message.chat.id}}",
|
||||
"text": "={{ $json.output }}",
|
||||
"additionalFields": {
|
||||
"appendAttribution": false
|
||||
}
|
||||
},
|
||||
"id": "dbd609e5-dbd9-45c6-ae80-687bcf21d857",
|
||||
"name": "Send Response To Telegram",
|
||||
"type": "n8n-nodes-base.telegram",
|
||||
"position": [
|
||||
1160,
|
||||
-300
|
||||
],
|
||||
"webhookId": "61937a8f-9757-40da-8ddb-c32b90ce1541",
|
||||
"typeVersion": 1.2,
|
||||
"disabled": true
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"httpMethod": "POST",
|
||||
"path": "2dc234d8-7217-454a-83e9-81afe5b4fe2d",
|
||||
"responseMode": "responseNode",
|
||||
"options": {}
|
||||
},
|
||||
"name": "Webhook",
|
||||
"type": "n8n-nodes-base.webhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
180,
|
||||
-40
|
||||
],
|
||||
"id": "9ceb26d2-34d9-41bc-9cdc-e318b8c5d174",
|
||||
"webhookId": "2dc234d8-7217-454a-83e9-81afe5b4fe2d"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"name": "Set Web Input",
|
||||
"type": "n8n-nodes-base.set",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
380,
|
||||
-60
|
||||
],
|
||||
"id": "aecc9c8d-710e-4df9-98f4-ae886e18d3f0"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"options": {}
|
||||
},
|
||||
"name": "Respond to Web",
|
||||
"type": "n8n-nodes-base.respondToWebhook",
|
||||
"typeVersion": 1,
|
||||
"position": [
|
||||
1160,
|
||||
60
|
||||
],
|
||||
"id": "8b0d18bf-0c13-44d4-bf92-b3509cbb3c8a"
|
||||
},
|
||||
{
|
||||
"parameters": {
|
||||
"formTitle": "Social Ads",
|
||||
"formFields": {
|
||||
"values": [
|
||||
{
|
||||
"fieldLabel": "Describe what you'd like to generate",
|
||||
"fieldType": "textarea"
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Include Emoji",
|
||||
"fieldType": "dropdown",
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Yes"
|
||||
},
|
||||
{
|
||||
"option": "No"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "For Social Media Platform",
|
||||
"fieldType": "dropdown",
|
||||
"fieldOptions": {
|
||||
"values": [
|
||||
{
|
||||
"option": "Facebook"
|
||||
},
|
||||
{
|
||||
"option": "Instagram"
|
||||
},
|
||||
{
|
||||
"option": "LinkedIn"
|
||||
},
|
||||
{
|
||||
"option": "X (Twitter)"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"fieldLabel": "Language"
|
||||
}
|
||||
]
|
||||
},
|
||||
"options": {}
|
||||
},
|
||||
"type": "n8n-nodes-base.formTrigger",
|
||||
"typeVersion": 2.2,
|
||||
"position": [
|
||||
200,
|
||||
-380
|
||||
],
|
||||
"id": "92974cef-cb9a-42cb-9054-8989cae4d37b",
|
||||
"name": "On form submission",
|
||||
"webhookId": "2daa7ed9-6823-4eea-8ce8-e0dfdfb1110d",
|
||||
"disabled": true
|
||||
}
|
||||
],
|
||||
"pinData": {},
|
||||
"connections": {
|
||||
"AI Agent": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Respond to Web",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Simple Memory": {
|
||||
"ai_memory": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_memory",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"OpenAI Chat Model": {
|
||||
"ai_languageModel": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "ai_languageModel",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Webhook": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "Set Web Input",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"Set Web Input": {
|
||||
"main": [
|
||||
[
|
||||
{
|
||||
"node": "AI Agent",
|
||||
"type": "main",
|
||||
"index": 0
|
||||
}
|
||||
]
|
||||
]
|
||||
},
|
||||
"On form submission": {
|
||||
"main": [
|
||||
[]
|
||||
]
|
||||
}
|
||||
},
|
||||
"active": true,
|
||||
"settings": {
|
||||
"executionOrder": "v1"
|
||||
},
|
||||
"versionId": "68aa150a-4be4-4922-b387-76f721c65295",
|
||||
"meta": {
|
||||
"templateCredsSetupCompleted": true,
|
||||
"instanceId": "b419dceeef095c7882b7f3bc7ba03f620c77ec1f3d9d0518174b97d631dd49fa"
|
||||
},
|
||||
"id": "d1bIXx3TKRtmdhpB",
|
||||
"tags": [
|
||||
{
|
||||
"createdAt": "2025-07-01T13:54:51.754Z",
|
||||
"updatedAt": "2025-07-01T13:54:51.754Z",
|
||||
"id": "2ji4EAexY8bmiTeM",
|
||||
"name": "AI Agent"
|
||||
}
|
||||
]
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user