Resources · n8n integration

Kafka n8n integrationAutomate Kafka with n8n.

Your brokers already carry the events, n8n decides what happens next. The Kafka n8n integration gives you 1 node operation to publish a message on a topic, plus a trigger that consumes a topic under a consumer group ID. Written for teams that already run Kafka.

Verified Trustpilot reviews · AI, automation & growth agency

Why automate

What does the Kafka n8n integration actually cover?

Kafka is where the events pile up. The n8n Kafka node writes to that pile, the Kafka Trigger reads from it. One operation publishes a message on a topic you name, with an optional key and headers. One trigger subscribes to a topic under a consumer group ID, the identifier several consumers share to split a topic between them, and hands each message to the rest of the workflow.

First scenario, landing a stream somewhere people can read it. The trigger consumes a topic, a Set node keeps the three fields that matter, and a Postgres node writes one row per message. Same shape, different audience: send the cleaned rows to Google Sheets when the people who read them do not have database access.

Second scenario, turning a topic into a human alert. A topic of failed jobs feeds an IF node, and anything above your threshold posts to Slack with the message key in the text. The consumer group ID keeps this workflow independent from whatever else consumes the same topic.

Third scenario, n8n as the producer. Any workflow can finish on default.execute and publish what it built. One public template does exactly that: an HTTP Request node fetches the position of the ISS every minute and sends it to a Kafka topic. Replace the API call with a form submission or a database query and the pattern holds.

One thing to know before you plan around it. The Kafka credential opens a connection to your brokers, it is not an HTTP API, so there is no generic node to fall back on when something is missing. On an HTTP based tool you would reach for HTTP Request and call the endpoint yourself. Here, what the node does not expose simply does not happen from n8n: no topic creation from a workflow, no consumer group inspection, no offset browsing.

The other known limit sits on the trigger. Version 1 consumes uncompressed messages and GZIP messages, and fails with an unsupported compression format error on LZ4, Snappy or Zstd, which is a common default for Confluent and JVM producers. Either the producer switches to gzip or none, or you opt into the version 2 preview. If you want that reviewed against your own setup before you commit, the n8n review and the n8n training pages go deeper on where n8n fits.

Connect

How do you connect n8n to your Kafka brokers?

  1. 01

    Create the Kafka credential

    In n8n, open Credentials and create a Kafka credential. A credential is the stored connection detail that every node reuses, so you fill this in once for all your Kafka workflows. Start with Client ID, the identifier of the client or consumer group that n8n announces to the cluster. Pick something you will recognise in your broker logs, because that name is how you will tell n8n traffic apart from the rest.

  2. 02

    List your brokers

    Brokers takes a comma separated list in the <broker-service-name>:<port> format. The service name is the one you gave the broker in your services list, so kafka-1:9092,kafka-2:9092 points n8n at two brokers on port 9092. List more than one when you have more than one. If your Kafka environment runs without SSL, turn the SSL toggle off, otherwise leave it on.

  3. 03

    Add SASL authentication if you use it

    If your cluster authenticates with SASL, turn on the Authentication toggle and fill in Username and Password. Then set SASL Mechanism to whatever the broker is configured for, between Plain, scram-sha-256 and scram-sha-512. Save, then reuse the same credential on both the Kafka node and the Kafka Trigger. Encoding with an authenticated Confluent Schema Registry needs a separate Schema Registry credential.

Triggers

What does the Kafka Trigger listen to?

Kafka Trigger is the node that starts a workflow when something happens in Kafka. Activate the workflow and every event it receives becomes one execution.

What you see in n8n

Configuration notes

01Set Up the Kafka TriggerThe Kafka Trigger subscribes to one topic and starts the workflow for the messages it receives. Two fields are required, and the workflow has to be active for the trigger to listen at all.

The Kafka Trigger subscribes to one topic and starts the workflow for the messages it receives. Two fields are required, and the workflow has to be active for the trigger to listen at all.

Key parameters

  • Topic: the name of the topic to consume from, exactly as it exists on the cluster.
  • Group ID: the consumer group this trigger joins. Give each workflow its own ID unless you deliberately want two triggers sharing the partitions of a topic.
  • Allow Topic Creation: lets the consumer attach to a topic that does not exist yet, instead of failing on it.
When to use it
whenever the event already exists on a topic and something downstream needs to react to it without a person copying values across.
02Choose Where Reading StartsBy default a consumer group picks up where it left off. These options decide what happens on the first run and how often the position is written back.

By default a consumer group picks up where it left off. These options decide what happens on the first run and how often the position is written back.

Key parameters

  • Read Messages From Beginning: on, the trigger reads the topic from its oldest retained message instead of only new ones. Useful to backfill once, noisy if you leave it on.
  • Auto Commit Threshold: commits the offset after a given number of resolved messages.
  • Auto Commit Interval: commits after a given period instead, for example every few seconds.
  • Batch Size: how many messages are processed per batch. Set to 1 for message by message processing.
Use cases
a nightly reconciliation workflow that has to replay a full topic on its first execution, then behave normally.
03Shape What Each Message OutputsKafka hands over a value and some metadata around it. These options decide what the next node actually sees in its input, and getting them right at the trigger saves a cleanup node later in the workflow.

