Help center

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

  1. Open your n8n instance (cloud or self-hosted)
  2. Create a new workflow
  3. Add a Webhook node
  4. 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)
  5. Save and activate the workflow
  6. Copy the webhook URL from the Webhook node

Step 2: Configure Axiforms

  1. Navigate to your form's SettingsIntegrations
  2. Click on n8n
  3. Enable the integration
  4. Paste the n8n webhook URL from Step 1
  5. (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)
  6. Click Create Integration

Step 3: Process Data in n8n

  1. Use the Test Webhook button in Axiforms to send test data
  2. In n8n, add nodes to process the webhook payload
  3. Connect to other services as needed
  4. 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

  1. Webhook node (receives Axiforms data)
  2. PostgreSQL (or your database) → Insert row
  3. Map responses to database columns

Transform and Send to API

  1. Webhook node

  2. 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 }];
    
  3. HTTP Request node to send to your API

Conditional Workflow

  1. Webhook node
  2. IF node to check conditions (e.g., email contains "@company.com")
  3. Branch 1: Send to internal system
  4. Branch 2: Send to external CRM

Multi-Step Processing

  1. Webhook node
  2. Function node to extract email
  3. HTTP Request to validate email via external API
  4. IF node based on validation result
  5. 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:

  1. Set a Secret Key in Axiforms's n8n integration settings
  2. 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();
  1. Continue processing only if signature is valid

Self-Hosted n8n

If you're using self-hosted n8n:

  1. Ensure your n8n instance is accessible from the internet
  2. Use HTTPS (Axiforms requires HTTPS for webhooks)
  3. Configure proper authentication/authorization
  4. Consider using n8n's webhook authentication features

Error Handling

n8n workflows should handle errors gracefully:

  1. Add Error Trigger nodes to catch failures
  2. Send notifications for failed workflows
  3. Log errors for debugging
  4. Configure retries in Axiforms settings (default: 3 attempts)

Best Practices

  1. Idempotency - Use responseId to prevent duplicate processing
  2. Error handling - Add error nodes to handle failures
  3. Logging - Log important data for debugging
  4. Performance - Keep workflows efficient for quick responses
  5. Testing - Use Axiforms's Test Webhook feature before going live
  6. 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)

Resources