Building an n8n Workflow That Calls Claude: A Step-by-Step for Non-Developers

AI assistance: Drafted with AI assistance and edited by Auburn AI editorial.

Automation tools have gotten good enough that you don’t need to write Python scripts to connect an AI model to your business processes. But “no-code” is a bit of a misnomer – you still need to understand what’s actually happening between the pieces, or you’ll spend an afternoon staring at a red error node wondering why Claude isn’t responding. This walkthrough is aimed at Canadian small-business owners, ops folks, and curious non-developers who want to build a real working workflow in n8n that calls Anthropic’s Claude API. We’ll cover the setup, the actual HTTP request structure, how to pass dynamic data, and a few gotchas we hit ourselves. No affiliate links, no upsells – just the steps.

What You’re Actually Building

The end result is an n8n workflow that takes some input – say, a customer message pasted into a form, or a row from a Google Sheet – and sends it to Claude (via Anthropic’s API), then does something useful with the response. Summarizing support tickets, drafting reply templates, classifying leads: all reasonable starting points.

n8n is an open-source workflow automation tool, roughly comparable to Zapier or Make, but self-hostable. That last point matters for Canadian businesses under PIPEDA. If you’re processing customer data and you self-host n8n on a Canadian cloud instance (say, a VPS in a Toronto data centre), you have much clearer control over where that data sits before it hits Anthropic’s US-based API endpoint. Worth a conversation with your privacy lead before you pipe anything sensitive through.

Two deployment options for this tutorial:

  • n8n Cloud trial – free 14-day trial at n8n.io, no credit card needed at signup. Easiest way to follow along.
  • Self-hosted via Docker – if you have Docker installed locally or on a server, you’re up in about five minutes. We’ll show the command.

Spinning Up n8n (Cloud or Docker)

Option A: n8n Cloud Trial

Go to n8n.io, create a free account, and you’ll land in the workflow editor. Skip everything that asks you to connect an app for now – click “New Workflow” in the top left and you’re in the canvas. That’s it.

Option B: Docker (Self-Hosted)

If you have Docker Desktop on your machine, open a terminal and run:

docker run -it --rm \
  --name n8n \
  -p 5678:5678 \
  -v ~/.n8n:/home/node/.n8n \
  docker.n8n.io/n8nio/n8n:1.47.1

Once it finishes pulling the image, open http://localhost:5678 in your browser. You’ll be prompted to create an owner account with an email and password – use something real, even locally, because n8n saves it. Version 1.47.1 is current as of mid-2025; check the official n8n Docker docs for the latest tag if you’re reading this later.

Getting Your Anthropic API Key

You need an API key from Anthropic. Head to console.anthropic.com, create an account, and navigate to “API Keys” in the left sidebar. Click “Create Key,” name it something descriptive (like n8n-workflow-test), and copy the key immediately – Anthropic only shows it once.

New accounts get $5 USD in free credits, which is enough to run hundreds of test calls on Claude Haiku. Claude 3.5 Sonnet costs more per token, so for testing, you can specify the model explicitly and choose the cheaper one.

Keep this key out of screenshots, out of Slack, and out of your workflow’s hardcoded fields if you’re sharing the workflow JSON with anyone. We’ll store it as a credential in n8n, which is the right way to handle it.

Building the Workflow: Node by Node

Step 1 – Add a Manual Trigger

In the n8n canvas, click the “+” button to add your first node. Search for “Manual Trigger” and select it. This node lets you run the workflow by clicking a button – perfect for testing. You’ll replace it later with whatever trigger makes sense for your use case (a webhook, a schedule, a form submission).

Step 2 – Add a Set Node to Define Your Input

Click the “+” on the right edge of the Manual Trigger node. Search for “Edit Fields (Set)” – this is the node formerly called “Set.” Add it.

Inside the node, add a new field:

  • Name: user_message
  • Value: something like Summarize the following for a busy executive: Artificial intelligence is increasingly being used in logistics to reduce delivery times and operational costs. Several Canadian retailers have begun piloting AI-driven inventory systems.

This simulates real input data. Later you’d replace the static value with a dynamic expression pulling from an upstream node.

Step 3 – Add an HTTP Request Node to Call Claude

This is the core of the workflow. Add an “HTTP Request” node after your Set node.

Configure it as follows:

  • Method: POST
  • URL: https://api.anthropic.com/v1/messages

Under Headers, add two headers:

  • x-api-key → your Anthropic API key (see credential tip below)
  • anthropic-version2023-06-01
  • content-typeapplication/json

Under Body, select “JSON” and paste this structure:

{
  "model": "claude-haiku-4-5",
  "max_tokens": 512,
  "messages": [
    {
      "role": "user",
      "content": "{{ $json.user_message }}"
    }
  ]
}

That {{ $json.user_message }} is n8n’s expression syntax. It pulls the user_message field from the previous node’s output. This is how you pass dynamic data through the chain.

For the model name: as of mid-2025, current model identifiers from Anthropic are things like claude-haiku-4-5, claude-sonnet-4-5, and claude-opus-4-5. Always verify current identifiers in the Anthropic models documentation – they update these periodically and using a deprecated string returns a clean 404-style error.

