# n8n Workflow Generator (`primeflowio/n8n-workflow-generator`) Actor

Describe an automation in plain English and get a validated, ready-to-import n8n workflow JSON. Pay per result, no subscription. Callable by AI agents as a tool via x402 and the Apify MCP server. Invalid results are never charged.

- **URL**: https://apify.com/primeflowio/n8n-workflow-generator.md
- **Developed by:** [Захар Бараненко](https://apify.com/primeflowio) (community)
- **Categories:** AI, Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per event

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## n8n Workflow Generator — turn plain English into a ready-to-import n8n workflow

**Describe your automation in one sentence. Get back a validated n8n workflow JSON you can import in one click.** No subscription — pay only per generated workflow. Built for humans *and* AI agents (x402-ready).

> Stop hand-wiring nodes or debugging broken JSON from ChatGPT. This Actor generates the workflow **and validates it against the real n8n node registry** before you're charged. If it doesn't pass validation, you don't pay.

***

### What you get

- **`generate` mode — $2.99**: a plain-English task → a complete n8n workflow (trigger, nodes, connections, layout) as import-ready JSON. Checked against **560+ real n8n node types** and auto-repaired before delivery. **Invalid result = no charge.**
- **`validate` mode — $0.10**: paste an existing workflow JSON → an import-readiness report (missing fields, broken connections, unknown/hallucinated node types, missing trigger, orphan nodes).

### Why not just ask ChatGPT?

Raw LLM output for n8n routinely **hallucinates node types, breaks the `connections` wiring, or forgets the trigger** — it looks right and fails on import. This Actor validates every result against the actual n8n node registry and runs up to two automatic repair rounds. You get JSON that imports cleanly, not a plausible-looking dead end. And when you don't (rare), you're not billed.

### Real examples (actually generated by this Actor)

**Input:** *"When a new row appears in my Google Sheet, send its contents to a Slack channel #leads"*
**Output:** `Google Sheets Trigger → Slack` — 2 nodes, valid, first try.

**Input:** *"Every Monday at 9am fetch an RSS feed, summarize new items with AI, and email me the digest"*
**Output:** `Schedule Trigger → RSS Read → IF (new items) → Set → OpenAI → Format → Email` — 8 nodes, branching, valid.

**Input:** *"When my webhook receives a JSON order, if total > 100 send it to Slack #vip, otherwise append to Google Sheets"*
**Output:** `Webhook → IF → Slack (true branch) / Google Sheets (false branch)` — correct two-way branching, valid.

### How to use

1. Set **mode** = `generate`.
2. Type your automation in **task** (plain English — mention the apps and the trigger).
3. *(optional)* Add **notes** for constraints (which services, error handling, naming).
4. Run. Grab the workflow from the dataset (`workflow` field) or key-value store (`workflow.json`).
5. In n8n: **Workflows → Import from File / Paste JSON** → connect your credentials → done.

### Output

A dataset record with:

- `workflow` — import-ready n8n JSON
- `valid` — passed structural validation
- `warnings` — non-blocking notes (e.g. a node type outside the known registry)

### Perfect for

- **AI agents** (via x402 — pay per call, no account needed): give your agent the ability to *build* automations, not just describe them.
- **n8n users on self-hosted / community** who don't have the Cloud AI builder.
- **Anyone** who wants a working workflow in seconds instead of 30 minutes of node-wiring.

### FAQ

**Does it need my n8n instance?** No. It returns JSON — you import it into any n8n (cloud or self-hosted).
**Will it invent credentials?** No. It sets parameters normally; n8n prompts you for credentials on import.
**What if the result is broken?** You're only charged for workflows that pass validation.
**Which nodes does it know?** The full current n8n registry (n8n-nodes-base + langchain nodes) — 560+ types, regenerated from the official repo.

***

*Keywords: n8n, workflow generator, n8n AI, text to workflow, n8n JSON, automation builder, import n8n workflow, n8n workflow from prompt, AI workflow automation, x402.*

# Actor input Schema

## `task` (type: `string`):

Plain-English description of the automation. Example: 'Every morning at 8am fetch new rows from a Google Sheet, summarize them with OpenAI and post the summary to Slack #general'.

## `mode` (type: `string`):

generate = create a new workflow from the task description; validate = only validate the workflow JSON passed in workflowJson (cheaper).

## `workflowJson` (type: `object`):

Existing n8n workflow JSON to validate. Ignored in generate mode.

## `notes` (type: `string`):

Optional constraints: which services/credentials you use, error handling preferences, naming conventions.

## `anthropicApiKey` (type: `string`):

Bring your own key: if provided, generation uses YOUR Anthropic API key (you pay Anthropic directly for tokens). If omitted, the Actor's built-in key is used.

## Actor input object example

```json
{
  "task": "When a new row appears in my Google Sheet, send its contents to a Slack channel.",
  "mode": "generate"
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "task": "When a new row appears in my Google Sheet, send its contents to a Slack channel."
};

// Run the Actor and wait for it to finish
const run = await client.actor("primeflowio/n8n-workflow-generator").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "task": "When a new row appears in my Google Sheet, send its contents to a Slack channel." }

# Run the Actor and wait for it to finish
run = client.actor("primeflowio/n8n-workflow-generator").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "task": "When a new row appears in my Google Sheet, send its contents to a Slack channel."
}' |
apify call primeflowio/n8n-workflow-generator --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=primeflowio/n8n-workflow-generator",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/HMzjOYjk3q90XpLev/builds/Kt9gXR9gDiK22cujh/openapi.json
