Back to n8n Automation Tool

n8n Integration Guide

Connect your customer-owned n8n instance (Cloud or self-hosted) with ChatCoat for bi-directional workflow automation.

Architecture Model

ChatCoat uses a zero-cloud-lock-in architecture for n8n. You connect your own n8n instance using standard webhooks and API authentication. ChatCoat remains fully operational independently of n8n.

ChatCoat → n8n (Outbound Events)

ChatCoat fires real-time HMAC-SHA256 signed webhooks to your n8n Webhook node on events like new leads, comments, published posts, and RSS articles.

n8n → ChatCoat (Inbound Actions)

Your n8n workflows trigger ChatCoat actions (create lead, schedule campaign, reply to comment) using an n8n HTTP Request node with Bearer token authentication.

1. Outbound Events (ChatCoat → n8n)

Trigger your n8n workflows whenever things happen in ChatCoat.

Step 1: Create an n8n Webhook Node

  1. In your n8n canvas, add a Webhook trigger node.
  2. Set HTTP Method to POST.
  3. Copy the Production URL (e.g. https://n8n.yourdomain.com/webhook/chatcoat-events).
  4. Go to n8n Automation in ChatCoat, paste the URL, and select the events you want to receive.

Step 2: Normalized Event Envelope

Every outbound event adheres to a standard, normalized JSON envelope:

Normalized Webhook Payload (JSON)
{
  "event_id": "evt_01hx7a9bcdef...",
  "event_type": "lead.created",
  "timestamp": "2026-09-24T18:00:00Z",
  "organization_id": "org_2t...",
  "resource_id": "lead_123...",
  "version": "1.0",
  "payload": {
    "lead_id": "lead_123...",
    "platform": "instagram",
    "username": "sarah_growth",
    "display_name": "Sarah Miller",
    "intent": "Interested in marketing automation demo",
    "source_comment_text": "How can I try this out?",
    "status": "new",
    "tags": ["social-lead", "instagram"]
  }
}

Step 3: HMAC-SHA256 Signature Verification

ChatCoat signs every delivery using HMAC-SHA256. The signature is provided in the header:

X-ChatCoat-Signature: sha256=d58d348a2be88544a47...

To verify this in n8n, add a Code node right after your Webhook node:

n8n Code Node (JavaScript)
const crypto = require('crypto');

const secret = 'YOUR_CHATCOAT_WEBHOOK_SECRET';
const signatureHeader = $input.first().json.headers['x-chatcoat-signature'] || '';
const rawBody = JSON.stringify($input.first().json.body);

const expectedSignature = 'sha256=' + crypto
  .createHmac('sha256', secret)
  .update(rawBody)
  .digest('hex');

if (signatureHeader !== expectedSignature) {
  throw new Error('Invalid signature: Payload verification failed');
}

return $input.first();

Available Event Types

lead.created

Fires when a new lead is captured from comments or messages.

campaign.published

Fires when all posts in a campaign are published across platforms.

post.published

Fires when an individual post goes live on a specific network.

comment.replied

Fires when a social comment receives a reply via UI, AI, or API.

rss.item.new

Fires when a fresh article is ingested from any tracked RSS/Atom feed.

social_account.connected

Fires when a new channel (Meta, X, LinkedIn, YouTube) is connected.

2. Inbound Actions (n8n → ChatCoat)

Call ChatCoat endpoints from n8n using an HTTP Request node.

Step 1: Authentication

Generate an API Key on the n8n Automation page. Keys begin with cca_n8n_... and are securely tied to your organization.

Header: Authorization
Value: Bearer cca_n8n_abcdef123456...

Action: Create a Lead

HTTP Request Node: POST /api/leads
Method: POST
URL: https://api.chatcoat.com/api/leads

Headers:
  Authorization: Bearer YOUR_N8N_KEY
  Content-Type: application/json

Body (JSON):
{
  "platform": "website_contact_form",
  "username": "alex_johnson",
  "display_name": "Alex Johnson",
  "source_comment_text": "Signed up on landing page",
  "intent": "Enterprise pricing inquiry",
  "tags": ["n8n-sync", "website"]
}

Action: Reply to a Social Comment

HTTP Request Node: POST /api/comments/{comment_id}/reply
Method: POST
URL: https://api.chatcoat.com/api/comments/COMMENT_ID/reply

Headers:
  Authorization: Bearer YOUR_N8N_KEY
  Content-Type: application/json

Body (JSON):
{
  "message_text": "Thanks for reaching out! Check your DMs for the link."
}

Action: Create Campaign from RSS Item

HTTP Request Node: POST /api/rss/items/{item_id}/create-campaign
Method: POST
URL: https://api.chatcoat.com/api/rss/items/ITEM_ID/create-campaign

Headers:
  Authorization: Bearer YOUR_N8N_KEY
  Content-Type: application/json

Body (JSON):
{
  "platforms": ["instagram", "facebook", "linkedin"]
}