n8n Integration

Connect Chatsby to n8n for self-hosted, open-source workflow automation. Covers webhook triggers, example workflows, and troubleshooting.

n8n Integration

n8n is an open-source, self-hostable workflow automation platform that gives you full control over your data and infrastructure. If your organization requires data sovereignty, needs to run automations on-premises, or prefers the flexibility of a self-hosted solution, the Chatsby n8n integration is the ideal choice. Connect your Chatsby AI agent to n8n to trigger workflows when conversations start, leads are captured, ratings are submitted, or custom Actions fire --- all without sending data through third-party cloud services.

Overview

The Chatsby n8n integration works through webhooks. Chatsby sends real-time HTTP POST requests to your n8n instance whenever configured events occur. n8n receives these webhook payloads and executes your workflow, which can include any of n8n's 400+ built-in integrations --- databases, CRMs, messaging platforms, APIs, and more.

FeatureDescription
Self-hostedYour data stays on your infrastructure. No third-party cloud services involved
Real-time webhooksEvents are delivered to n8n in real time with minimal latency
Full workflow controlBuild complex, multi-step workflows with conditional logic, loops, and data transformations
400+ integrationsn8n supports hundreds of services out of the box, plus custom HTTP requests for anything else

Prerequisites

RequirementDetails
n8n instanceA running n8n instance (self-hosted or n8n Cloud). See n8n.io for installation instructions
Publicly accessible URLYour n8n instance must be reachable from the internet for Chatsby webhooks to reach it (or use a tunnel like ngrok for development)
Chatsby agentA trained agent with webhook configuration access
Chatsby API keyAvailable under Settings > API Keys in the Chatsby dashboard

If your n8n instance is behind a firewall or running locally, use a tunneling service like ngrok during development. For production, deploy n8n to a server with a public IP address or domain.

Available Trigger Events

The following Chatsby events can trigger n8n workflows via webhooks:

EventDescriptionPayload Includes
New ConversationA visitor starts a new conversationConversation ID, first message, timestamp, page URL, visitor metadata
New Contact CapturedThe agent captures contact informationContact name, email, phone, conversation ID
Low Rating ReceivedA visitor submits a low ratingConversation ID, rating value, transcript, visitor info
Action TriggeredA custom Chatsby Action firesAction name, data payload, conversation ID, visitor info

Setup

Create a Webhook Node in n8n

Open your n8n editor and create a new workflow. Add a Webhook node as the trigger. Set the HTTP method to POST. n8n will generate a unique webhook URL --- copy this URL. It will look something like:

https://your-n8n-instance.com/webhook/abc123-def456

Click Listen for Test Event to put the webhook in listening mode.

Configure the Webhook in Chatsby

In your Chatsby dashboard, navigate to Settings > Webhooks for your agent. Click Add Webhook and enter the following:

  • URL: The webhook URL from your n8n Webhook node
  • Events: Select the events you want to trigger workflows for (e.g., New Conversation, New Contact Captured)
  • Secret (optional): Set a shared secret for webhook signature verification

Click Save.

Test the Webhook

Trigger a test event by starting a conversation with your Chatsby agent. In n8n, you should see the incoming webhook payload appear in the Webhook node. Click Stop Listening once you have received the test data.

Build Your Workflow

Add action nodes after the Webhook trigger to process the incoming data. For example, add a Slack node to send a notification, a Google Sheets node to log the conversation, or an HTTP Request node to call a custom API. Connect the nodes and configure each one with the appropriate field mappings from the webhook payload.

Activate the Workflow

Once your workflow is tested and working, toggle the Active switch in n8n to enable it. The workflow will now run automatically every time the configured Chatsby event occurs.

Webhook Payload Format

When a Chatsby event fires, the webhook sends a JSON payload to your n8n instance. Here is an example payload for the New Conversation event:

{
  "event": "conversation.created",
  "timestamp": "2026-04-02T14:30:00Z",
  "agent_id": "agent_abc123",
  "data": {
    "conversation_id": "conv_xyz789",
    "first_message": "Hi, I have a question about your pricing.",
    "page_url": "https://example.com/pricing",
    "visitor": {
      "name": null,
      "email": null,
      "ip_country": "US",
      "user_agent": "Mozilla/5.0..."
    }
  }
}

For the New Contact Captured event:

{
  "event": "contact.captured",
  "timestamp": "2026-04-02T14:32:00Z",
  "agent_id": "agent_abc123",
  "data": {
    "conversation_id": "conv_xyz789",
    "contact": {
      "name": "Jane Smith",
      "email": "[email protected]",
      "phone": "+1234567890"
    }
  }
}

