{"site":{"name":"Koji","description":"AI-native customer research platform that helps teams conduct, analyze, and synthesize customer interviews at scale.","url":"https://www.koji.so","contentTypes":["blog","documentation"],"lastUpdated":"2026-11-28T13:57:26.729Z"},"content":[{"type":"documentation","id":"adb8b15e-2219-4da4-a6f6-3aa081c1744b","slug":"n8n-research-automation","title":"Connect Koji to n8n: Build Self-Hosted Customer Research Pipelines","url":"https://www.koji.so/docs/n8n-research-automation","summary":"Connect Koji to n8n with a Webhook node: add its URL in a Koji study under Integrate, then Webhooks, and Koji sends a signed interview.completed event each time a participant finishes and the interview is scored. The event carries the interview and study IDs, your own participant ID, and the quality score, level and fraud risk. A Code node verifies the Standard Webhooks signature, drops test events and repeats, and an HTTP Request node can fetch the full transcript and analysis with an API key. Then route to Notion, Linear, Slack, HubSpot or any of n8n's 400+ integrations. Webhooks are on the Insights, Interviews and Enterprise plans. Self-hosted n8n keeps interview data on infrastructure you control, the key advantage over Zapier and Make for teams with data residency constraints. Setup takes about 15 minutes.","content":"**TL;DR:** Connect Koji to [n8n](https://n8n.io) and every completed AI interview can trigger a custom self-hosted workflow: create a Linear ticket from a low-quality-score conversation, route Enterprise-segment feedback to a Slack channel, append the transcript to a Notion database, score sentiment in a CRM record, or fan out to a dozen downstream tools at once. Setup takes about 15 minutes: add a Webhook node in n8n, paste its URL into your Koji study under **Integrate → Webhooks**, and Koji sends a signed `interview.completed` event to n8n each time a participant finishes. Then map the payload into any of n8n's 400+ integrations. Webhooks are included on the Insights, Interviews and Enterprise plans. The big advantage over Zapier or Make is data residency: n8n runs on infrastructure you control, so interview data never leaves your stack.\n\n---\n\n## Why n8n + Koji Is a Powerful Combination\n\nMost research automation platforms (Zapier, Make) live in a vendor cloud. That is fine for marketing automation but creates a real problem for customer interview data, which often contains PII, business-sensitive feedback, and direct customer quotes that compliance teams want on infrastructure the organization owns.\n\nn8n is the leading open-source workflow automation platform. You can self-host it on your own Kubernetes cluster, a single VPS, or even a Raspberry Pi for personal projects, and your data never traverses a SaaS automation vendor. It still gives you 400+ pre-built integrations — Notion, Linear, Jira, Slack, HubSpot, Salesforce, Airtable, Google Sheets, Postgres, S3, and so on — and a drag-and-drop visual editor.\n\nCombining n8n with Koji's API-driven AI research platform gives you the best of both worlds:\n\n- **AI-native research collection** — Koji runs the conversational interview, transcribes voice, scores quality, extracts themes, and pushes a signed event to your workflow the moment each interview is finished and scored.\n- **Self-hosted routing logic** — n8n decides where the data goes, how it is filtered, what it is enriched with, and which downstream systems are notified.\n\nTraditional research platforms (SurveyMonkey, Qualtrics) are built around forms and exports, with integrations focused on survey responses. Koji is designed API-first, which is why a five-node n8n workflow can replace a custom integration project.\n\n---\n\n## Prerequisites\n\nBefore you start:\n\n1. **A running n8n instance.** Either self-hosted (Docker, Kubernetes, or the official npm package) or n8n Cloud. The Webhook node works identically in both, as long as n8n is reachable at a public `https://` address. Koji refuses `localhost`, private networks and plain `http://`.\n2. **A Koji study on a plan with webhooks.** Webhooks are on the Insights, Interviews and Enterprise plans, not Free. [Create a study](/docs/creating-your-first-study) if you have not.\n3. **Workspace owner or admin rights in Koji.** Only owners and admins can add or change webhooks.\n4. **A Koji API key, if you want transcripts.** The webhook carries IDs, timing and quality signals, not the transcript. To pull the full interview, you need an API key for the study (API keys come with the Interviews and Enterprise plans).\n5. **A target destination tool.** For this guide we walk through Notion + Linear + Slack, but the same pattern works for any n8n node.\n\n---\n\n## Architecture: How the Pipeline Works\n\n```\nParticipant completes Koji interview\n        │\n        ▼\nKoji analysis runs (quality score, themes, structured answers, sentiment)\n        │\n        ▼\nKoji POSTs a signed interview.completed event to your n8n Webhook node\n        │\n        ▼\nn8n checks the signature, skips test events and repeats\n        │\n        ▼\n(optional) n8n fetches the full interview from data.links.api\n        │\n        ▼\nn8n routes by quality/segment via IF / Switch nodes\n        │\n        ├─→ Notion: append page with transcript + themes\n        ├─→ Linear: create ticket if quality_score < 3 (low signal needs review)\n        ├─→ Slack: alert the CS team for Enterprise segment\n        └─→ HubSpot: enrich the contact record with sentiment\n```\n\nThe whole flow is asynchronous. Koji only waits for n8n to answer with a 2xx, and n8n can fan out to dozens of destinations in parallel.\n\n---\n\n## Step 1: Create the n8n Webhook Node\n\nIn your n8n canvas:\n\n1. Click **Add first step** → choose **Webhook**.\n2. Set **HTTP Method** to `POST`.\n3. Replace the generated path with a long, random string, so the URL cannot be guessed.\n4. Set **Respond** to **Immediately**. Koji counts any 2xx answer within 10 seconds as delivered, so let n8n reply first and do the work afterwards.\n5. If you plan to verify signatures (Step 3), turn on **Raw Body** under the node's options, so you keep the exact bytes Koji signed.\n6. Copy the **Production URL**. The test URL only listens while you click **Listen for test event**, so use it for your first test and switch to the production URL when you activate the workflow.\n\n---\n\n## Step 2: Add the Webhook in Koji\n\nSwitch to the Koji web app:\n\n1. Open your study → **Integrate** → **Webhooks**.\n2. Click **Add webhook** and paste the n8n URL. Give it a name such as \"n8n pipeline\".\n3. Pick the `interview.completed` event.\n4. Choose **Only this study** (recommended) or **All studies, including new ones**. With the second option, use `data.study_id` in n8n to tell studies apart.\n5. Open the webhook and copy the signing secret (it starts with `whsec_`). Store it in n8n's credentials manager or an environment variable such as `KOJI_WEBHOOK_SECRET`.\n6. Click **Send test event**. Koji posts a `webhook.test` message with the real shape and obviously fake values, and n8n captures it as sample data for the nodes that follow.\n\nEach delivery is a JSON body like this (shortened):\n\n```json\n{\n  \"id\": \"msg_2f6c0d1e8a4b4c2d9e3f0a1b2c3d4e5f\",\n  \"type\": \"interview.completed\",\n  \"data\": {\n    \"interview_id\": \"9f4c1e2a-...\",\n    \"study_id\": \"3b8e1f2a-...\",\n    \"study_name\": \"Onboarding feedback\",\n    \"mode\": \"text\",\n    \"participant\": { \"external_id\": \"user_12345\", \"source\": \"csv_import\", \"panel\": null },\n    \"trust\": { \"quality_score\": 4, \"quality_level\": \"Good\", \"meets_quality_bar\": true, \"fraud_risk\": \"low\" },\n    \"links\": { \"api\": \"https://www.koji.so/api/v1/interviews/9f4c1e2a-...\", \"app\": \"https://www.koji.so/t/...\" }\n  }\n}\n```\n\n[Webhook Setup](/docs/webhook-setup) documents every field, the retry schedule and the delivery log.\n\n---\n\n## Step 3: Verify, Filter Test Events and Skip Repeats\n\nn8n does not check Standard Webhooks signatures on its own. Add a **Code** node after the Webhook node and paste:\n\n```javascript\n// Runs once per delivery. Checks the signature, drops test events\n// and repeats, and passes the event on.\nconst crypto = require('crypto');\nconst item = $input.first();\nconst headers = item.json.headers;\nconst raw = Buffer.from(item.binary.data.data, 'base64').toString('utf8');\n\nconst secret = $env.KOJI_WEBHOOK_SECRET;\nconst key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');\nconst signed = `${headers['webhook-id']}.${headers['webhook-timestamp']}.${raw}`;\nconst expected = crypto.createHmac('sha256', key).update(signed).digest('base64');\n\nconst valid = (headers['webhook-signature'] || '').split(' ').some(s => {\n  const sig = s.replace(/^v1,/, '');\n  return sig.length === expected.length &&\n    crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));\n});\nconst fresh = Math.abs(Date.now() / 1000 - Number(headers['webhook-timestamp'])) < 300;\nif (!valid || !fresh) throw new Error('Bad Koji signature');\n\nconst event = JSON.parse(raw);\nif (event.type !== 'interview.completed') return []; // webhook.test and anything new\n\nconst store = $getWorkflowStaticData('global');\nstore.seen = store.seen || {};\nif (store.seen[headers['webhook-id']]) return []; // a retry or a resend\nstore.seen[headers['webhook-id']] = true;\n\nreturn [{ json: event }];\n```\n\nOn self-hosted n8n, the Code node can only load `crypto` when the instance allows it: set `NODE_FUNCTION_ALLOW_BUILTIN=crypto` (and allow `$env` access) in n8n's environment. If you'd rather not verify inside n8n, treat the webhook URL itself as a secret and keep only the `type` filter and the repeat check.\n\nWhy the repeat check matters: Koji delivers at least once. A failed delivery is retried for about 35 hours, and anyone can resend it from the delivery log, always with the same `webhook-id`. Static data is fine for a small study. For high volume, record the IDs in Postgres or Redis instead.\n\n---\n\n## Step 4: Fetch the Full Interview (Optional)\n\nThe webhook says who finished and how good the interview was. For the transcript, themes and every answer, add an **HTTP Request** node:\n\n```\nGET {{ $json.data.links.api }}\nAuthorization: Bearer YOUR_KOJI_API_KEY\n```\n\nCreate the key in the Koji web app (open your study → **Settings → API Keys** → **Create API Key** with the `interview:read` permission) and store it in n8n's credentials manager. API keys are study scoped, so one key reads one study. See [User Research API](/docs/user-research-api-guide) for the full response.\n\n---\n\n## Step 5: Route by Quality, Segment, or Sentiment\n\nAdd a **Switch** node. Configure rules that branch on the payload:\n\n- Branch 1: `{{ $json.data.trust.quality_score >= 4 }}` → high-signal interviews\n- Branch 2: `{{ $json.data.trust.meets_quality_bar === false }}` → low-signal interviews that need researcher review\n- Branch 3: a segment you looked up from `data.participant.external_id` in your own CRM, or a field from the full interview, equals `enterprise` → Enterprise segment alerts\n\nEach branch flows to a different destination node.\n\n---\n\n## Step 6: Fan Out to Destinations\n\n### Notion: Append a Page With Transcript\n\nAdd a **Notion** node:\n\n- Operation: **Create Page**\n- Database: select your research repository database\n- Properties: map `Name` → `{{ $json.data.study_name }}`, `Quality` → `{{ $json.data.trust.quality_level }}`, `Participant` → `{{ $json.data.participant.external_id }}`\n- Body: add a **Heading** with the interview title, then a **Toggle** containing the AI-generated summary from Step 4, and a **Code Block** containing the structured answers JSON\n\n### Linear: Create a Ticket for Low-Quality Interviews\n\nIn the low-quality branch, add a **Linear** node:\n\n- Operation: **Create Issue**\n- Team: your research-ops team\n- Title: `Low-signal interview — review needed (quality {{ $json.data.trust.quality_score }})`\n- Description: include the link to the interview in Koji, `{{ $json.data.links.app }}`\n- Labels: `research-qa`, the segment, the study name\n\nThis is how research-ops teams catch interview design issues before they propagate — if quality scores trend low for one question, that question needs revision.\n\n### Slack: Alert on Enterprise Feedback\n\nIn the Enterprise-segment branch, add a **Slack** node:\n\n- Operation: **Post Message**\n- Channel: `#cs-enterprise-feedback`\n- Text: `New Enterprise interview in {{ $json.data.study_name }} from {{ $json.data.participant.external_id }}. Quality {{ $json.data.trust.quality_level }}. <{{ $json.data.links.app }}|Open in Koji>`\n\nCS leads love this pattern. Enterprise feedback gets human eyes within minutes of the interview ending.\n\n---\n\n## Step 7: Test the Pipeline End-to-End\n\n1. In n8n, click **Listen for test event** on the Webhook node (or activate the workflow if Koji points at the production URL).\n2. In Koji, click **Send test event** on the webhook. The delivery log should show a 2xx from n8n.\n3. Check n8n's executions list: the Code node should drop the `webhook.test` event. To test the full path, temporarily let test events through, then remove that change.\n4. Run a real interview through your published study and confirm the data lands in Notion / Linear / Slack.\n\nThe event arrives once Koji has finished and scored the interview, usually within a minute or two of the participant's last answer. If a delivery fails, the delivery log shows the status code n8n answered with, and you can resend it.\n\n---\n\n## Patterns That Scale\n\n### Idempotency\n\nRetries and resends reuse the same `webhook-id`, and workflows get re-run by hand. Make destination steps idempotent too: use `data.interview_id` as the Notion page lookup key, Linear external ID, etc. n8n's **Get Many** + **If exists** pattern works well.\n\n### Backpressure\n\nIf you run a high-volume study (1000+ interviews/day), put a **Queue** node (Redis or RabbitMQ) between the Code node and your destinations. n8n will then drain the queue at a controlled rate that respects downstream API limits, while the Webhook node keeps answering Koji fast.\n\n### A safety net\n\nWebhooks are the main signal, and polling is still there as a fallback. A nightly **Schedule Trigger** that calls `GET /api/v1/interviews/{id}` for the interviews you expected catches anything your workflow missed, for example while n8n was down for longer than the retry window. If an endpoint keeps failing for 3 days, Koji turns the webhook off and emails the workspace owners and admins; fix n8n, then turn it back on from the webhook's menu.\n\n### Enrichment\n\nAdd an HTTP Request node to call your own internal services with `data.participant.external_id` to enrich the payload with internal data (plan tier, ARR, account manager). This lets downstream destinations include business context the participant did not provide directly.\n\n### Reverse Trigger\n\nThe pattern also works in the other direction. Use n8n to trigger Koji studies — a Linear ticket marked \"needs customer validation\" can call `POST /api/v1/interviews/start` to open an interview for a chosen customer, send them the link with your own email tool, and let the `interview.completed` webhook feed the result back into the original ticket as a comment.\n\n---\n\n## n8n vs. Other Automation Platforms\n\n- **vs. [Zapier](/docs/zapier-research-automation):** Zapier has the largest pre-built app catalog and is the fastest path for non-technical teams. n8n is the right pick when data residency matters, when costs at high volume become a concern (Zapier bills per task), or when you want to self-host.\n- **vs. [Make.com](/docs/make-research-automation):** Similar trade-off — Make has visual scenarios but is cloud-only. n8n adds self-hosting and a more flexible node-based runtime with full JavaScript Code nodes, which is what lets it check signatures.\n- **vs. Custom code:** A custom webhook receiver is more flexible than any visual tool but takes longer to build and maintain. The Webhooks tab's \"Give this to your AI\" brief helps a coding assistant write one. n8n hits the sweet spot for most teams.\n\nFor Notion-specific workflows, see [Sync Koji to Notion](/docs/notion-research-integration). For Zapier specifically, see [Zapier Research Automation](/docs/zapier-research-automation).\n\n---\n\n## Security Checklist\n\n- **Verify signatures** with the Code node in Step 3, or at least keep the Webhook node path long and random and never share the URL.\n- **Keep secrets in the credentials manager or environment variables**: the `whsec_` signing secret and the Koji API key. Never inline them, because they end up in the workflow export.\n- **Run n8n over HTTPS.** Koji only sends to public `https://` addresses and doesn't follow redirects, so register the final URL.\n- **Rotate the signing secret** from the webhook's menu in Koji. The old secret keeps signing alongside the new one for 24 hours, so you can update n8n without dropping events.\n- **Rotate the Koji API key periodically** from **Settings → API Keys**. Revoke any key whose origin is no longer trusted.\n\n---\n\n## Related Resources\n\n- [Webhook Setup](/docs/webhook-setup): payload fields, signatures, retries and the delivery log\n- [Research Automation Webhooks](/docs/research-automation-webhooks) — design patterns for real-time research pipelines\n- [Zapier Research Automation](/docs/zapier-research-automation) — the cloud alternative to n8n\n- [Sync Koji to Notion](/docs/notion-research-integration) — Notion-specific recipe\n- [User Research API](/docs/user-research-api-guide) — full REST surface for enrichment and reverse triggers\n- [Structured Questions Guide](/docs/structured-questions-guide) — the question types whose answers land in your pipeline\n- [Exporting Research Data](/docs/exporting-research-data) — CSV and JSON exports for batch workflows\n- [API Authentication](/docs/api-authentication) — generating, rotating, and revoking Koji API keys","category":"API Reference","lastModified":"2026-11-14T05:12:19.640753+00:00","metaTitle":"Connect Koji to n8n: Self-Hosted Customer Research Pipelines | Koji Docs","metaDescription":"Build self-hosted research automation with n8n and Koji. Receive a signed webhook for every completed interview and route it to Notion, Linear, Slack or your CRM.","keywords":["koji n8n integration","n8n research automation","self-hosted research pipeline","koji webhook n8n","n8n customer research","research workflow automation n8n"],"aiSummary":"Connect Koji to n8n with a Webhook node: add its URL in a Koji study under Integrate, then Webhooks, and Koji sends a signed interview.completed event each time a participant finishes and the interview is scored. The event carries the interview and study IDs, your own participant ID, and the quality score, level and fraud risk. A Code node verifies the Standard Webhooks signature, drops test events and repeats, and an HTTP Request node can fetch the full transcript and analysis with an API key. Then route to Notion, Linear, Slack, HubSpot or any of n8n's 400+ integrations. Webhooks are on the Insights, Interviews and Enterprise plans. Self-hosted n8n keeps interview data on infrastructure you control, the key advantage over Zapier and Make for teams with data residency constraints. Setup takes about 15 minutes.","aiPrerequisites":["Running n8n instance at a public HTTPS address (self-hosted or n8n Cloud)","Koji study on the Insights, Interviews or Enterprise plan","Workspace owner or admin rights in Koji","Optional: a Koji API key to fetch full transcripts"],"aiLearningOutcomes":["Build an end-to-end n8n pipeline triggered by Koji webhooks","Verify Standard Webhooks signatures in an n8n Code node","Skip test events and repeated deliveries","Route interviews by quality score, level or segment","Fan out to Notion, Linear, Slack and CRMs with idempotent steps"],"aiDifficulty":"intermediate","aiEstimatedTime":"15 min"}],"pagination":{"total":1,"returned":1,"offset":0}}