Handling the API Key as a Credential (Don’t Skip This)

Rather than pasting your raw API key into the header field, do this properly. In the HTTP Request node, scroll to “Authentication” and select “Generic Credential Type,” then “Header Auth.” Create a new credential:

  • Name: anthropic-api-key
  • Name (header field): x-api-key
  • Value: paste your actual API key here

n8n encrypts stored credentials. This way if you export your workflow JSON to share with a colleague, the key isn’t in plaintext inside it. Small habit, big difference.

Step 4 – Parse the Response with a Set Node

Claude’s API returns a JSON object. The actual text response lives at content[0].text inside that object. Add another “Edit Fields (Set)” node and pull out what you need:

  • Name: claude_response
  • Value: {{ $json.content[0].text }}

Now the next node in your chain has a clean, single field to work with – rather than the full API response object.

Step 5 – Do Something With It

From here, the workflow is yours. A few realistic next steps:

  • Send it to Slack – add a Slack node, paste the claude_response into the message field.
  • Write it back to a Google Sheet – add a Google Sheets node, map claude_response to a column.
  • Return it via webhook – if your trigger was a webhook, use a “Respond to Webhook” node to send Claude’s output back to whoever called the workflow.

Testing It and Reading Errors

Click “Test workflow” in the top right. n8n runs the workflow and highlights each node green (success) or red (error). Click any node to see the exact input and output data at that step.

Common errors and what they mean:

  • 401 Unauthorized – your API key is wrong, or you passed it in the wrong header. Double-check x-api-key spelling.
  • 400 Bad Request – your JSON body is malformed, or you used an invalid model name. Copy the error message from the node output – Anthropic returns clear descriptions.
  • Expression error on $json.user_message – the Set node isn’t connected correctly, or the field name has a typo. Check capitalization; n8n expressions are case-sensitive.
  • Empty content[0].text – this usually means max_tokens was too low or the response was flagged. Try bumping max_tokens to 1024 and check Anthropic’s error codes documentation.

What we found surprising during our own testing: the anthropic-version header being missing causes a 400, not a 401. It’s easy to assume it’s an auth problem and chase the wrong fix for 20 minutes. Always check the actual error body first.

Adding a System Prompt for Better Results

If you’re using Claude for a specific task – summarization, classification, tone adjustment – you should pass a system prompt. This keeps your outputs consistent and prevents the model from going off in unexpected directions.

Update your HTTP Request node’s JSON body like this:

{
  "model": "claude-haiku-4-5",
  "max_tokens": 512,
  "system": "You are a concise business summarizer. Respond in plain English. Use bullet points. Maximum 5 bullets. Do not add opinions.",
  "messages": [
    {
      "role": "user",
      "content": "{{ $json.user_message }}"
    }
  ]
}

The system field sits at the top level of the request body, not inside messages. That’s an easy mistake to make, and the API won’t error – it’ll just ignore the system instructions if you nest them wrong, and you’ll wonder why the output looks inconsistent.

You can also make the system prompt dynamic by storing it in a Set node field and referencing it with an expression, which is useful if you’re routing different types of content through the same workflow with different instructions per type.

A Note on Data Residency for Canadian Users

Anthropic’s API endpoints are US-hosted. Any text you send in the content field leaves Canada. For most general-purpose tasks – drafting marketing copy, summarizing public news – this is fine. If you’re processing anything that touches personal information as defined under PIPEDA (names, contact info, account details, health data), you need to think carefully about consent and cross-border disclosure obligations.

The Office of the Privacy Commissioner of Canada has published guidance on cross-border data flows. Our reading suggests most businesses can manage this with appropriate privacy notices and contractual safeguards, but it’s not something to wave away.

If you’re self-hosting n8n on Canadian infrastructure, at least the orchestration and intermediate data storage stays domestic – you’re just making an outbound API call to the US at the moment of inference, same as you would with any third-party SaaS tool.

Where to Go From Here

Once this basic pattern works, the interesting stuff opens up. You can chain multiple Claude calls – one to classify the input, one to generate a response based on the classification. You can add conditional logic using n8n’s “If” node to route different inputs to different prompts. You can store conversation history in a simple JSON array and pass it back to Claude to simulate multi-turn conversations without a dedicated memory layer.

The n8n community has a solid template library at n8n.io/workflows – search “AI” or “Claude” and you’ll find contributed workflows worth dissecting, even if you don’t use them as-is.

The barrier here isn’t technical complexity. It’s mostly comfort with reading JSON and understanding that each node passes data to the next one. Get that mental model right, and you can build genuinely useful automations without writing a single line of code.

From our experience, the workflows that actually stick in production are the boring ones – the ticket triage, the first-draft generator, the weekly report summarizer – not the ambitious multi-agent pipelines that seemed exciting to design and fragile to run.

– Auburn AI editorial, Calgary AB


Related Auburn AI Products

Building content or automations around AI? Auburn AI has production-tested kits:

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top