Kafka hands over a value and some metadata around it. These options decide what the next node actually sees in its input, and getting them right at the trigger saves a cleanup node later in the workflow.

Key parameters

  • JSON Parse Message: tries to parse the message into an object, so the fields become addressable as {{ $json.field }} instead of one long string.
  • Only Message: returns just the message property, dropping the surrounding envelope.
  • Return Headers: adds the headers received from Kafka to the output, which is where producers usually put a trace or tenant identifier.
  • Keep Message as Binary Data: keeps the value binary for downstream processing such as Avro deserialization.
  • Use Schema Registry: decodes through a Confluent Schema Registry, with its own credential.
Use cases
a topic whose producer sends JSON strings, parsed at the trigger so no Code node is needed to unwrap it.
04Keep The Consumer In Its GroupA Kafka consumer proves it is alive on a schedule. These options control that conversation, and they are the ones to look at when a workflow keeps losing its place.

A Kafka consumer proves it is alive on a schedule. These options control that conversation, and they are the ones to look at when a workflow keeps losing its place.

Key parameters

  • Heartbeat Interval: how often the consumer tells the broker it is still alive. It has to be lower than Session Timeout, and roughly one third of it is the recommended value.
  • Session Timeout: the delay in milliseconds after which the broker treats the consumer as failed.
  • Rebalance Timeout: the maximum time a consumer gets to join the group.
  • Retry Delay on Error: the wait in milliseconds before retrying a failed offset resolution, which stops a rapid retry loop from hammering the broker.
When to use it
when the cluster already has tuned values and n8n has to line up with them.
Actions

What can the Kafka node do?

The Kafka node exposes one operation. For each one: the node as you configure it in n8n, the required fields, and our field notes.

01

Sends messages to a Kafka topic

execute

What you see in n8n

Notes & use cases

The node publishes one message per incoming item. Kafka returns an acknowledgement, not data, so this is an endpoint in a workflow rather than a lookup.

Key parameters

  • Topic: where the message goes, for example orders-created.
  • Message: the body to send, often an expression like {{ $json.id }}. Turn on Send Input Data to push the whole item as JSON instead.
  • Key: the message key, which is how Kafka keeps related messages on one partition.
  • Event Name: the schema written namespace.name, used when Use Schema Registry is on.
Use cases
republishing a cleaned form submission on an internal topic.
Need help

Need help automating Kafka with n8n?

A person reads every message.

FAQ

Kafka and n8n, common questions

01Is the Kafka n8n integration free?
Yes on the n8n side. Both the Kafka node and the Kafka Trigger ship with n8n, so there is nothing to install and nothing extra to pay, whether you run n8n Cloud or a self-hosted instance under the Community Edition and its Sustainable Use licence. What your Kafka setup costs is a separate question, and it depends entirely on how you run your brokers, which is not something this page can price for you. The practical cost is setup time: one credential, one topic name, one consumer group ID per workflow that consumes.
02What credentials does n8n need for Kafka?
One Kafka credential, shared by the node and the trigger. It needs a Client ID, which is the identifier of the client or consumer group, and a list of brokers written as broker service name and port separated by commas, for example kafka-1:9092. The SSL toggle stays on unless your environment runs without it. If the cluster uses SASL, switch the Authentication toggle on and add a username, a password and the SASL mechanism the broker expects, between Plain, scram-sha-256 and scram-sha-512. Encoding or decoding with an authenticated Confluent Schema Registry uses a separate Schema Registry credential.
03What are the limits of the Kafka node in n8n?
The node exposes 1 operation, sending a message to a topic. Everything else Kafka can do, creating topics from a workflow, inspecting consumer groups, browsing offsets, is outside what n8n offers here. And there is no workaround through a generic node, because the credential opens a connection to your brokers rather than an HTTP API, so calling an endpoint yourself is not an option. On the consuming side, version 1 of the trigger reads uncompressed and GZIP messages only, and fails on LZ4, Snappy or Zstd topics.
04Does the Kafka Trigger react in real time?
It depends, and n8n does not document the mechanism behind this trigger, so treating it as instant would be guesswork. What is documented is the rest. The workflow has to be published and active for the trigger to listen at all. The consumer group ID decides whether your trigger reads the topic on its own or shares partitions with another consumer. Read Messages From Beginning decides whether the first run replays retained history or only handles what arrives next. Batch Size set to 1 gives message by message processing rather than grouped batches.
05n8n or Make for Kafka?
The honest split is about where the thing runs. Make is hosted by Make, with no self-hosting option and a bill that scales with the number of operations you consume. n8n runs on your own servers or on n8n Cloud, with the same workflow either way. For Kafka specifically that matters more than usual, because brokers often sit on a private network that a hosted platform cannot reach, and because event streams generate volume, which makes a per operation model worth checking against your own numbers before you commit. Make wins on breadth of hosted connectors.
Hack'celeration Lab

Get our weekly integration tips.

No spam. Unsubscribe anytime.