Example Workflows

1. New Lead to CRM (HubSpot)

Webhook Trigger (New Contact Captured) --> HubSpot Node (Create Contact)

Map the webhook payload fields:

Webhook FieldHubSpot Field
data.contact.emailEmail
data.contact.nameContact Name
data.contact.phonePhone
data.conversation_idNotes

2. Low Rating to Slack Alert + Database Log

Webhook Trigger (Low Rating Received) --> Slack Node (Send Message) --> Postgres Node (Insert Row)

This workflow sends an immediate Slack alert to your support channel and simultaneously logs the low-rated conversation in a PostgreSQL database for analysis.

3. New Conversation to Google Sheets

Webhook Trigger (New Conversation) --> Google Sheets Node (Append Row)

Create a running log of all conversations in a spreadsheet for reporting and trend analysis.

4. Action Triggered to Custom API

Webhook Trigger (Action Triggered) --> IF Node (Check Action Name) --> HTTP Request Node (POST to custom API)

Use conditional logic to route different Action types to different endpoints. For example, route "schedule_demo" actions to your calendar API and "request_quote" actions to your sales system.

Webhook Signature Verification

For security, Chatsby signs webhook payloads with the secret you configured during setup. n8n can verify this signature to ensure the webhook is genuinely from Chatsby.

In your n8n Webhook node, add a Function node after the trigger to verify the signature:

const crypto = require('crypto');
const secret = 'YOUR_WEBHOOK_SECRET';
const signature = $input.first().headers['x-chatsby-signature'];
const payload = JSON.stringify($input.first().json);
const expected = crypto.createHmac('sha256', secret).update(payload).digest('hex');
 
if (signature !== expected) {
  throw new Error('Invalid webhook signature');
}
 
return $input.all();

Self-Hosted n8n Considerations

If you are self-hosting n8n, keep the following in mind:

  • Public accessibility --- Your n8n instance must be reachable from the internet for Chatsby webhooks to reach it. Configure your firewall, reverse proxy (e.g., Nginx), and DNS accordingly.
  • HTTPS --- Always use HTTPS for your webhook endpoint. Chatsby will not send webhooks to unencrypted HTTP URLs in production.
  • Persistence --- Ensure your n8n instance uses a persistent database (PostgreSQL or MySQL) rather than the default SQLite, especially for production workloads.
  • Scaling --- If you expect high conversation volumes, monitor your n8n instance's resource usage and scale accordingly. n8n can run in queue mode with multiple worker processes for high throughput.

Troubleshooting

Webhook Not Receiving Events

Possible CauseSolution
n8n instance not reachableVerify your n8n URL is publicly accessible. Test by visiting it in a browser or using curl
Workflow not activeToggle the Active switch in the n8n workflow editor
Wrong webhook URLCopy the URL directly from the n8n Webhook node and paste it in Chatsby
Firewall blocking requestsEnsure your server's firewall allows incoming HTTPS traffic on the port n8n uses
Chatsby webhook not savedRe-check the webhook configuration in Settings > Webhooks in your Chatsby dashboard

Workflow Execution Errors

If the webhook is received but the workflow fails:

  • Check the Executions tab in n8n for error details on each run.
  • Verify that all credentials (Slack, Google Sheets, databases) are correctly configured in n8n.
  • Ensure field mappings reference the correct paths in the webhook payload (e.g., data.contact.email, not contact.email).

Webhook Timeout

n8n expects workflow execution to complete within a reasonable time. If your workflow includes slow API calls or large data processing:

  • Use the Respond to Webhook node early in the workflow to send a 200 response to Chatsby immediately, then continue processing asynchronously.
  • This prevents Chatsby from retrying the webhook due to a timeout.

n8n vs. Zapier

Factorn8nZapier
HostingSelf-hosted or n8n CloudCloud only
Data sovereigntyFull control --- data never leaves your infrastructureData processed on Zapier's servers
PricingFree (self-hosted), or n8n Cloud plans starting at $20/moFree tier (100 tasks/mo), paid plans from $19.99/mo
Integrations400+ built-in nodes + custom HTTP requests5,000+ apps
Technical complexityMedium --- requires server management for self-hostedLow --- fully managed, no-code
Workflow complexityAdvanced --- supports code nodes, conditional logic, loopsModerate --- multi-step Zaps with filters

Choose n8n if data sovereignty, self-hosting, or advanced workflow logic is important to your organization. Choose Zapier if you prefer a fully managed, no-code experience with the widest app ecosystem. Both integrations work with the same Chatsby webhook events.