Back to docs
API Reference

Connect Koji to n8n: Build Self-Hosted Customer Research Pipelines

Wire Koji into n8n with signed webhooks to build self-hosted pipelines that route every completed interview into Notion, Linear, Slack, your CRM, or any other system, without sending data through a third-party automation cloud.

TL;DR: Connect Koji to n8n 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.


Why n8n + Koji Is a Powerful Combination

Most 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.

n8n 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.

Combining n8n with Koji's API-driven AI research platform gives you the best of both worlds:

  • 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.
  • 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.

Traditional 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.


Prerequisites

Before you start:

  1. 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://.
  2. A Koji study on a plan with webhooks. Webhooks are on the Insights, Interviews and Enterprise plans, not Free. Create a study if you have not.
  3. Workspace owner or admin rights in Koji. Only owners and admins can add or change webhooks.
  4. 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).
  5. A target destination tool. For this guide we walk through Notion + Linear + Slack, but the same pattern works for any n8n node.

Architecture: How the Pipeline Works

Participant completes Koji interview
        │
        ▼
Koji analysis runs (quality score, themes, structured answers, sentiment)
        │
        ▼
Koji POSTs a signed interview.completed event to your n8n Webhook node
        │
        ▼
n8n checks the signature, skips test events and repeats
        │
        ▼
(optional) n8n fetches the full interview from data.links.api
        │
        ▼
n8n routes by quality/segment via IF / Switch nodes
        │
        ├─→ Notion: append page with transcript + themes
        ├─→ Linear: create ticket if quality_score < 3 (low signal needs review)
        ├─→ Slack: alert the CS team for Enterprise segment
        └─→ HubSpot: enrich the contact record with sentiment

The 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.


Step 1: Create the n8n Webhook Node

In your n8n canvas:

  1. Click Add first step → choose Webhook.
  2. Set HTTP Method to POST.
  3. Replace the generated path with a long, random string, so the URL cannot be guessed.
  4. Set Respond to Immediately. Koji counts any 2xx answer within 10 seconds as delivered, so let n8n reply first and do the work afterwards.
  5. 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.
  6. 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.

Step 2: Add the Webhook in Koji

Switch to the Koji web app:

  1. Open your study → Integrate → Webhooks.
  2. Click Add webhook and paste the n8n URL. Give it a name such as "n8n pipeline".
  3. Pick the interview.completed event.
  4. 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.
  5. 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.
  6. 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.

Each delivery is a JSON body like this (shortened):

{
  "id": "msg_2f6c0d1e8a4b4c2d9e3f0a1b2c3d4e5f",
  "type": "interview.completed",
  "data": {
    "interview_id": "9f4c1e2a-...",
    "study_id": "3b8e1f2a-...",
    "study_name": "Onboarding feedback",
    "mode": "text",
    "participant": { "external_id": "user_12345", "source": "csv_import", "panel": null },
    "trust": { "quality_score": 4, "quality_level": "Good", "meets_quality_bar": true, "fraud_risk": "low" },
    "links": { "api": "https://www.koji.so/api/v1/interviews/9f4c1e2a-...", "app": "https://www.koji.so/t/..." }
  }
}

Webhook Setup documents every field, the retry schedule and the delivery log.


Step 3: Verify, Filter Test Events and Skip Repeats

n8n does not check Standard Webhooks signatures on its own. Add a Code node after the Webhook node and paste:

// Runs once per delivery. Checks the signature, drops test events
// and repeats, and passes the event on.
const crypto = require('crypto');
const item = $input.first();
const headers = item.json.headers;
const raw = Buffer.from(item.binary.data.data, 'base64').toString('utf8');

const secret = $env.KOJI_WEBHOOK_SECRET;
const key = Buffer.from(secret.replace(/^whsec_/, ''), 'base64');
const signed = `${headers['webhook-id']}.${headers['webhook-timestamp']}.${raw}`;
const expected = crypto.createHmac('sha256', key).update(signed).digest('base64');

const valid = (headers['webhook-signature'] || '').split(' ').some(s => {
  const sig = s.replace(/^v1,/, '');
  return sig.length === expected.length &&
    crypto.timingSafeEqual(Buffer.from(sig), Buffer.from(expected));
});
const fresh = Math.abs(Date.now() / 1000 - Number(headers['webhook-timestamp'])) < 300;
if (!valid || !fresh) throw new Error('Bad Koji signature');

const event = JSON.parse(raw);
if (event.type !== 'interview.completed') return []; // webhook.test and anything new

const store = $getWorkflowStaticData('global');
store.seen = store.seen || {};
if (store.seen[headers['webhook-id']]) return []; // a retry or a resend
store.seen[headers['webhook-id']] = true;

return [{ json: event }];

On 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.

Why 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.


Step 4: Fetch the Full Interview (Optional)

The webhook says who finished and how good the interview was. For the transcript, themes and every answer, add an HTTP Request node:

GET {{ $json.data.links.api }}
Authorization: Bearer YOUR_KOJI_API_KEY

Create 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 for the full response.


Step 5: Route by Quality, Segment, or Sentiment

Add a Switch node. Configure rules that branch on the payload:

  • Branch 1: {{ $json.data.trust.quality_score >= 4 }} → high-signal interviews
  • Branch 2: {{ $json.data.trust.meets_quality_bar === false }} → low-signal interviews that need researcher review
  • 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

