# n8n Workflow Generator - Prompt to Importable JSON (`mediocre_interest/n8n-workflow-builder`) Actor

Describe an automation in plain English and get an n8n workflow JSON that imports cleanly. Every node type, typeVersion, parameter key, option value and AI sub-node connection is checked against n8n's own node definitions before you are charged - no invented nodes, no silently ignored settings.

- **URL**: https://apify.com/mediocre_interest/n8n-workflow-builder.md
- **Developed by:** [Mediocre_Interest](https://apify.com/mediocre_interest) (community)
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.99 / workflow generated

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

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

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
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.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

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

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## n8n Workflow Generator - Prompt to Importable JSON

The **n8n workflow generator** turns a plain-English description into an **n8n workflow JSON that imports cleanly** - an **AI n8n workflow builder** (text to n8n workflow, prompt to JSON) that checks every node type, typeVersion, parameter key, option value and AI sub-node connection against n8n's own node definitions before you are charged. No invented nodes, no silently ignored settings, no credentials in the file. Run it from the Apify Console, on a schedule, over the API, or from n8n itself; the result is one dataset row plus a `workflow.json` you can import from a URL.

### What does the n8n Workflow Generator do?

You describe an automation: what starts it, what it should do, which apps are involved. The generator plans the workflow with an AI model, but **the model never writes n8n JSON**: it can only pick nodes, operations and settings that exist in the current n8n release - every built-in node, the LangChain AI nodes and the tool variants an AI Agent can call - and the workflow file itself is written from n8n's own node definitions, then checked the way n8n's editor would:

- 🧩 every node type exists in the current n8n release and is not deprecated or removed
- 🔢 every `typeVersion` is one that node actually has
- 🗝️ every parameter key applies to that node, version, resource and operation - and every option value is in its list
- 📎 resource locators, filters, assignments and column mappings have the shape n8n stores, and pass n8n's own value rules (a Google Sheets URL has to look like one)
- 🔌 every connection uses a kind the source emits and the target accepts, at an output slot that exists; an AI Agent has exactly one chat model, at most one memory, and its tools are wired as tools
- 🧭 there is a trigger, every node is reachable from it, and every `$('Node name')` in an expression refers to a node in the workflow
- 🧪 every `{{ }}` expression, every Code node and every JSON body parses the way n8n parses it at run time, and a node that writes something (a sheet row, a database row, a response) has something to write

If a check fails, the generator corrects the workflow and checks it again; if it still does not pass, you get the best-effort JSON, the exact errors, and **no charge**.

Generated workflows also come with what a reviewer would add: retries on nodes that call external services, a timeout on HTTP Request nodes, and one sticky note that summarises each step, the credentials to attach, and anything to check before activating.

### How is this different from asking ChatGPT for n8n JSON?

A chat model writing n8n JSON freehand produces files that import without error and quietly do nothing: a Slack node with `channel: "#leads"` (the real parameter is a resource locator called `channelId`), a node version that does not exist, an If node whose false branch is wired to output 2. n8n's importer tolerates all of it. This generator cannot produce those files: the model only ever names things that exist in n8n's definitions, and the JSON is written from those definitions, not by the model. What the model is good at - understanding what you want and writing the expressions, messages and prompts inside the nodes - is exactly what it is asked for.

### How to generate an n8n workflow from a prompt

1. Open the Actor in the Apify Console and describe your workflow in **What should the workflow do?** Name the trigger (a schedule, a webhook, a form, a chat message, a new row) and the apps involved. One workflow is generated per run.
2. Click **Start**. Most workflows take 10-30 seconds; a long request can take a few minutes.
3. Open the **Output** tab. The table shows the workflow name, whether it validated, its node count and types, the credentials to attach, and anything to check before activating.
4. Download `workflow.json` from the run's key-value store (the **Download JSON** link in the table), or copy the `workflow` field from the dataset row.
5. In n8n, create a new workflow and use **Import from URL** with the download link, **Import from File**, or paste the JSON straight onto the canvas. On n8n 1.x, Import from URL only accepts a link ending in `.json`, and the download link carries a signature after it - use Import from File there.
6. Attach the credentials listed in **Credentials to attach** (n8n prompts for them on each node, exactly as it does for a template), replace any `REPLACE_WITH_...` placeholder the warnings point at, and activate.

### What is in the output?

One row per generated workflow in the default dataset, plus `workflow.json` in the run's key-value store.

| Field               | What it holds                                                                                                                                                                                                                                                                         |
| ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `workflowName`      | The name the workflow imports with                                                                                                                                                                                                                                                    |
| `valid`             | `true` when every check above passed - the only state that is charged. It means the file imports and its nodes are configured the way n8n expects; it cannot vouch for what an external service will answer or for a design choice you meant differently - the warnings are for those |
| `workflow`          | The complete n8n workflow JSON (`name`, `nodes`, `connections`, `settings`), also served as `workflow.json`                                                                                                                                                                           |
| `nodeCount`         | Executable nodes (the overview sticky note is not counted)                                                                                                                                                                                                                            |
| `nodeTypes`         | The distinct node types used, e.g. `n8n-nodes-base.slack`                                                                                                                                                                                                                             |
| `triggerTypes`      | Which of them start the workflow                                                                                                                                                                                                                                                      |
| `credentialsNeeded` | Credential *types* to attach after import, e.g. `slackApi`, `googleSheetsOAuth2Api` - never values                                                                                                                                                                                    |
| `warnings`          | Things to check before activating: placeholders to replace, HTTP endpoints to verify, assumed settings                                                                                                                                                                                |
| `errors`            | Why the workflow did not validate; empty when `valid` is `true`                                                                                                                                                                                                                       |
| `n8nVersion`        | The n8n release the workflow targets, e.g. `2.39.7`                                                                                                                                                                                                                                   |
| `workflowJsonUrl`   | The `workflow.json` download link, usable with n8n's **Import from URL** (n8n 2.x)                                                                                                                                                                                                    |
| `generatedAt`       | Timestamp                                                                                                                                                                                                                                                                             |

### How much does it cost to generate an n8n workflow?

The Actor is **pay per event** with a single event, `workflow-generated`, charged **once per run, after the workflow is written, and only when `valid` is `true`**. A run that ends with an invalid workflow still gives you the best-effort JSON and the errors, and costs nothing. The current per-event price is on this Actor's Store page.

### Input example

```json
{
    "prompt": "Every weekday at 9am, fetch the latest items from an RSS feed, keep only the items published in the last 24 hours, and post each one to a Slack channel with its title and link."
}
```

### Output example

The row that input produces (the `workflow` field holds the full JSON; four executable nodes plus the overview note are shown by name here):

```json
{
    "prompt": "Every weekday at 9am, fetch the latest items from an RSS feed, keep only the items published in the last 24 hours, and post each one to a Slack channel with its title and link.",
    "workflowName": "Weekday RSS to Slack Digest",
    "valid": true,
    "workflow": {
        "name": "Weekday RSS to Slack Digest",
        "nodes": ["Overview", "Schedule Trigger", "Read RSS Feed", "Filter Recent Items", "Post to Slack"],
        "connections": { "...": "..." },
        "settings": { "executionOrder": "v1" }
    },
    "nodeCount": 4,
    "nodeTypes": [
        "n8n-nodes-base.scheduleTrigger",
        "n8n-nodes-base.rssFeedRead",
        "n8n-nodes-base.filter",
        "n8n-nodes-base.slack"
    ],
    "triggerTypes": ["n8n-nodes-base.scheduleTrigger"],
    "credentialsNeeded": ["slackApi"],
    "warnings": ["Replace REPLACE_WITH_RSS_FEED_URL in \"Read RSS Feed\" › url before activating."],
    "errors": [],
    "n8nVersion": "2.39.7",
    "workflowJsonUrl": "https://api.apify.com/v2/key-value-stores/.../records/workflow.json?signature=...",
    "generatedAt": "2026-09-15T14:26:01.755Z"
}
```

The Slack node inside that file is what a hand-built one looks like - a resource locator for the channel, an expression for the text, retries on:

```json
{
    "name": "Post to Slack",
    "type": "n8n-nodes-base.slack",
    "typeVersion": 2.7,
    "parameters": {
        "resource": "message",
        "operation": "post",
        "select": "channel",
        "channelId": { "__rl": true, "mode": "name", "value": "#general" },
        "text": "=New Article: *{{ $json.title }}*\n{{ $json.link }}",
        "otherOptions": {}
    },
    "retryOnFail": true,
    "maxTries": 3,
    "waitBetweenTries": 1000
}
```

### How to call the n8n workflow generator from the API

One call, one workflow back. `run-sync-get-dataset-items` waits for the run and returns the dataset rows:

```bash
curl -X POST "https://api.apify.com/v2/acts/mediocre_interest~n8n-workflow-builder/run-sync-get-dataset-items?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "prompt": "When a Stripe payment succeeds, add the customer email and amount to an Airtable base and post a short message to the #sales Slack channel." }'
```

The response is a JSON array with one row; `.[0].workflow` is the workflow JSON and `.[0].workflowJsonUrl` the download link.

- **Use it from n8n.** Apify's [official n8n integration](https://docs.apify.com/platform/integrations/n8n) lets an n8n workflow run this Actor and read the row - so an n8n workflow can generate other n8n workflows, and a Google Sheet of requests can become a folder of importable files.
- **Call it from the API.** Start runs and fetch results with the [Apify API](https://docs.apify.com/api/v2), the Apify CLI (`apify call mediocre_interest/n8n-workflow-builder`), or the [JavaScript](https://docs.apify.com/sdk/js/) and [Python](https://docs.apify.com/sdk/python/) clients.
- **Schedule it.** Add a schedule to regenerate a workflow whenever a request sheet changes.
- **Pipe it anywhere.** Make, Zapier, webhooks, Slack, Google Sheets and the rest of the [Apify integrations](https://docs.apify.com/platform/integrations).

### Which n8n nodes and versions are supported?

Every node shipped with n8n itself: the core nodes (triggers, apps, HTTP Request, Code, Set, If, Switch, Merge, Loop Over Items and the rest) and the LangChain AI nodes (AI Agent, chat models, memories, tools, vector stores, embeddings, document loaders, text splitters, output parsers). The node list and every node's settings follow the current n8n `stable` release - the `n8nVersion` field on every row says which - and each node is written at the version n8n's editor assigns when you add it today, so the JSON opens without "upgrade this node" prompts on a current n8n. Older n8n installations may not know the newest node versions; the file still imports, and n8n reports the node it cannot load.

Community nodes are not supported in this version: a service without a built-in node is handled with an HTTP Request node, and the row's warnings name the endpoint so you can verify it.

### What other Actors work with this one?

- [n8n Workflow Auditor - Linter & Security Review](https://apify.com/mediocre_interest/n8n-workflow-auditor) - audit the generated workflow, or your existing ones, for hardcoded secrets, missing error handling, stale node versions and unreachable nodes, with a score per workflow.
- [n8n Node Catalog & Community Package Scraper](https://apify.com/mediocre_interest/n8n-node-catalog) - the full list of n8n nodes and verified community packages as a dataset, the same source of truth this generator is built on.
- [n8n Workflow Backup & GitOps - Version History](https://apify.com/mediocre_interest/n8n-workflow-backup) - back up every workflow in an n8n instance on a schedule, with a diff per version.

### FAQ

#### Does the generated workflow contain my credentials?

No. The file has no `credentials` block and no secrets anywhere in it. `credentialsNeeded` lists the credential *types* the nodes use; you attach your own in n8n after import, exactly as with a template from n8n's library. Where an API needs a key and no built-in node exists, the HTTP Request node is set up to use an n8n credential rather than a literal value.

#### Why does my workflow have `REPLACE_WITH_...` values?

When the request does not say which spreadsheet, channel, table or URL to use, the generator writes a clearly marked placeholder instead of inventing a real-looking identifier, and lists each one in `warnings`. Replace them in n8n before activating - or name the target in the prompt and they will not appear.

#### Why was my run not charged?

Because the workflow did not pass validation: `valid` is `false`, `errors` says why, and the best-effort JSON is still in `workflow` for inspection. This is rare - the generator corrects and re-checks its own work before giving up - and it is never billed.

#### Does it work with self-hosted n8n?

Yes. The output is a standard workflow export; import it into n8n Cloud or any self-hosted instance. Nothing is pushed to your instance and nothing is activated - you import, attach credentials, and activate when you are ready.

#### Can it create the workflow directly in my n8n instance?

Not in this version. The quickest route today is n8n's own **Import from URL** with the `workflowJsonUrl` link, or the n8n Apify node calling this Actor and passing `workflow` to n8n's REST API in the next step.

#### Where does my prompt go?

Your prompt is sent to a third-party AI model provider as the request to plan, and nowhere else; this Actor stores it only in the run's own input and dataset, which belong to your Apify account. The node definitions the model chooses from come from n8n, not from other users' workflows.

#### How long does a run take?

Ten to thirty seconds for a typical five-to-eight-node workflow, most of it model time. Long requests - a dozen nodes, AI agents, loops, vector stores, or a workflow that needs a second pass - can take two to four minutes. Repeating an identical prompt returns the same workflow instantly.

#### What does the prompt need to say?

The trigger, the steps, and the apps - "every Monday at 8am", "when a form is submitted", "when a chat message arrives"; "look up the row", "if the total is over 100", "post to #sales". Naming concrete things (a sheet id, a channel, an endpoint) puts them in the workflow instead of placeholders. Prompts are limited to 6,000 characters and workflows to 30 nodes.

#### Can the generated workflow be wrong even though it is valid?

Valid means n8n will import it and every node is configured with real parameters and real values. It does not mean a third-party API call has the right endpoint or body - that knowledge is not in n8n's definitions - which is why every HTTP Request host and every assumption appears in `warnings` for a look before activating.

### Support

Open an issue on the Actor's **Issues** tab with the run id and the prompt, and include the `errors` from the row if the workflow did not validate. Requests for other node sets (community nodes, an older n8n release) or for a "push it into my n8n" option are welcome there too.

# Actor input Schema

## `prompt` (type: `string`):

Describe the automation in plain English: what starts it, what it should do, and which apps are involved. Name the trigger - a schedule, a webhook, a form, a new row, a chat message - and name concrete targets (a channel, a sheet, an endpoint) to get them in the workflow instead of placeholders. One workflow is generated per run.

## Actor input object example

```json
{
  "prompt": "Every weekday at 9am, fetch the latest items from an RSS feed, keep only the items published in the last 24 hours, and post each one to a Slack channel with its title and link."
}
```

# Actor output Schema

## `workflows` (type: `string`):

No description

## `workflowJson` (type: `string`):

No description

# 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 = {
    "prompt": "Every weekday at 9am, fetch the latest items from an RSS feed, keep only the items published in the last 24 hours, and post each one to a Slack channel with its title and link."
};

// Run the Actor and wait for it to finish
const run = await client.actor("mediocre_interest/n8n-workflow-builder").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 = { "prompt": "Every weekday at 9am, fetch the latest items from an RSS feed, keep only the items published in the last 24 hours, and post each one to a Slack channel with its title and link." }

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

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

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

```

## CLI example

```bash
echo '{
  "prompt": "Every weekday at 9am, fetch the latest items from an RSS feed, keep only the items published in the last 24 hours, and post each one to a Slack channel with its title and link."
}' |
apify call mediocre_interest/n8n-workflow-builder --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,mediocre_interest/n8n-workflow-builder"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/nwImOPLSciZTf2wr0/builds/rSDEXGy2sgGmeTWQH/openapi.json
