Skip to main content

N8N Integration

Connect Trix to N8N for bidirectional workflow automation.

Overview

A dedicated Trix community node for N8N is planned but not yet available. Currently, you can integrate Trix with N8N using the built-in HTTP Request node and webhook triggers as described below.

N8N is an open-source workflow automation tool. The Trix integration enables bidirectional workflows: trigger N8N workflows from Trix events, and manage memories from N8N workflows.

Triggers (Trix → N8N)
  • Memory created
  • Memory updated
  • Memory deleted
  • Search performed
  • Cluster detected
Actions (N8N → Trix)
  • Create memory
  • Update memory
  • Delete memory
  • Search memories
  • Get memory by ID

Setting Up N8N

1. Set Up the Trix Integration

The Trix N8N integration uses HTTP requests and webhooks — no community node package is needed. You can use N8N's built-in HTTP Request node to call the Trix API directly.

2. Configure Credentials

Add your Trix API key in N8N:

  1. Go to Credentials in N8N
  2. Click Add Credential
  3. Search for Trix API
  4. Enter your API key and base URL
credentials.json
{
  "apiKey": "gdb_abc123...",
  "baseUrl": "https://api.trixdb.com/v1"
}

Webhook Triggers

Trix can send webhook events to N8N when memories change. Configure webhooks in your Trix account settings or via API.

Setting Up a Trigger

register-webhook.sh
# Register webhook endpoint
curl -X POST https://api.trixdb.com/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://your-n8n-instance.com/webhook/trix",
    "events": ["memory.created", "memory.updated"],
    "secret": "your_webhook_secret"
  }'

Webhook Payload

webhook-payload.json
{
  "event": "memory.created",
  "timestamp": "2024-01-15T10:30:00Z",
  "data": {
    "memory": {
      "id": "mem_abc123",
      "content": "Meeting notes from Q1 planning...",
      "content_type": "text",
      "tags": ["meeting", "planning"],
      "created_at": "2024-01-15T10:30:00Z"
    }
  }
}

Trix signs webhook requests with HMAC-SHA256. Configure your webhook secret in N8N to verify request authenticity.

N8N Actions

Create Memory

Add memories from any N8N workflow:

create-action.json
{
  "operation": "create",
  "content": "{{ $json.text }}",
  "contentType": "text",
  "tags": ["n8n", "automated"],
  "metadata": {
    "source_workflow": "{{ $workflow.name }}",
    "source_node": "{{ $node.name }}"
  }
}

Search Memories

Search Trix from your workflows:

search-action.json
{
  "operation": "search",
  "query": "{{ $json.searchTerm }}",
  "limit": 10,
  "filters": {
    "tags": ["important"]
  }
}

Update Memory

update-action.json
{
  "operation": "update",
  "memoryId": "{{ $json.memoryId }}",
  "tags": ["processed", "reviewed"],
  "metadata": {
    "reviewed_at": "{{ $now.toISO() }}",
    "reviewed_by": "n8n_workflow"
  }
}

Example Workflows

Auto-tag New Memories

Automatically categorize memories based on content:

auto-tag-workflow.txt
Trix Trigger (memory.created)
    ↓
IF Contains "meeting"
    ↓
Trix Update (add tag: "meeting")
    ↓
Slack Notification

Sync from External Source

Import data from other services as memories:

rss-sync-workflow.txt
Schedule Trigger (daily)
    ↓
HTTP Request (fetch RSS feed)
    ↓
Split Items
    ↓
Trix Create Memory (for each item)

Memory-Powered Responses

Use memories to enhance automated responses:

rag-workflow.txt
Webhook Trigger (incoming question)
    ↓
Trix Search (query: question)
    ↓
OpenAI (generate response with context)
    ↓
HTTP Response

Security

Webhook Signature Verification

Configure webhook signature verification to ensure requests come from Trix:

verify-signature.js
// In N8N Function node
const crypto = require('crypto');

const signature = $input.first().headers['x-trix-signature'];
const secret = $credentials.webhookSecret;
const payload = JSON.stringify($input.first().body);

const expected = crypto
  .createHmac('sha256', secret)
  .update(payload)
  .digest('hex');

if (signature !== `sha256=${expected}`) {
  throw new Error('Invalid webhook signature');
}

return $input.all();

Always verify webhook signatures in production. Set the N8N_WEBHOOK_SECRET environment variable and configure the same secret in your N8N credentials.

Direct API Usage

If you prefer not to use the Trix node, you can use N8N's HTTP Request node directly with the Trix API:

http-request.json
{
  "method": "POST",
  "url": "https://api.trixdb.com/v1/memories",
  "authentication": "predefinedCredentialType",
  "nodeCredentialType": "httpHeaderAuth",
  "headers": {
    "Content-Type": "application/json"
  },
  "body": {
    "content": "{{ $json.content }}",
    "tags": ["n8n"]
  }
}

Troubleshooting

Webhook Not Triggering

  1. Verify the webhook URL is publicly accessible
  2. Check that the webhook is registered and active in Trix
  3. Review N8N execution logs for errors
  4. Ensure the webhook secret matches between Trix and N8N

Authentication Errors

  1. Verify your API key is correct and active
  2. Check that the API key has the required permissions
  3. Ensure the base URL is correct (no trailing slash)

Rate Limiting

If you're hitting rate limits, add delays between operations or batch multiple operations together.