Each branch flows to a different destination node.


Step 6: Fan Out to Destinations

Notion: Append a Page With Transcript

Add a Notion node:

  • Operation: Create Page
  • Database: select your research repository database
  • Properties: map Name → {{ $json.data.study_name }}, Quality → {{ $json.data.trust.quality_level }}, Participant → {{ $json.data.participant.external_id }}
  • 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

Linear: Create a Ticket for Low-Quality Interviews

In the low-quality branch, add a Linear node:

  • Operation: Create Issue
  • Team: your research-ops team
  • Title: Low-signal interview — review needed (quality {{ $json.data.trust.quality_score }})
  • Description: include the link to the interview in Koji, {{ $json.data.links.app }}
  • Labels: research-qa, the segment, the study name

This is how research-ops teams catch interview design issues before they propagate — if quality scores trend low for one question, that question needs revision.

Slack: Alert on Enterprise Feedback

In the Enterprise-segment branch, add a Slack node:

  • Operation: Post Message
  • Channel: #cs-enterprise-feedback
  • 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>

CS leads love this pattern. Enterprise feedback gets human eyes within minutes of the interview ending.


Step 7: Test the Pipeline End-to-End

  1. In n8n, click Listen for test event on the Webhook node (or activate the workflow if Koji points at the production URL).
  2. In Koji, click Send test event on the webhook. The delivery log should show a 2xx from n8n.
  3. 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.
  4. Run a real interview through your published study and confirm the data lands in Notion / Linear / Slack.

The 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.


Patterns That Scale

Idempotency

Retries 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.

Backpressure

If 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.

A safety net

Webhooks 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.

Enrichment

Add 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.

Reverse Trigger

The 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.


n8n vs. Other Automation Platforms

  • vs. Zapier: 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.
  • vs. Make.com: 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.
  • 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.

For Notion-specific workflows, see Sync Koji to Notion. For Zapier specifically, see Zapier Research Automation.


Security Checklist

  • 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.
  • 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.
  • Run n8n over HTTPS. Koji only sends to public https:// addresses and doesn't follow redirects, so register the final URL.
  • 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.
  • Rotate the Koji API key periodically from Settings → API Keys. Revoke any key whose origin is no longer trusted.

Related Resources

Related Articles

API Authentication

How Koji Headless API authentication works: pk_live_ API keys, permissions, session tokens, and origin allowlists.

Exporting Research Data from Koji: CSV, JSON, and Transcript Access

A complete guide to every way you can get your interview data out of Koji — from one-click CSV downloads to automated API pipelines.

Google Sheets + Koji: Launch AI Interviews from a Spreadsheet and Auto-Log Every Insight Back

Turn a Google Sheet of contacts into a batch of Koji AI interviews, and auto-append every completed interview's themes, sentiment, quality score, and transcript link back to a live results tab — no data stack required.

Connect Koji to Make (Make.com): Build No-Code Customer Research Automations

Use Make (formerly Integromat) scenarios to trigger Koji AI interviews from any app and route themes, sentiment, and transcripts to Slack, Notion, your CRM, or a spreadsheet, no code, using HTTP modules and Koji webhooks.

Sync Koji Research Insights to Notion: Build a Self-Updating Research Repository

Connect Koji to Notion with a study webhook and Zapier (or your own receiver) so every completed AI interview becomes a fresh Notion page with its transcript, AI summary, key insights, sentiment and quality level. Build a research repository that updates itself.

Research Automation: How to Build Real-Time Research Pipelines with Webhooks

Build automated research pipelines on Koji: event-triggered interviews, a signed webhook when each one is finished and scored, and insight routing to Slack, your CRM or a warehouse.

Segment + Koji: Trigger AI Interviews from CDP Audiences and Sync Insights Back as Traits

Use Segment Audiences and events to trigger Koji AI-moderated interviews, then pipe summaries, key insights and sentiment back into Segment as track events and user traits that fan out to every downstream tool.

Structured Questions in AI Interviews

Mix quantitative data collection — scales, ratings, multiple choice, ranking — with AI-powered conversational follow-up in a single interview.

User Research API: Embed AI Interviews into Any Product or Workflow

How to use Koji's User Research API to run AI-moderated interviews from your own backend. Covers REST endpoints, the embed widget, signed completion webhooks, authentication, rate limits, and headless interview patterns.

Webhook Setup

Set up Koji webhooks: get a signed interview.completed message on your server each time a participant finishes, with your own participant ID and a quality score.

Connect Koji to Zapier: Automate Customer Research Workflows in Minutes

Route every completed AI customer interview from Koji into 6,000+ Zapier apps — including Notion, Linear, Salesforce, Airtable, and Gmail. A step-by-step integration guide.

Zendesk + Koji: Trigger AI Interviews from Support Tickets and Sync Insights Back to Every Conversation

Use Zendesk triggers to invite customers to Koji AI-moderated interviews from solved tickets, low CSAT, or specific tags, tie each interview to its ticket through the headless API, and have a small scheduled worker post themes, sentiment, and a response link back onto the ticket.

Jira + Koji: Auto-File Customer-Research-Backed Tickets and Close the Loop on Every Fix

Send Koji AI interview themes, customer quotes, and quality scores directly into Jira as fully-formed tickets — and pipe Jira ticket resolution back to the participants who reported it.