Overview
n8n is a powerful, self-hosted workflow automation tool. It’s perfect for teams that need full control over their data and want to run automations on their own infrastructure.n8n can be self-hosted for complete data privacy or used via n8n Cloud for a managed experience.
Why Use n8n?
Self-Hosted
Run on your own servers with complete data control and no external dependencies.
Open Source
Fully open-source with an active community and extensible architecture.
No Operation Limits
Self-hosted instances have no execution limits — run unlimited workflows.
Code When Needed
Write custom JavaScript/Python code directly in your workflows.
Setting Up Affonso Webhooks in n8n
Step 1: Create a New Workflow
- Open your n8n instance
- Click Add workflow
- Give it a name (e.g., “Affonso Webhook Handler”)
Step 2: Add a Webhook Node
- Click + to add a node
- Search for Webhook
- Configure the webhook:
- Copy the Production URL or Test URL

Step 3: Configure in Affonso
- Go to your Affonso dashboard → Settings → Webhooks
- Click Add Endpoint
- Paste the n8n webhook URL (use Production URL for live workflows)
- Select the events you want to receive
- Save and activate the endpoint
Step 4: Test the Webhook
- In n8n, click Listen for Test Event
- Trigger a test event in Affonso
- n8n will capture the webhook payload
- Review the incoming data structure
Step 5: Build Your Workflow
Add nodes to process the webhook:- IF: Branch based on conditions
- Switch: Route to different paths by event type
- Code: Custom JavaScript processing
- HTTP Request: Call external APIs
- Set: Transform data fields
Example Workflows
Event Router by Type
Route different webhook events to appropriate handlers.Signature Verification Workflow
Verify Affonso webhook signatures for security.Commission Tracking with Database
Store all transactions in PostgreSQL for reporting.Working with Webhook Data
Accessing Payload Fields
In n8n, access webhook data using expressions:Data Transformation with Set Node
Transform webhook data for downstream nodes:Custom Code Processing
Use the Code node for complex logic:Advanced Patterns
Retry Failed Webhooks
Handle temporary failures with retry logic:Batch Processing
Collect webhooks and process in batches:Environment-Based Configuration
Use environment variables for configuration:Docker Deployment
Self-host n8n with Docker for production use:Troubleshooting
Webhook not triggering
Webhook not triggering
- Use the Test URL first, then switch to Production URL
- Ensure your n8n instance is publicly accessible
- Check firewall rules allow incoming connections
- Verify the workflow is Active
Data not appearing in nodes
Data not appearing in nodes
- Click Execute Workflow while listening for test events
- Check the webhook path matches exactly
- Review the Executions tab for detailed logs
Self-hosted connectivity issues
Self-hosted connectivity issues
- Ensure your server has a valid SSL certificate
- Use a reverse proxy (nginx/Caddy) for HTTPS
- Check
WEBHOOK_URLenvironment variable is set correctly
High memory usage
High memory usage
- Enable execution data pruning in settings
- Process large payloads in batches
- Use the Split In Batches node for bulk operations
Best Practices
Use Error Workflow
Set up a global error workflow to catch and notify on failures across all workflows.
Version Control
Export workflows as JSON and store in Git for version control and backup.
Use Sub-Workflows
Break complex logic into reusable sub-workflows for maintainability.
Monitor Resources
Set up monitoring for your n8n instance CPU/memory usage in production.
