Overview
Connect your n8n workflows to AgentFlow to automate complex business processes. Trigger workflows from chat conversations, process data automatically, and receive structured responses.Prerequisites
n8n Account
Self-hosted or n8n Cloud account
Webhook Access
Ability to create webhook nodes
API Key
n8n API key (optional, for authentication)
AgentFlow Admin
Admin access to AgentFlow
Step 1: Setup n8n Workflow
Create a New Workflow
- Log in to your n8n instance
- Click New Workflow
- Name it:
AgentFlow Chat Automation
Add Webhook Trigger
- Click + to add a node
- Search for Webhook
-
Configure the webhook:
- Method: POST
- Path:
/agentflow-trigger - Authentication: None (or API Key)
- Response Mode: Wait for Response
-
Copy the webhook URL (e.g.,
https://your-n8n-instance.com/webhook/abc123)
The webhook URL is your endpoint for AgentFlow integration.
Build Your Automation
Add nodes to process the incoming message:1
Parse Input
Add a Set node to extract message data:
2
Process Data
Add business logic nodes:
- HTTP Request - Call external APIs
- Code - Custom JavaScript/Python
- Database - Query/update data
- AI - OpenAI, Anthropic nodes
3
Format Response
Add a Set node for the response:
4
Return Response
Connect to Respond to Webhook node
- Set response body to your formatted data
- HTTP Status: 200
Example Workflow: Customer Support
Save and Activate
- Click Save (Ctrl+S)
- Toggle Active to enable the workflow
- Note your webhook URL
Step 2: Create AI Connection in AgentFlow
Manual Setup
- Go to Admin Dashboard → AI Models
- Click Add Model
-
Fill in details:
- Name:
n8n Customer Support Workflow - Model ID:
n8n-workflow-executor - Description:
Automated customer support via n8n
- Name:
-
Configure API:
- Endpoint:
https://your-n8n-instance.com/webhook/abc123 - Method: POST
- Endpoint:
-
Add headers (if using authentication):
-
Request schema:
-
Response path:
data.execution_result - Click Save
Step 3: Import via YAML Configuration
YAML Template
Createn8n-workflow-config.yaml:
Import Process
- Replace
{{workflow_id}}with your actual webhook path - Go to Admin Dashboard → AI Models
- Click Import Model
- Upload
n8n-workflow-config.yaml - Enter your n8n credentials
- Click Import
Step 4: Assign to Group
- Navigate to Admin Dashboard → Groups
- Select target group (e.g., “Support Team”)
- Click Manage Models
- Enable n8n Workflow Automation
- Set usage permissions:
- Can Execute: Yes
- Can View Logs: Yes
- Rate Limit: 100 requests/hour
- Click Save
Step 5: Use in Chat
Trigger Workflow from Chat
- Open Chat Interface
- Start a New Conversation
- Select n8n Workflow model
- Send a message to trigger the workflow
Example Interactions
Response Handling
The workflow response appears as a chat message:Advanced Workflows
Multi-Step Processing
1
Data Validation
2
AI Analysis
Add OpenAI node:
- Model: GPT-4
- Prompt:
Analyze: {{ $json.message }} - Extract: insights, sentiment, intent
3
Database Operations
4
External Integration
Call Slack, email, or other services with results
Conditional Logic
Error Handling
Workflow Templates
1. Customer Support Automation
2. Lead Qualification
3. Invoice Processing
n8n Cloud vs Self-Hosted
n8n Cloud Setup
- Sign up at n8n.cloud
- Create workflow
- Webhook URL:
https://yourname.app.n8n.cloud/webhook/... - Built-in authentication
- Automatic scaling
Self-Hosted Setup
1
Deploy n8n
2
Configure Reverse Proxy
3
Setup Authentication
Environment variables:
4
Get Webhook URL
Use:
https://n8n.yourdomain.com/webhook/...Troubleshooting
Webhook Timeout
Webhook Timeout
Symptoms: Requests timeout after 30 secondsSolutions:
- Increase timeout in AgentFlow config:
timeout: 300 - Use async execution in n8n
- Optimize workflow performance
Authentication Errors
Authentication Errors
Symptoms: 401 Unauthorized responsesSolutions:
- Verify API key is correct
- Check header format:
n8n-api-key - Ensure webhook authentication matches
Response Not Received
Response Not Received
Symptoms: Empty or malformed responsesSolutions:
- Check response path:
data.execution_result - Verify “Respond to Webhook” node
- Test workflow manually in n8n
Workflow Not Triggering
Workflow Not Triggering
Symptoms: Webhook receives request but workflow doesn’t executeSolutions:
- Ensure workflow is Active
- Check webhook node configuration
- Review n8n execution logs
Monitoring & Debugging
n8n Execution Logs
- Go to Executions in n8n
- Filter by workflow
- View detailed execution data
- Check error messages
AgentFlow Analytics
- Navigate to Analytics Dashboard
- Select n8n Workflow model
- Monitor:
- Success rate
- Response times
- Error patterns
Webhook Testing
Best Practices
Error Handling
Always include error handling nodes and fallback responses
Timeout Management
Set appropriate timeouts for long-running processes
Data Validation
Validate all incoming data before processing
Security
Use API keys and HTTPS for all webhooks
Logging
Log executions for debugging and compliance
Testing
Test workflows thoroughly before production