n8n-nodes-content-agent
v0.4.0
Published
n8n Community Node for publishing reviewed articles through a local Content Agent API
Downloads
49
Maintainers
Readme
n8n-nodes-content-agent
This n8n Community Node sends reviewed article content to a self-hosted Content Agent API. n8n owns the source, translation, LLM editing, review, and schedule. The Python service owns Toutiao login state, SQLite idempotency, immutable revisions, Doocs rendering, image placement, browser publishing, and result verification.
Install in self-hosted n8n
Before an npm registry release, build a local tarball:
cd n8n-nodes-content-agent
npm install
npm test
npm packInstall n8n-nodes-content-agent-0.4.0.tgz inside the same image or persistent
nodes directory used by the n8n main and worker processes. A custom image can
use this pattern, with the n8n version pinned to the version already deployed:
FROM n8nio/n8n:<PINNED_VERSION>
USER root
COPY n8n-nodes-content-agent-0.4.0.tgz /tmp/
RUN mkdir -p /home/node/.n8n/nodes \
&& cd /home/node/.n8n/nodes \
&& npm init -y \
&& npm install /tmp/n8n-nodes-content-agent-0.4.0.tgz \
&& chown -R node:node /home/node/.n8n
USER nodeRestart every n8n main/worker process after installation. Once the package is published to npm, it can instead be installed by package name from n8n's Community Nodes settings.
Start Content Agent API
On the machine that owns the persistent Chromium profile:
export CONTENT_AGENT_API_TOKEN="$(openssl rand -hex 32)"
content-agent --config /absolute/path/config.publish.yaml serve \
--host 127.0.0.1 --port 8766Store the token in the service environment for permanent use. When n8n runs on
another machine, listen on a private interface reachable from n8n and restrict
the firewall to the n8n source. Do not publish this API directly on the
Internet. For n8n.72602.space, 127.0.0.1 refers to the n8n container, not
the current Content Agent host; use a private 72602-to-publisher route or deploy
Content Agent and its persistent profile beside n8n.
The API exposes authenticated GET /health and
POST /v1/toutiao/publish. Images are base64 in transit, decoded into private
temporary files by Python, copied into Content Agent artifacts, and deleted
after each request.
Configure n8n
Create a Content Agent API credential:
- Base URL: the private URL visible from the n8n process, for example
http://content-agent.internal:8766. - Access Token: the exact value of
CONTENT_AGENT_API_TOKEN. - Command Timeout: normally 900 seconds.
Add a Toutiao Publisher node after the review step. Supply:
- Request ID: unique execution/item identifier for tracing.
- Idempotency Key: stable for one reviewed revision; never use a timestamp.
- External Revision ID: the upstream review revision.
- Title: final reviewed title containing 2-30 characters.
- Body Markdown: use
{{image:cover}}for named placement. - Images: map each image ID to an incoming n8n binary property.
- Metadata JSON: optional flat object whose values are strings.
Run Prepare Only first. It validates the complete request and creates an
approved immutable artifact without opening Chromium. After inspecting the
result, switch the node to Publish. Output is the original item JSON plus a
contentAgent object containing status, revision, published URL, idempotent
replay information, or a stable error code.
Do not run the legacy Content Agent scheduler at the same time. n8n is the scheduler owner for this integration; the Python project lock rejects an overlapping publish.
Import examples/prepare-only.json for a small workflow that creates a test
item and a PNG binary property before calling this node.
