n8n Integration
Connect Axiforms with n8n to build powerful automation workflows. n8n is an open-source workflow automation tool that gives you full control over your integrations.
Overview
The n8n integration sends form submission data to your n8n workflow webhooks, enabling you to:
- Process and transform form data
- Connect to any API or service
- Build complex multi-step workflows
- Self-host your automation infrastructure
- Create custom integrations without vendor lock-in
Setting Up n8n
Step 1: Create an n8n Webhook Workflow
- Open your n8n instance (cloud or self-hosted)
- Create a new workflow
- Add a Webhook node
- Configure the webhook:
- HTTP Method: POST
- Path: Choose a unique path (e.g.,
/axiforms) - Response Mode: "Respond to Webhook" (or "Last Node" if you want custom response)
- Save and activate the workflow
- Copy the webhook URL from the Webhook node
Step 2: Configure Axiforms
- Navigate to your form's Settings → Integrations
- Click on n8n
- Enable the integration
- Paste the n8n webhook URL from Step 1
- (Optional) Configure additional settings:
- Secret Key: For HMAC signature verification
- Custom Headers: Additional HTTP headers if needed
- Timeout: Request timeout (default: 30 seconds)
- Retries: Number of retry attempts (default: 3)
- Click Create Integration
Step 3: Process Data in n8n
- Use the Test Webhook button in Axiforms to send test data
- In n8n, add nodes to process the webhook payload
- Connect to other services as needed
- Activate your workflow
Webhook Payload Format
n8n receives the same standardized payload as regular webhooks:
{
"event": "form.submitted",
"projectId": "clx123...",
"responseId": "clx456...",
"submittedAt": "2024-01-15T10:30:00.000Z",
"metadata": {
"ip": "192.168.1.1",
"userAgent": "Mozilla/5.0...",
"referer": "https://example.com"
},
"responses": [
{
"blockId": "block_123",
"blockType": "text",
"label": "Full Name",
"value": "John Doe"
},
{
"blockId": "block_456",
"blockType": "email",
"label": "Email Address",
"value": "john@example.com"
}
],
"form": {
"id": "clx123...",
"name": "Contact Form",
"slug": "contact-form"
}
}
Example Workflows
Send to Database
- Webhook node (receives Axiforms data)
- PostgreSQL (or your database) → Insert row
- Map
responsesto database columns
Transform and Send to API
-
Webhook node
-
Code node to transform data:
const responses = $input.item.json.responses; const transformed = {}; responses.forEach((r) => { transformed[r.label || r.blockId] = r.value; }); return [{ json: transformed }]; -
HTTP Request node to send to your API
Conditional Workflow
- Webhook node
- IF node to check conditions (e.g., email contains "@company.com")
- Branch 1: Send to internal system
- Branch 2: Send to external CRM
Multi-Step Processing
- Webhook node
- Function node to extract email
- HTTP Request to validate email via external API
- IF node based on validation result
- Different actions for valid/invalid emails
Working with Form Responses
Access form fields in n8n using the responses array. Here are common patterns:
Extract Specific Field
Use a Code node:
// Find email field
const emailField = $input.item.json.responses.find(
(r) => r.blockType === "email"
);
return [{ json: { email: emailField?.value } }];
Convert Responses to Object
const responses = $input.item.json.responses;
const data = {};
responses.forEach((r) => {
// Use label if available, otherwise blockId
const key = r.label || r.blockId;
data[key] = r.value;
});
return [{ json: data }];
Filter Responses by Type
const responses = $input.item.json.responses;
const textFields = responses.filter((r) => r.blockType === "text");
const emailFields = responses.filter((r) => r.blockType === "email");
return [
{
json: {
texts: textFields.map((r) => r.value),
emails: emailFields.map((r) => r.value),
},
},
];
Security: HMAC Signatures
To verify webhook authenticity:
- Set a Secret Key in Axiforms's n8n integration settings
- In n8n, add a Function node to verify the signature:
const crypto = require("crypto");
// Get signature from headers
const signature = $input.item.json.headers["x-webhook-signature"];
const secret = "your-secret-key";
const payload = JSON.stringify($input.item.json.body);
// Compute HMAC
const hmac = crypto.createHmac("sha256", secret);
const computed = hmac.update(payload).digest("hex");
const expected = signature.replace("sha256=", "");
// Verify
if (computed !== expected) {
throw new Error("Invalid signature");
}
return $input.all();
- Continue processing only if signature is valid
Self-Hosted n8n
If you're using self-hosted n8n:
- Ensure your n8n instance is accessible from the internet
- Use HTTPS (Axiforms requires HTTPS for webhooks)
- Configure proper authentication/authorization
- Consider using n8n's webhook authentication features
Error Handling
n8n workflows should handle errors gracefully:
- Add Error Trigger nodes to catch failures
- Send notifications for failed workflows
- Log errors for debugging
- Configure retries in Axiforms settings (default: 3 attempts)
Best Practices
- Idempotency - Use
responseIdto prevent duplicate processing - Error handling - Add error nodes to handle failures
- Logging - Log important data for debugging
- Performance - Keep workflows efficient for quick responses
- Testing - Use Axiforms's Test Webhook feature before going live
- Documentation - Document your workflow logic and field mappings
Troubleshooting
Webhook not receiving data
- Verify the n8n webhook URL is correct and accessible
- Check that the workflow is activated in n8n
- Review n8n execution logs
- Ensure HTTPS is enabled (required by Axiforms)
Data transformation issues
- Use n8n's built-in debugger to inspect data at each node
- Check data types (strings vs numbers, etc.)
- Verify field names match your form structure
- Use n8n's data preview feature
Signature verification failing
- Ensure secret keys match exactly
- Verify you're using the raw request body for signature calculation
- Check that headers are accessed correctly (case-sensitive)