📚 Add n8n documentation page

This commit is contained in:
Jan Oberhauser 2019-09-22 18:29:03 +02:00
parent 9dbf2ee148
commit a5b5b60a57
33 changed files with 733 additions and 655 deletions

View file

@ -8,9 +8,6 @@ so also used with internal tools.
<a href="https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-screenshot.png"><img src="https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-screenshot.png" width="550" alt="n8n.io - Screenshot"></a>
Is still in beta so can not guarantee that everything works perfectly. Also
is there currently not much documentation. That will hopefully change soon.
## Demo
@ -20,6 +17,12 @@ automatically sends a new Slack notification every time a Github repository
received or lost a star.
## Documentation
The official n8n documentation can be found under: [https://docs.n8n.io](https://docs.n8n.io)
Additional information and example workflows on the n8n.io website: [https://n8n.io](https://n8n.io)
## Usage
@ -68,7 +71,7 @@ did not hear anybody complain there. So I guess it should be ok.
## Development Setup
Have you found a bug :bug: ? Or maybe you have a nice feature :sparkles: to contribute ? The [CONTRIBUTING guide](CONTRIBUTING.md) will help you get your development environment ready in minutes.
Have you found a bug :bug: ? Or maybe you have a nice feature :sparkles: to contribute ? The [CONTRIBUTING guide](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md) will help you get your development environment ready in minutes.

View file

@ -8,13 +8,11 @@ so also used with internal tools.
<a href="https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-screenshot.png"><img src="https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-screenshot.png" width="550" alt="n8n.io - Screenshot"></a>
Is still in beta so can not guarantee that everything works perfectly. Also
is there currently not much documentation. That will hopefully change soon.
## Contents
- [Demo](#demo)
- [Documentation](#documentation)
- [Start n8n in Docker](#start-n8n-in-docker)
- [Start with tunnel](#start-with-tunnel)
- [Securing n8n](#securing-n8n)
@ -33,6 +31,12 @@ which shows how to create a simple workflow which automatically sends a new
Slack notification every time a Github repository received or lost a star.
## Documentation
The official n8n documentation can be found under: [https://docs.n8n.io](https://docs.n8n.io)
Additional information and example workflows on the n8n.io website: [https://n8n.io](https://n8n.io)
## Start n8n in Docker

0
docs/.nojekyll Normal file
View file

View file

@ -1,5 +1,11 @@
# n8n - Workflow Automation Tool
# n8n Documentation
![n8n.io - Workflow Automation](https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-logo.png)
This is the documentation of n8n a free node-based "Open Source" (with Commons Clause)
Workflow Automation Tool.
Documentation coming soon... in the meantime, you can browse the [awesome collection of n8n workflows](workflows/README.md).
It covers everything from setup, usage to development. It is still work in progress and all contributions are welcome.
## What is n8n?
n8n (pronounced nodemation) helps you to interconnect each and every app with an API in the world with each other to share and manipulate its data without a single line of code. It is an easy to use, user-friendly and highly customizable service, which uses an intuitive user interface for you to design your unique workflows very fast. Hosted on your server and not based in the cloud it keeps your sensible data very secure in your own trusted database.

36
docs/_sidebar.md Normal file
View file

@ -0,0 +1,36 @@
- Home
- [Welcome](/)
- Getting started
- [Key Components](key-components.md)
- [Quick Start](quick-start.md)
- [Setup](setup.md)
- [Tutorials](tutorials.md)
- [Docker](docker.md)
- Advanced
- [Configuration](configuration.md)
- [Database](database.md)
- [Keyboard Shortcuts](keyboard-shortcuts.md)
- [Nodes](nodes.md)
- [Security](security.md)
- [Sensitive Data](sensitive-data.md)
- [Server Setup](server-setup.md)
- [Start Workflows via CLI](start-workflows-via-cli.md)
- [Workflow](workflow.md)
- Development
- [Create Node](create-node.md)
- [Development](development.md)
- Links
- [![Github](https://n8n.io/favicon.ico ':size=16')n8n.io](https://n8n.io)
- [![Github](https://icongram.jgog.in/simple/github.svg?color=808080&size=16)Github](https://github.com/n8n-io/n8n)
- [![NPM](https://icongram.jgog.in/simple/npm.svg?colored&size=16)NPM](https://www.npmjs.com/package/n8n)
- [![Twitter](https://icongram.jgog.in/simple/twitter.svg?colored&size=16)@n8n_io](http://twitter.com/n8n_io)

66
docs/configuration.md Normal file
View file

@ -0,0 +1,66 @@
# Configuration
It is possible to change some of the n8n defaults via special environment variables.
The ones that currently exist are:
## Execution Data Manual Runs
Normally executions which got started via the Editor UI will not be saved as
they are normally only for testing and debugging. That default can be changed
with this environment variable.
```bash
export EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
```
This setting can also be overwritten on a per workflow basis in the workflow
settings in the Editor UI.
## Execution Data Error/Success
When a workflow gets executed it will save the result in the database. That is
the case for executions that did succeed and for the ones that failed. That
default behavior can be changed like this:
```bash
export EXECUTIONS_DATA_SAVE_ON_ERROR=none
export EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
```
Possible values are:
- **all**: Saves all data
- **none**: Do not save anything (recommended if a workflow runs a very often and/or processes a lot of data, set up "Error Workflow" instead)
These settings can also be overwritten on a per workflow basis in the workflow
settings in the Editor UI.
## Exclude Nodes
It is possible to not allow users to use nodes of a specific node type. If you, for example,
do not want that people can write data to disk with the "n8n-nodes-base.writeBinaryFile"
node and can not execute commands with the "n8n-nodes-base.executeCommand" node you can
set the following:
```bash
export NODES_EXCLUDE="[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]"
```
## Timezone
The timezone is set by default to "America/New_York". It gets for example used by the
Cron-Node to know at what time the workflow should be started at. To set a different
default timezone simply set `GENERIC_TIMEZONE` to the appropriate value like for example
for Berlin (Germany):
```bash
export GENERIC_TIMEZONE="Europe/Berlin"
```
You can find the name of your timezone here:
[https://momentjs.com/timezone/](https://momentjs.com/timezone/)

65
docs/create-node.md Normal file
View file

@ -0,0 +1,65 @@
# Create Node
It is quite easy to create own nodes in n8n. Mainly three things have to be defined:
1. Generic information like name, description, image/icon
1. The parameters to display via which the user can interact with it
1. The code to run once the node gets executed
To simplify the development process we created a very basic CLI which creates boilerplate code to get started and then also builds the node (as they are written in TypeScript) and copies it to the correct location.
## Create the first basic node
1. Install the n8n-node-dev CLI: `npm install -g n8n-node-dev`
1. Create and go into the newly created folder in which you want to keep the code of the node
1. Use CLI to create boilerplate node code: `n8n-node-dev new`
1. Answer the questions (btw. Type “Execute” is the regular node you probably want to create).
It will then at the end create the node in the current folder
1. Program… Add the functionality to the node
1. Build the node and copy to correct location: `n8n-node-dev build`
That command will build the JavaScript version of the node from the TypeScript code and copies it then
the user folder where custom nodes get read from `~/.n8n/custom/`
1. Restart n8n and refresh the window that the new node gets displayed
## Node Development Guidelines
That everything works correctly, similarly and no unnecessary code gets added it is important to follow the following guidelines:
### Write nodes in TypeScript
All code of n8n is written in TypeScript so should also be the nodes. That makes development easier and faster and avoids at least some bugs.
### Do use the built in request library
Some third-party services have their own libraries on npm which make it a little bit easier to create an integration. It can be quite tempting to use them. The problem with those is that you add another dependency and not just one you add also all the dependencies of the dependencies. That means that more and more code gets added, has to get loaded, can introduce security vulnerabilities and bugs and so on. So please use the built-in module which can be used like this:
```typescript
const response = await this.helpers.request(options);
```
That is simply using the npm package `request-promise-native` which is the basic npm `request` module but with promises.
### Reuse parameter names
When a node can perform multiple operations for example edit and delete some kind of entity. It would need for both operations an entity-id. Do not call them "editId" and "deleteId" simply call them "id". n8n can handle multiple parameters with the same name without a problem as long as only one is visible. To make sure that is the case the "displayOptions" can be used. By keeping the same name, the value can be kept if a user switches the operation from for example "edit" to "delete".
### Create an "Options" parameter
Some nodes may need a lot of options. Add only the very important ones to the top level and create for all the other ones an "Options" parameter where they can be added if needed. So the interface stays clean and does not unnecessarily confuse people. A good example of that would be the "XML Node".
### Follow exiting parameter naming guideline
Ok, there is not much of a guideline yet but if your node can do multiple things call the parameter which sets the behavior either "mode" (like "Merge" and "XML" node) or "operation" like the most other ones. If this operations can be done on different resources (like "User" or "Order) create a "resource" parameter (like "Pipedrive" and "Trello" node)
### Node Icons
Check existing node icons as a reference when you create own ones. The resolution of an icon should be 60x60px and saved as png.

78
docs/database.md Normal file
View file

@ -0,0 +1,78 @@
# Database
By default, n8n uses SQLite to save credentials, past executions, and workflows.
n8n however also supports MongoDB and PostgresDB.
## MongoDB
!> **WARNING**: Use Postgres if possible! Mongo has problems with saving large
amounts of data in a document and causes also other problems. So support will
may be dropped in the future.
To use MongoDB as database you can provide the following environment variables like
in the example bellow:
- `DB_TYPE=mongodb`
- `DB_MONGODB_CONNECTION_URL=<CONNECTION_URL>`
Replace the following placeholders with the actual data:
- MONGO_DATABASE
- MONGO_HOST
- MONGO_PORT
- MONGO_USER
- MONGO_PASSWORD
```bash
export DB_TYPE=mongodb
export DB_MONGODB_CONNECTION_URL=mongodb://MONGO_USER:MONGO_PASSWORD@MONGO_HOST:MONGO_PORT/MONGO_DATABASE
n8n start
```
## PostgresDB
To use PostgresDB as database you can provide the following environment variables
- `DB_TYPE=postgresdb`
- `DB_POSTGRESDB_DATABASE` (default: 'n8n')
- `DB_POSTGRESDB_HOST` (default: 'localhost')
- `DB_POSTGRESDB_PORT` (default: 5432)
- `DB_POSTGRESDB_USER` (default: 'root')
- `DB_POSTGRESDB_PASSWORD` (default: empty)
```bash
export DB_TYPE=postgresdb
export DB_POSTGRESDB_DATABASE=n8n
export DB_POSTGRESDB_HOST=postgresdb
export DB_POSTGRESDB_PORT=5432
export DB_POSTGRESDB_USER=n8n
export DB_POSTGRESDB_PASSWORD=n8n
n8n start
```
## SQLite
The default database which gets used if no other one is defined.
The database file is located at:
`~/.n8n/database.sqlite`
## Other Databases
Currently, only the above databases are supported. n8n uses internally
[TypeORM](https://typeorm.io) so adding support for the following databases
should not be too much work:
- CockroachDB
- MariaDB
- Microsoft SQL
- MySQL
- Oracle
If you can not use any of the currently supported databases for some reason and
you can program, you can simply add support by yourself. If not you can request
that support should be added here:
[https://community.n8n.io/c/feature-requests/cli](https://community.n8n.io/c/feature-requests/cli)

3
docs/development.md Normal file
View file

@ -0,0 +1,3 @@
# Development
Have you found a bug :bug:? Or maybe you have a nice feature :sparkles: to contribute? The [CONTRIBUTING guide](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md) will help you get your development environment ready in minutes.

4
docs/docker.md Normal file
View file

@ -0,0 +1,4 @@
# Docker
Detailed information about how to run n8n in Docker can be found in the README
of the [Docker Image](https://github.com/n8n-io/n8n/blob/master/docker/images/n8n/README.md).

52
docs/index.html Normal file
View file

@ -0,0 +1,52 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>n8n Documentation</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="Documentation of n8n - Open Source Workflow Automation Tool">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" href="//unpkg.com/docsify/lib/themes/vue.css">
<style>
.app-name-link img {
width: 200px;
}
.sidebar-nav a img {
position: relative;
top: 3px;
margin-right: 0.5em;
}
</style>
</head>
<body>
<div id="app"></div>
<script src="//unpkg.com/docsify-edit-on-github/index.js"></script>
<script>
window.$docsify = {
auto2top: true,
ga: 'UA-146470481-3',
themeColor: '#ff0000',
name: 'docs.n8n.io',
logo: 'images/n8n-logo.png',
loadSidebar: true,
subMaxLevel: 2,
repo: '',
plugins: [
EditOnGithubPlugin.create('https://github.com/n8n-io/n8n/tree/master/docs/')
]
}
</script>
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>
<script src="https://unpkg.com/docsify-copy-code@2"></script>
<script src="//unpkg.com/prismjs/components/prism-bash.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-json.min.js"></script>
<script src="//unpkg.com/prismjs/components/prism-typescript.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/ga.min.js"></script>
<script src="//unpkg.com/docsify/lib/plugins/search.min.js"></script>
</body>
</html>

26
docs/key-components.md Normal file
View file

@ -0,0 +1,26 @@
# Key Components
## Connection
A connection establishes a link between nodes to route data through the workflow. Each node can have one or multiple connections.
## Node
Example: Google Sheets Node. It can be used to retrieve or write data to a Google Sheet.
A node is an entry for retrieving data, a function to process data or an exit for sending data. Data process includes filtering, recomposing and changing data. There is one or several nodes for your API, service or app. You can easily connect multiple nodes, which allows you to create simple and complex workflows with them very intuitively.
## Trigger
Example: Trello Trigger Node. When a Trello Board gets updated, it will trigger a workflow to start using the data from the updated board.
A trigger-node is a node which starts a workflow and supplies the initial data. What triggers it, depends on the node. It could be the time, a webhook call or an event from an external service.
## Workflow
A workflow is a canvas, on which you can place and connect nodes. You define a trigger node(s), optionally function nodes which change the data in the flow or in external services. A workflow can be started manually
or by trigger nodes. A workflow run ends when all active and connected nodes have processed their data.

View file

@ -0,0 +1,28 @@
# Keyboard Shortcuts
The following keyboard shortcuts can currently be used:
## General
- **Ctrl + Left Mouse Button**: Move/Pan Node View
- **Ctrl + a**: Select all nodes
- **Ctrl + Alt + n**: Create new workflow
- **Ctrl + o**: Open workflow
- **Ctrl + s**: Save the current workflow
- **Ctrl + v**: Paste nodes
- **Tab**: Open "Node Creator". Type to filter and navigate with arrow keys. To create press "enter"
## With node/s selected
- **ArrowDown**: Select sibling node bellow the current one
- **ArrowLeft**: Select node left of the current one
- **ArrowRight**: Select node right of the current one
- **ArrowUp**: Select sibling node above the current one
- **Ctrl + c**: Copy nodes
- **Ctrl + x**: Cut nodes
- **d**: Deactivate nodes
- **Delete**: Delete nodes
- **F2**: Rename node
- **Shift + ArrowLeft**: Select all nodes left of the current one
- **Shift + ArrowRight**: Select all nodes right of the current one

72
docs/nodes.md Normal file
View file

@ -0,0 +1,72 @@
# Node
## Types
There are two main node types in n8n Trigger- and Regular-Nodes.
### Trigger Nodes
The Trigger-Nodes start a workflow and supply the initial data. A workflow can contain multiple trigger nodes but with each execution, just one of them will execute as they do not have any input and they are the nodes from which the execution starts.
### Regular Nodes
These nodes do the actual “work”. They can add, remove and edit the data in the flow, request and send data to external APIs and can do everything possible with Node.js in general.
## Credentials
External services need a way to identify and authenticate users. That data, which can range from API key over email/password combination to a very long multi-line private key, get saved in n8n as credentials.
To make sure that the data is secure, it gets saved to the database encrypted. As encryption key does a random personal encryption key gets used which gets automatically generated on the first start of n8n and then saved under `~/.n8n/config`.
Nodes in n8n can then request that credential information. As an additional layer of security can credentials only be accessed by node types which specifically got the right to do so.
## Expressions
With the help of expressions, it is possible to set node parameters dynamically by referencing other data. That can be data from the flow, nodes, the environment or self-generated data. They are normal text with placeholders (everything between {{...}}) that can execute JavaScript code which offers access to special variables to access data.
An expression could look like this:
My name is: `{{$node["Webhook"].data["query"]["name"]}}`
This one would return "My name is: " and then attach the value that the node with the name "Webhook" outputs and there select the property "query" and its key "name". So if the node would output this data:
```json
{
"query": {
"name": "Jim"
}
}
```
the value would be: "My name is: Jim"
The following special variables are available:
- **$binary**: Incoming binary data of a node
- **$data**: Incoming JSON data of a node
- **$env**: Environment variables
- **$node**: Data of other nodes (output-data, parameters)
- **$parameters**: Parameters of the current node
Normally it is not needed to write the JavaScript variables manually as they can be simply selected with the help of the Expression Editor.
## Parameters
On the most nodes in n8n parameters can be set. The values that get set define what exactly a node does.
That values which are set are by default static and are always the same no matter what data they process. It is however also possible to set the values dynamically with the help of Expressions. With them, it is possible to make the value depending on other factors like the data of flow or parameters of other nodes.
More information about it can be found under [Expressions](#expressions).
## Pausing Node
Sometimes when creating and debugging a workflow it is helpful to not execute some specific nodes. To make that as simple as possible and not having to disconnect each node, it is possible to pause them. When a node gets paused the data simple passes through the node without being changed.
There are two ways to pause a node. Either pressing the pause button which gets displayed above the node when hovering over it. Or by selecting the node and pressing “d”.

41
docs/quick-start.md Normal file
View file

@ -0,0 +1,41 @@
# Quick Start
## Give n8n a spin
To spin up n8n to have a look you can run:
```bash
npx n8n
```
It will then download everything which is needed and start n8n.
You can then access n8n by opening:
[http://localhost:5678](http://localhost:5678)
## Start with docker
To just play around a little bit you can start n8n with docker.
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
n8nio/n8n
```
Be aware that all data will be lost once the docker container got removed. To
persist the data mount the `~/.n8n` folder:
```bash
docker run -it --rm \
--name n8n \
-p 5678:5678 \
-v ~/.n8n:/root/.n8n \
n8nio/n8n
```
More information about the Docker setup can be found the README of the
[Docker Image](https://github.com/n8n-io/n8n/blob/master/docker/images/n8n/README.md)

13
docs/security.md Normal file
View file

@ -0,0 +1,13 @@
# Security
By default, n8n can be accessed by everybody. This is OK if you have it only running
locally but if you deploy it on a server which is accessible from the web you have
to make sure that n8n is protected!
Right now we have very basic protection via basic-auth in place. It can be activated
by setting the following environment variables:
```bash
export N8N_BASIC_AUTH_ACTIVE=true
export N8N_BASIC_AUTH_USER=<USER>
export N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
```

17
docs/sensitive-data.md Normal file
View file

@ -0,0 +1,17 @@
# Sensitive Data via File
To avoid passing sensitive information via environment variables "_FILE" may be
appended to some environment variables. It will then load the data from a file
with the given name. That makes it possible to load data easily from
Docker- and Kubernetes-Secrets.
The following environment variables support file input:
- DB_MONGODB_CONNECTION_URL_FILE
- DB_POSTGRESDB_DATABASE_FILE
- DB_POSTGRESDB_HOST_FILE
- DB_POSTGRESDB_PASSWORD_FILE
- DB_POSTGRESDB_PORT_FILE
- DB_POSTGRESDB_USER_FILE
- N8N_BASIC_AUTH_PASSWORD_FILE
- N8N_BASIC_AUTH_USER_FILE

16
docs/server-setup.md Normal file
View file

@ -0,0 +1,16 @@
# Server Setup
!> ***Important***: Make sure that you secure your n8n instance like described under [Security](security.md)!
To run n8n on your webserver with own domain some environment variables
should be set to the appropriate values.
A possible configuration to run n8n on `https://n8n.example.com/` would look
like this:
```bash
export N8N_HOST="n8n.example.com"
export N8N_PROTOCOL=https
export N8N_PORT=443
export VUE_APP_URL_BASE_API="https://n8n.example.com/"
```

36
docs/setup.md Normal file
View file

@ -0,0 +1,36 @@
# Setup
## Installation
To install n8n globally:
```bash
npm install n8n -g
```
## Start
After the installation n8n can be started by simply typing in:
```bash
n8n
# or
n8n start
```
## Start with tunnel
!> **WARNING**: This is only meant for local development and testing. Should not be used in production!
To be able to use webhooks which all triggers of external services like Github
rely on n8n has to be reachable from the web. To make that easy n8n has a
special tunnel service (uses this code: [https://github.com/localtunnel/localtunnel](https://github.com/localtunnel/localtunnel)) which redirects requests from our servers to your local
n8n instance.
To use it simply start n8n with `--tunnel`
```bash
n8n start --tunnel
```

View file

@ -0,0 +1,15 @@
# Start Workflows via CLI
Workflows can not just be started by triggers, webhooks or manually via the
Editor it is also possible to start them directly via the CLI.
Execute a saved workflow by its ID:
```bash
n8n execute --id <ID>
```
Execute a workflow from a workflow file:
```bash
n8n execute --file <WORKFLOW_FILE>
```

3
docs/test.md Normal file
View file

@ -0,0 +1,3 @@
# This is a simple test
with some text

24
docs/tutorials.md Normal file
View file

@ -0,0 +1,24 @@
# Tutorials
## Examples
Example workflows which show what can be done with n8n can be found here:
[https://n8n.io/workflows](https://n8n.io/workflows)
If you want to know how a node can get used in context, you can search for it here:
[https://n8n.io/nodes](https://n8n.io/nodes). There it shows in which workflows the
node got used.
## Videos
- [Slack Notification on Github Star](https://www.youtube.com/watch?v=3w7xIMKLVAg)
### Community Tutorials
- [n8n basics 1/3 - Getting Started](https://www.youtube.com/watch?v=JIaxjH2CyFc)
- [n8n basics 2/3 - Simple Workflow](https://www.youtube.com/watch?v=ovlxledZfM4)
- [n8n basics 3/3 - Transforming JSON](https://www.youtube.com/watch?v=wGAEAcfwV8w)

109
docs/workflow.md Normal file
View file

@ -0,0 +1,109 @@
# Workflow
## Activate
Activating a workflow means that the Trigger & Webhook nodes get activated and can trigger a workflow to run. By default are all newly created workflows deactivated. That means that even if a Trigger-Node like the Cron-Node should start a workflow because a predefined time is reached it will not unless the workflow gets activated. It is only possible to activate a workflow which contains a Trigger or a Webhook node.
## Data Flow
Nodes do not only process one "item" they process multiple ones. So if the Trello-Node is set to "Create-Card" and it has an expression set for "Name" to be set depending on "name"-property it will create a card for each item, always choosing the name-property-value of the current one.
This data would, for example, create two boards. One named "test1" the other one named "test2":
```json
[
{
name: "test1"
},
{
name: "test2"
}
]
```
## Error Workflows
For each workflow, an optional "Error Workflow" can be set. It gets executed in case the execution of the workflow fails. That makes it possible to for example inform the user via Email or Slack if something goes wrong. The same "Error Workflow" can be set on multiple workflows.
The only difference between a regular workflow and an "Error Workflow" is that it contains an "Error Trigger" node. So it is important to make sure that this node gets created before setting a workflow as "Error Workflow".
The "Error Trigger" node will trigger in case the execution fails and receives information about it. The data looks like this:
```json
[
{
"execution": {
"id": "231",
"retryOf": "34",
"error": {
"message": "Example Error Message",
"stack": "Stacktrace"
},
"lastNodeExecuted": "Node With Error",
"mode": "manual"
},
"workflow": {
"id": "1",
"name": "Example Workflow"
}
}
]
```
All information is always present except:
- **execution.id**: Only present when the execution gets saved in the Database
- **execution.retryOf**: Only present when the execution is a retry of a previously failed one
### Setting Error Workflow
An "Error Workflow" can be set in the Workflow Settings which can be accessed by pressing the "Workflow" button in the menu on the menu on the left side. The last option is "Settings". In the then appearing window, the "Error Workflow" can be selected via the Dropdown "Error Workflow".
## Share Workflows
All workflows are simple JSON and can so be shared very easily.
There are multiple ways to download a workflow as JSON to then share it with other people via Email, Slack, Skype, Dropbox, …
1. Pressing "Download" under the Workflow button in the menu on the left. It then downloads the workflow as JSON file
1. Selecting the nodes in the editor which should be exported and then copy them (Ctrl + c). The nodes get then saved as JSON in the clipboard and can be pasted wherever desired (Ctrl + v).
Importing that JSON representation again into n8n is as easy and can also be done in different ways:
1. Pressing "Import from File" or "Import from URL" under the Workflow button in the menu on the left.
1. Copying the JSON workflow to the clipboard (Ctrl + c) and then simply pasting it directly into the editor (Ctrl + v).
## Workflow Settings
On each workflow, it is possible to set some custom settings and overwrite some of the global default settings. Currently, the following settings can be set:
### Error Workflow
Workflow to run in case the execution of the current workflow fails. More information in section [Error Workflows](#error-workflows)
### Timezone
The timezone to use in the current workflow. If not set the global Timezone (by default "New York" gets used). This is for example important for the Cron Trigger node.
### Save Data Error Execution
If the Execution data of the workflow should be saved when it fails.
### Save Data Success Execution
If the Execution data of the workflow should be saved when it succeeds.
### Save Manual Executions
If executions started from the Editor UI should be saved.

View file

@ -1,68 +0,0 @@
<div align="center">
<img width="464" height="106" src="../images/n8n-logo.png" alt="n8n">
<br>
<br>
<br>
</div>
<br>
Awesome n8n workflows collection
================================
You will find here a collection of n8n worflow examples that can be easily imported in n8n.
## Contents
- [For loop](#for-loop) - how to iterate over an JSON array
- [Excel to Postgres](#excel-to-postgres) - how to migrate data from Excel to PostgreSQL
- [Postgres to Excel](#postgres-to-excel) - how to migrate data from Postgres to Excel
- [Update Postgres rows](#update-postgres-rows) - how to update PostreSQL rows
## For loop
![](for-loop.png)
1. Make an HTTP request that responds with a JSON array
1. For each item in the response array, make an HTTP request
[Download workflow](for-loop.json)
## Excel to Postgres
![](excel-to-postgres.png)
1. Read XLS from file
1. convert it to JSON
1. insert it in Postgres
[Download workflow](excel-to-postgres.json)
## Postgres to Excel
![](postgres-to-excel.png)
1. Read data from Postgres
1. Converting it to XLS
1. save it to disk
[Download workflow](postgres-to-excel.json)
## Update Postgres rows
![](update-postgres-rows.png)
- Simple update of data
[Download workflow](update-postgres-rows.json)

View file

@ -1,76 +0,0 @@
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"filePath": "spreadsheet.xls"
},
"name": "Read Binary File",
"type": "n8n-nodes-base.readBinaryFile",
"typeVersion": 1,
"position": [
450,
650
]
},
{
"parameters": {},
"name": "Spreadsheet File1",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
600,
650
]
},
{
"parameters": {
"table": "product",
"columns": "name,ean"
},
"name": "Insert Rows1",
"type": "n8n-nodes-base.postgres",
"typeVersion": 1,
"position": [
750,
650
],
"credentials": {
"postgres": "postgres"
}
}
],
"connections": {
"Read Binary File": {
"main": [
[
{
"node": "Spreadsheet File1",
"type": "main",
"index": 0
}
]
]
},
"Spreadsheet File1": {
"main": [
[
{
"node": "Insert Rows1",
"type": "main",
"index": 0
}
]
]
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

View file

@ -1,97 +0,0 @@
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"url": "https://jsonplaceholder.typicode.com/posts?userId=1",
"headerParametersUi": {
"parameter": []
}
},
"name": "Http Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
400,
300
]
},
{
"parameters": {
"functionCode": "const newItems = [];\nfor (const item of items[0].json) {\n newItems.push({json: item});\n}\nreturn newItems;"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
550,
300
]
},
{
"parameters": {
"url": "https://postman-echo.com/get",
"responseFormat": "string",
"queryParametersUi": {
"parameter": [
{
"name": "title",
"value": "={{$node[\"Function\"].data[\"title\"]}}"
}
]
}
},
"name": "Http Request1",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
700,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "Http Request",
"type": "main",
"index": 0
}
]
]
},
"Http Request": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "Http Request1",
"type": "main",
"index": 0
}
]
]
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,78 +0,0 @@
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"operation": "executeQuery",
"query": "SELECT name, ean FROM product"
},
"name": "Run Query",
"type": "n8n-nodes-base.postgres",
"typeVersion": 1,
"position": [
450,
450
],
"credentials": {
"postgres": "postgres"
}
},
{
"parameters": {
"operation": "toFile"
},
"name": "Spreadsheet File",
"type": "n8n-nodes-base.spreadsheetFile",
"typeVersion": 1,
"position": [
600,
450
]
},
{
"parameters": {
"fileName": "spreadsheet.xls"
},
"name": "Write Binary File",
"type": "n8n-nodes-base.writeBinaryFile",
"typeVersion": 1,
"position": [
750,
450
]
}
],
"connections": {
"Run Query": {
"main": [
[
{
"node": "Spreadsheet File",
"type": "main",
"index": 0
}
]
]
},
"Spreadsheet File": {
"main": [
[
{
"node": "Write Binary File",
"type": "main",
"index": 0
}
]
]
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

View file

@ -1,56 +0,0 @@
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"functionCode": "const newItems = [];\nfor (let i=1;i < 6; i++) {\n newItems.push({\n json: {\n id: i,\n name: `New name ${i}`,\n ean: `New EAN ${i}`,\n }\n });\n}\nreturn newItems;"
},
"name": "Function1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
460,
300
]
},
{
"parameters": {
"operation": "update",
"table": "product",
"columns": "name,ean"
},
"name": "Update Rows",
"type": "n8n-nodes-base.postgres",
"typeVersion": 1,
"position": [
610,
300
],
"credentials": {
"postgres": "postgres"
}
}
],
"connections": {
"Function1": {
"main": [
[
{
"node": "Update Rows",
"type": "main",
"index": 0
}
]
]
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

View file

@ -8,20 +8,16 @@ so also used with internal tools.
<a href="https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-screenshot.png"><img src="https://raw.githubusercontent.com/n8n-io/n8n/master/docs/images/n8n-screenshot.png" width="550" alt="n8n.io - Screenshot"></a>
Is still in beta so can not guarantee that everything works perfectly. Also
is there currently not much documentation. That will hopefully change soon.
## Contents
<!-- TOC -->
- [Demo](#demo)
- [Documentation](#documentation)
- [Give n8n a spin](#give-n8n-a-spin)
- [Installation](#installation)
- [Start](#start)
- [Execute Workflow from CLI](#execute-workflow-from-cli)
- [Create Custom Nodes](#create-custom-nodes)
- [Keyboard Shortcuts](#keyboard-shortcuts)
- [Run n8n on own server](#run-n8n-on-own-server)
- [Hosted n8n](#hosted-n8n)
- [What does n8n mean and how do you pronounce it](#what-does-n8n-mean-and-how-do-you-pronounce-it)
- [Support](#support)
@ -36,158 +32,12 @@ is there currently not much documentation. That will hopefully change soon.
which shows how to create a simple workflow which automatically sends a new
Slack notification every time a Github repository received or lost a star.
## Give n8n a spin
To spin up n8n to have a look you can run:
## Documentation
```bash
npx n8n
```
The official n8n documentation can be found under: [https://docs.n8n.io](https://docs.n8n.io)
It will then download everything which is needed and start n8n.
You can then access n8n by opening:
[http://localhost:5678](http://localhost:5678)
## Installation
To fully install n8n globally execute:
```bash
npm install n8n -g
```
## Start
After the installation n8n can be started by simply typing in:
```bash
n8n
# or
n8n start
```
### Start with tunnel
> **WARNING**: This is only meant for local development and testing. Should not be used in production!
To be able to use webhooks which all triggers of external services like Github
rely on n8n has to be reachable from the web. To make that easy n8n has a
special tunnel service (uses this code: [https://github.com/localtunnel/localtunnel](https://github.com/localtunnel/localtunnel)) which redirects requests from our servers to your local
n8n instance.
To use it simply start n8n with `--tunnel`
```bash
n8n start --tunnel
```
### Securing n8n
By default, n8n can be accessed by everybody. This is OK if you have it only running
locally but if you deploy it on a server which is accessible from the web you have
to make sure that n8n is protected!
Right now we have very basic protection via basic-auth in place. It can be activated
by setting the following environment variables:
```
N8N_BASIC_AUTH_ACTIVE=true
N8N_BASIC_AUTH_USER=<USER>
N8N_BASIC_AUTH_PASSWORD=<PASSWORD>
```
### Start with other Database
By default, n8n uses SQLite to save credentials, past executions and workflows.
n8n however also supports MongoDB and PostgresDB. To use them simply a few
environment variables have to be set.
#### Start with MongoDB as Database
> **WARNING**: Use Postgres if possible! Mongo has problems with saving large
> amounts of data in a document and causes also other problems. So support will
> may be dropped in the future.
To use MongoDB as database you can provide the following environment variables like
in the example bellow:
- `DB_TYPE=mongodb`
- `DB_MONGODB_CONNECTION_URL=<CONNECTION_URL>`
Replace the following placeholders with the actual data:
- MONGO_DATABASE
- MONGO_HOST
- MONGO_PORT
- MONGO_USER
- MONGO_PASSWORD
```bash
export DB_TYPE=mongodb
export DB_MONGODB_CONNECTION_URL=mongodb://MONGO_USER:MONGO_PASSWORD@MONGO_HOST:MONGO_PORT/MONGO_DATABASE
n8n start
```
#### Start with PostgresDB as Database
To use PostgresDB as database you can provide the following environment variables
- `DB_TYPE=postgresdb`
- `DB_POSTGRESDB_DATABASE` (default: 'n8n')
- `DB_POSTGRESDB_HOST` (default: 'localhost')
- `DB_POSTGRESDB_PORT` (default: 5432)
- `DB_POSTGRESDB_USER` (default: 'root')
- `DB_POSTGRESDB_PASSWORD` (default: empty)
```bash
export DB_TYPE=postgresdb
export DB_POSTGRESDB_DATABASE=n8n
export DB_POSTGRESDB_HOST=postgresdb
export DB_POSTGRESDB_PORT=5432
export DB_POSTGRESDB_USER=n8n
export DB_POSTGRESDB_PASSWORD=n8n
n8n start
```
## Passing Sensitive Data via File
To avoid passing sensitive information via environment variables "_FILE" may be
appended to some environment variables. It will then load the data from a file
with the given name. That makes it possible to load data easily from
Docker- and Kubernetes-Secrets.
The following environment variables support file input:
- DB_MONGODB_CONNECTION_URL_FILE
- DB_POSTGRESDB_DATABASE_FILE
- DB_POSTGRESDB_HOST_FILE
- DB_POSTGRESDB_PASSWORD_FILE
- DB_POSTGRESDB_PORT_FILE
- DB_POSTGRESDB_USER_FILE
- N8N_BASIC_AUTH_PASSWORD_FILE
- N8N_BASIC_AUTH_USER_FILE
## Execute Workflow from CLI
Workflows can not just be started by triggers, webhooks or manually via the
Editor it is also possible to execute them directly via the CLI.
Execute a saved workflow by its ID:
```bash
n8n execute --id <ID>
```
Execute a workflow from a workflow file:
```bash
n8n execute --file <WORKFLOW_FILE>
```
Additional information and example workflows on the n8n.io website: [https://n8n.io](https://n8n.io)
## Create Custom Nodes
@ -198,120 +48,7 @@ helps with n8n-node-development.
[To n8n-node-dev](https://github.com/n8n-io/n8n/tree/master/packages/node-dev)
## Keyboard Shortcuts
The following keyboard shortcuts can currently be used:
### General
- **Ctrl + Left Mouse Button**: Move/Pan Node View
- **Ctrl + a**: Select all nodes
- **Ctrl + Alt + n**: Create new workflow
- **Ctrl + o**: Open workflow
- **Ctrl + s**: Save the current workflow
- **Ctrl + v**: Paste nodes
- **Tab**: Open "Node Creator". Type to filter and navigate with arrow keys. To create press "enter"
### With node/s selected
- **ArrowDown**: Select sibling node bellow the current one
- **ArrowLeft**: Select node left of the current one
- **ArrowRight**: Select node right of the current one
- **ArrowUp**: Select sibling node above the current one
- **Ctrl + c**: Copy nodes
- **Ctrl + x**: Cut nodes
- **d**: Deactivate nodes
- **Delete**: Delete nodes
- **F2**: Rename node
- **Shift + ArrowLeft**: Select all nodes left of the current one
- **Shift + ArrowRight**: Select all nodes right of the current one
## Run n8n on own server
To run n8n on your webserver with own domain some environment variables
should be set to the appropriate values.
A possible configuration to run n8n on `https://n8n.example.com/` would look
like this:
```
N8N_HOST: "n8n.example.com"
N8N_PROTOCOL: "https"
N8N_PORT: "443"
VUE_APP_URL_BASE_API: "https://n8n.example.com/"
```
***Important***: Make sure that you secure your n8n instance like described above in "Securing n8n"!
## Additional Configuration
It is possible to change some of the n8n defaults via special environment variables.
The ones that currently exist are:
### EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS
Normally executions which got started via the Editor UI will not be saved as
they are normally only for testing and debugging. That default can be changed
with this environment variable.
```
EXECUTIONS_DATA_SAVE_MANUAL_EXECUTIONS=true
```
This setting can also be overwritten on a per workflow basis in the workflow
settings in the Editor UI.
### EXECUTIONS_DATA_SAVE_ON_ERROR / EXECUTIONS_DATA_SAVE_ON_SUCCESS
When a workflow gets executed it will save the result in the database. That is
the case for executions that did succeed and for the ones that failed. That
default behavior can be changed like this:
```
EXECUTIONS_DATA_SAVE_ON_ERROR=none
EXECUTIONS_DATA_SAVE_ON_SUCCESS=none
```
Possible values are:
- **all**: Saves all data
- **none**: Do not save anything (recommended if a workflow runs a very often and/or processes a lot of data, setup "Error Workflow" instead)
These settings can also be overwritten on a per workflow basis in the workflow
settings in the Editor UI.
### GENERIC_TIMEZONE
The timezone is set by default to "America/New_York". It gets for example used by the
Cron-Node to know at what time the workflow should be started at. To set a different
default timezone simply set `GENERIC_TIMEZONE` to the appropriate value like for example
for Berlin (Germany):
```
GENERIC_TIMEZONE="Europe/Berlin"
```
You can find the name of your timezone here:
[https://momentjs.com/timezone/](https://momentjs.com/timezone/)
### NODES_EXCLUDE
It is possible to not allow users to use nodes of a specific node type. If you, for example,
do not want that people can write data to disk with the "n8n-nodes-base.writeBinaryFile"
node and can not execute commands with the "n8n-nodes-base.executeCommand" node you can
set the following:
```
NODES_EXCLUDE="[\"n8n-nodes-base.executeCommand\",\"n8n-nodes-base.writeBinaryFile\"]"
```
Additional information can be found on the [ documentation page](https://docs.n8n.io/#/create-node).
## Hosted n8n
@ -358,5 +95,4 @@ Before you upgrade to the latest version make sure to check here if there are an
## Development
When developing n8n can be started with `npm run start:dev`.
It will then automatically restart n8n every time a file changes.
Have you found a bug :bug: ? Or maybe you have a nice feature :sparkles: to contribute ? The [CONTRIBUTING guide](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md) will help you get your development environment ready in minutes.