merge main and fix conflicts

This commit is contained in:
Deborah Barnard 2022-10-24 12:47:37 +01:00
commit c1e7599712
264 changed files with 3617 additions and 2007 deletions

View File

@ -2,7 +2,7 @@
# n8n Docs
This repository hosts the documentation for [n8n](https://n8n.io/), an extendable workflow automation tool which enables you to connect anything to everything via its open, [fair-code](https://faircode.io/) model. The documentation is live at [docs.n8n.io](https://docs.n8n.io/).
This repository hosts the documentation for [n8n](https://n8n.io/), an extendable workflow automation tool which enables you to connect anything to everything. The documentation is live at [docs.n8n.io](https://docs.n8n.io/).
## Previewing and building the documentation locally

View File

@ -1,7 +0,0 @@
n8n provides the following methods:
- `$evaluateExpression`: evaluates a string as an expression.
- `$items`: returns items from a given node
- `$item`: returns an item at a given index
- `$jmespath()`: perform a search on a JSON object using JMESPath.
- `$node`: data from a specified node

View File

@ -1,13 +0,0 @@
n8n provides the following variables:
- `$binary`: incoming binary data from a node
- `$data`: incoming raw data from a node
- `$env`: contains environment variables
- `$json`: incoming JSON data from a node
- `$now`: a Luxon object containing the current timestamp. Equivalent to `DateTime.now()`.
- `$parameters`: parameters of the current node
- `$position`: the index of an item in a list of items
- `$resumeWebhookUrl`: the webhook URL to call to resume a waiting workflow.
- `$runIndex`: how many times the node has been executed. Zero-based (the first run is 0, the second is 1, and so on).
- `$today`: a Luxon object containing the current timestamp, rounded down to the day. Equivalent to `DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 })`.
- `$workflow`: workflow metadata

View File

@ -0,0 +1,95 @@
n8n's item linking allows you to access data from items that precede the current item. It also has implications when using the Function node. Most nodes link every output item to an input item. This creates a chain of items that you can work back along to access previous items. For a deeper conceptual overview of this topic, refer to [Item linking concepts](/data/data-mapping/data-item-linking/item-linking-concepts). This document focuses on practical usage examples.
When using the Function node, there are some scenarios where you need to manually supply item linking information if you want to be able to use `$("<node-name>").item` later in the workflow. These scenarios are when you:
* Add new items: the new items aren't linked to any input.
* Return completely new items.
* Want to manually control the item linking.
[n8n's automatic item linking](/data/data-mapping/data-item-linking/item-linking-concepts/) handles the other scenarios.
To control item linking, set `pairedItem` when returning data. For example, to link to the item at index 0:
```js
[
{
"json": {
. . .
},
"pairedItem": 0
}
]
```
### pairedItem usage example
Take this input data:
```json
[
{
"id": "23423532",
"name": "Jay Gatsby"
},
{
"id": "23423533",
"name": "José Arcadio Buendía"
},
{
"id": "23423534",
"name": "Max Sendak"
},
{
"id": "23423535",
"name": "Zaphod Beeblebrox"
},
{
"id": "23423536",
"name": "Edmund Pevensie"
}
]
```
And use it to generate new items, containing just the name, along with a new piece of data:
```js
newItems = [];
for(let i=0; i<items.length; i++){
newItems.push(
{
"json":
{
"name": items[i].json.name,
"aBrandNewField": "New data for item " + i
}
}
)
}
return newItems;
```
`newItems` is an array of items with no `pairedItem`. This means there's no way to trace back from these items to the items used to generate them.
Add the `pairedItem` object:
```js
newItems = [];
for(let i=0; i<items.length; i++){
newItems.push(
{
"json":
{
"name": items[i].json.name,
"aBrandNewField": "New data for item " + i
},
"pairedItem": i
}
},
)
}
return newItems;
```
Each new item now links to the item used to create it.

View File

@ -0,0 +1,33 @@
!!! note "Programmatic-style nodes only"
This guidance applies to programmatic-style nodes. If you're using declarative style, n8n handles paired items for you automatically.
n8n's item linking allows users to access data from items that precede the current item. n8n needs to know which input item a given output item comes from. If this information is missing, expressions in other nodes may break. As a node developer, you must ensure any items returned by your node support this.
This applies to programmatic nodes (including trigger nodes). You don't need to consider item linking when building a declarative-style node. Refer to [Choose your node building approach](/integrations/creating-nodes/plan/choose-node-method/) for more information on node styles.
Start by reading [Item linking concepts](/data/data-mapping/data-item-linking/item-linking-concepts/), which provides a conceptual overview of item linking, and details of the scenarios where n8n can handle the linking automatically.
If you need to handle item linking manually, do this by setting `pairedItem` on each item your node returns:
```typescript
// Use the pairedItem information of the incoming item
newItem = {
"json": { . . . },
"pairedItem": {
"item": item.pairedItem,
// Optional: choose the input to use
// Set this if your node combines multiple inputs
"input": 0
};
// Or set the index manually
newItem = {
"json": { . . . }
"pairedItem": {
"item": i,
// Optional: choose the input to use
// Set this if your node combines multiple inputs
"input": 0
},
};
```

View File

@ -0,0 +1,6 @@
If both items at an index have a field with the same name, this is a clash. For example, if all items in both Input 1 and Input 2 have a field named `language`, these fields clash. By default, n8n prioritizes Input 2, meaning if `language` has a value in Input 2, n8n uses that value when merging the items.
You can change this behavior:
1. Select **Add Option** > **Clash Handling**.
2. Choose which input to prioritize, or choose **Always Add Input Number to Field Names** to keep all fields and values, with the input number appended to the field name to show which input it came from.

View File

@ -1,7 +1,7 @@
### Branch execution with If and Merge nodes
If you add a Merge node to a workflow containing an If node, it can result in both output branches of the If node executing.
The Merge node is triggered by one branch, then goes and executes the other branch.
For example, in the screenshot below there's a workflow containing a Set node, If node, and Merge node. The standard If node behavior is to execute one branch (in the screenshot, this is the **true** output). However, due to the Merge node, both branches execute, despite the If node not sending any data down the **false** branch.
![Screenshot of a simple workflow. The workflow has a Set node, followed by an If node. It ends with a Merge node.](/_images/integrations/builtin/core-nodes/merge/if-merge-node.png)
![Screenshot of a simple workflow. The workflow has a Set node, followed by an If node. It ends with a Merge node.](/_images/integrations/builtin/core-nodes/merge/if-merge-node.png)

View File

@ -0,0 +1,4 @@
1. Access your [Google Cloud Console - Library](https://console.cloud.google.com/apis/library){:target=_blank .external-link}. Make sure you're in the correct project.
1. Search for and select the API(s) you want to enable. For example, for the Gmail node, search for and enable the Gmail API.
<!-- todo: docs / sheets /slides will also need drive when nodes updated -->
1. Select **ENABLE**.

33
archive/item.md Normal file
View File

@ -0,0 +1,33 @@
# `$item(index: number, runIndex?: number)`
With `$item` you can access the data of parent nodes. That can be the item data but also
the parameters. It expects as input an index of the item the data should be returned for. This is
needed because for each item the data returned can be different. This is probably straightforward for the
item data itself but maybe less for data like parameters. The reason why it is also needed, is
that they may contain an expression. Expressions get always executed of the context for an item.
If that would not be the case, for example, the Email Send node not would be able to send multiple
emails at once to different people. Instead, the same person would receive multiple emails.
The index is 0 based. So `$item(0)` will return the first item, `$item(1)` the second one, and so on.
By default the item of the last run of the node will be returned. So if the referenced node ran
3x (its last runIndex is 2) and the current node runs the first time (its runIndex is 0) the
data of runIndex 2 of the referenced node will be returned.
For more information about what data can be accessed via `$node`, check out the `Variable: $node` [section](/code-examples/methods-variables/node/).
Example:
```typescript
// Returns the value of the JSON data property "myNumber" of Node "Set" (first item)
const myNumber = $item(0).$node["Set"].json["myNumber"];
// Like above but data of the 6th item
const myNumber = $item(5).$node["Set"].json["myNumber"];
// Returns the value of the parameter "channel" of Node "Slack".
// If it contains an expression the value will be resolved with the
// data of the first item.
const channel = $item(0).$node["Slack"].parameter["channel"];
// Like above but resolved with the value of the 10th item.
const channel = $item(9).$node["Slack"].parameter["channel"];
```

View File

@ -0,0 +1,60 @@
# Function
!!! warning "Deprecated in 0.198.0"
n8n deprecated this node in version 0.198.0. Older workflows continue to work, and the node is still available in older versions n8n. From 0.198.0, n8n replaces the Function node with the [Code](/integrations/builtin/core-nodes/n8n-nodes-base.code/) node.
Using the function node, you can:
* Transform data from other nodes
* Implement custom functionality
!!! note "Function node and function item node"
Note that the Function node is different from the [Function Item](/integrations/builtin/core-nodes/n8n-nodes-base.functionItem/) node. Refer to [Data | Code](/data/code/) to learn about the difference between the two.
The Function node supports:
* Promises. Instead of returning the items directly, you can return a promise which resolves accordingly.
* Writing to your browser console using `console.log`. This is useful for debugging and troubleshooting your workflows.
When working with the Function node, you need to understand the following concepts:
* [Data structure](/data/data-structure/): understand the data you receive in the Function node, and requirements for outputting data from the node.
* [Item linking](/data/data-mapping/data-item-linking/): learn how data items work. You need to handle item linking when the number of input and output items doesn't match.
n8n provides built-in methods and variables. These provide support for:
* Accessing specific item data
* Accessing data about workflows, executions, and your n8n environment
* Convenience variables to help with data and time
Refer to [methods and variables](/code-examples/methods-variables-reference/) for more information.
## Output items
When using the Function node, you must return data in the format described in [data structure](/data/data-structure/).
This example creates 10 items with the IDs 0 to 9:
```typescript
const newItems = [];
for (let i=0;i<10;i++) {
newItems.push({
json: {
id: i
}
});
}
return newItems;
```
## Manage item linking
--8<-- "_snippets/data/data-mapping/item-linking-code-node.md"
## External libraries
If you self-host n8n, you can import and use built-in and external npm modules in the Function node. To learn how to enable external modules, refer the [Configuration](/hosting/configuration/#use-built-in-and-external-modules-in-function-nodes) guide.

View File

@ -1,5 +1,8 @@
# Function Item
!!! warning "Deprecated in 0.198.0"
n8n deprecated this node in version 0.198.0. Older workflows continue to work, and the node is still available in older versions n8n. From 0.198.0, n8n replaces the Function node with the [Code](/integrations/builtin/core-nodes/n8n-nodes-base.code/) node.
The Function Item node is used to add custom snippets to JavaScript code that should be executed once for every item that it receives as the input.
!!! note "Keep in mind"

View File

@ -0,0 +1,6 @@
# Venafi TLS Protect Datacenter Trigger
[Venafi](https://www.venafi.com/){:target=_blank .external-link} is a cybersecurity company providing services for machine identity management. They offer solutions to manage and protect identities for a wide range of machine types, delivering global visibility, lifecycle automation, and actionable intelligence.
!!! note "Credentials"
You can find authentication information for this node [here](/integrations/builtin/credentials/venafiTlsProtectDatacenter/).

Binary file not shown.

View File

@ -27,9 +27,30 @@
/* https://squidfunk.github.io/mkdocs-material/setup/changing-the-fonts/?h=font#additional-fonts */
--md-text-font: "Moderat-Regular-Web";
/* https://squidfunk.github.io/mkdocs-material/reference/admonitions/#custom-admonitions */
--md-admonition-icon--details: url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.516 6.516 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5Z"/></svg>');
}
/* https://squidfunk.github.io/mkdocs-material/reference/admonitions/#custom-admonitions */
.md-typeset .admonition.details,
.md-typeset details.details {
border-color: var(--color-background-dark);
}
.md-typeset .details > .admonition-title,
.md-typeset .details > summary {
background-color: rgba(16,19,48, 0.1);
}
.md-typeset .details > .admonition-title::before,
.md-typeset .details> summary::before {
background-color: rgb(16,19,48);
-webkit-mask-image: var(--md-admonition-icon--details);
mask-image: var(--md-admonition-icon--details);
}
/* light mode */
@ -131,12 +152,25 @@
white-space: pre;
}
/* border on TOC */
/* [data-md-color-scheme="light"] .md-nav--secondary {
border-left: 1px solid var(--color-primary);
} */
/* bigger font in table */
.table-without-whitespace-pre td:first-of-type {
white-space: unset;
}
.md-typeset table:not([class]) {
font-size: 0.75rem
}
/* img borders */
.md-typeset img, .md-typeset svg, .md-typeset video {
border: 1px solid #DBDFE7;
border-radius: 4px;
}
.md-typeset :is(.emojione,.twemoji,.gemoji) svg {
border: none;
}
/* dark mode */
/* [data-md-color-scheme="dark"] .md-header{
@ -181,6 +215,12 @@
border-left: 1px solid var(--color-primary);
} */
code {
tab-size: 2;
}
/* n8n classes */
.inline-image {
display:inline-block;
max-width: 25px;
@ -188,8 +228,8 @@
vertical-align: middle;
}
code {
tab-size: 2;
.inline-image > img {
border: none;
}
@ -197,3 +237,5 @@ code {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 286 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 159 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 152 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 104 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 114 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 156 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.7 KiB

View File

@ -1,3 +1,27 @@
# 2022 UI changes
/integrations/builtin/core-nodes/n8n-nodes-base.imapemail/ /integrations/builtin/core-nodes/n8n-nodes-base.emailimap/
# code schedule start nodes
/data/data-mapping/data-item-linking/item-linking-function-node/ /data/data-mapping/data-item-linking/item-linking-code-node/
/integrations/builtin/core-nodes/n8n-nodes-base.function/ /integrations/builtin/core-nodes/n8n-nodes-base.code/
/integrations/builtin/core-nodes/n8n-nodes-base.functionItem/ /integrations/builtin/core-nodes/n8n-nodes-base.code/
/integrations/builtin/core-nodes/n8n-nodes-base.functionitem/ /integrations/builtin/core-nodes/n8n-nodes-base.code/
/integrations/builtin/core-nodes/n8n-nodes-base.cron/ /integrations/builtin/core-nodes/n8n-nodes-base.scheduletrigger/
# methods / vars / paired items
/code-examples/expressions/methods/ /code-examples/methods-variables-reference/
/code-examples/expressions/variables/ /code-examples/methods-variables-reference/
/code-examples/javascript-functions/methods/ /code-examples/methods-variables-reference/
/code-examples/javascript-functions/variables/ /code-examples/methods-variables-reference/
/data/data-mapping/ /data/data-mapping/data-mapping-ui/
# Editor UI
/editor-ui/ /
# Integrations menu refactor
/integrations/nodes/* /integrations/builtin/app-nodes/:splat
@ -91,6 +115,7 @@
/nodes/n8n-nodes-base.activecampaigntrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.activeCampaignTrigger/
/nodes/n8n-nodes-base.acuitySchedulingTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.acuitySchedulingTrigger/
/nodes/n8n-nodes-base.acuityschedulingtrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.acuitySchedulingTrigger/
/nodes/n8n-nodes-base.adalo/ /integrations/builtin/app-nodes.n8n-nodes-base.adalo/
/nodes/n8n-nodes-base.affinity/ /integrations/builtin/app-nodes/n8n-nodes-base.affinity/
/nodes/n8n-nodes-base.affinityTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.affinityTrigger/
/nodes/n8n-nodes-base.affinitytrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.affinityTrigger/
@ -148,6 +173,8 @@
/nodes/n8n-nodes-base.Brandfetch/ /integrations/builtin/app-nodes/n8n-nodes-base.Brandfetch/
/nodes/n8n-nodes-base.brandfetch/ /integrations/builtin/app-nodes/n8n-nodes-base.Brandfetch/
/nodes/n8n-nodes-base.bubble/ /integrations/builtin/app-nodes/n8n-nodes-base.bubble/
/nodes/n8n-nodes-base/calTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.calTrigger/
/nodes/n8n-nodes-base/caltrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.caltrigger/
/nodes/n8n-nodes-base.calendlyTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.calendlyTrigger/
/nodes/n8n-nodes-base.calendlytrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.calendlyTrigger/
/nodes/n8n-nodes-base.chargebee/ /integrations/builtin/app-nodes/n8n-nodes-base.chargebee/
@ -205,8 +232,8 @@
/nodes/n8n-nodes-base.elasticsearch/ /integrations/builtin/app-nodes/n8n-nodes-base.elasticsearch/
/nodes/n8n-nodes-base.elasticSecurity/ /integrations/builtin/app-nodes/n8n-nodes-base.elasticSecurity/
/nodes/n8n-nodes-base.elasticsecurity/ /integrations/builtin/app-nodes/n8n-nodes-base.elasticSecurity/
/nodes/n8n-nodes-base.emailReadImap/ /integrations/builtin/core-nodes/n8n-nodes-base.imapEmail/
/nodes/n8n-nodes-base.emailreadimap/ /integrations/builtin/core-nodes/n8n-nodes-base.imapEmail/
/nodes/n8n-nodes-base.emailReadImap/ /integrations/builtin/core-nodes/n8n-nodes-base.emailimap/
/nodes/n8n-nodes-base.emailreadimap/ /integrations/builtin/core-nodes/n8n-nodes-base.emailimap/
/nodes/n8n-nodes-base.emailSend/ /integrations/builtin/core-nodes/n8n-nodes-base.sendEmail/
/nodes/n8n-nodes-base.emailsend/ /integrations/builtin/core-nodes/n8n-nodes-base.sendEmail/
/nodes/n8n-nodes-base.emelia/ /integrations/builtin/app-nodes/n8n-nodes-base.emelia/
@ -240,9 +267,9 @@
/nodes/n8n-nodes-base.freshworksCrm/ /integrations/builtin/app-nodes/n8n-nodes-base.freshworksCrm/
/nodes/n8n-nodes-base.freshworkscrm/ /integrations/builtin/app-nodes/n8n-nodes-base.freshworksCrm/
/nodes/n8n-nodes-base.ftp/ /integrations/builtin/core-nodes/n8n-nodes-base.ftp/
/nodes/n8n-nodes-base.function/ /integrations/builtin/core-nodes/n8n-nodes-base.function/
/nodes/n8n-nodes-base.functionItem/ /integrations/builtin/core-nodes/n8n-nodes-base.functionItem/
/nodes/n8n-nodes-base.functionitem/ /integrations/builtin/core-nodes/n8n-nodes-base.functionItem/
/nodes/n8n-nodes-base.function/ /integrations/builtin/core-nodes/n8n-nodes-base.code/
/nodes/n8n-nodes-base.functionItem/ /integrations/builtin/core-nodes/n8n-nodes-base.code/
/nodes/n8n-nodes-base.functionitem/ /integrations/builtin/core-nodes/n8n-nodes-base.code/
/nodes/n8n-nodes-base.getResponse/ /integrations/builtin/app-nodes/n8n-nodes-base.getResponse/
/nodes/n8n-nodes-base.getresponse/ /integrations/builtin/app-nodes/n8n-nodes-base.getResponse/
/nodes/n8n-nodes-base.getResponseTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.getResponseTrigger/
@ -256,6 +283,7 @@
/nodes/n8n-nodes-base.gitlabTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.gitlabTrigger/
/nodes/n8n-nodes-base.gitlabtrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.gitlabTrigger/
/nodes/n8n-nodes-base.gmail/ /integrations/builtin/app-nodes/n8n-nodes-base.gmail/
/nodes/n8n-nodes-base.gmailTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.gmailtrigger/
/nodes/n8n-nodes-base.googleAds/ /integrations/builtin/app-nodes/n8n-nodes-base.googleAds/
/nodes/n8n-nodes-base.googleads/ /integrations/builtin/app-nodes/n8n-nodes-base.googleAds/
/nodes/n8n-nodes-base.googleAnalytics/ /integrations/builtin/app-nodes/n8n-nodes-base.googleAnalytics/
@ -268,6 +296,7 @@
/nodes/n8n-nodes-base.googlecalendar/ /integrations/builtin/app-nodes/n8n-nodes-base.googleCalendar/
/nodes/n8n-nodes-base.googleCalendarTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.googleCalendarTrigger/
/nodes/n8n-nodes-base.googlecalendartrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.googleCalendarTrigger/
/nodes/n8n-nodes-base.googleCloudStorage/ /integrations/builtin/app-nodes/n8n-nodes-base.googlecloudstorage/
/nodes/n8n-nodes-base.googleChat/ /integrations/builtin/app-nodes/n8n-nodes-base.googleChat/
/nodes/n8n-nodes-base.googlechat/ /integrations/builtin/app-nodes/n8n-nodes-base.googleChat/
/nodes/n8n-nodes-base.googleCloudNaturalLanguage/ /integrations/builtin/app-nodes/n8n-nodes-base.googleCloudNaturalLanguage/
@ -393,6 +422,7 @@
/nodes/n8n-nodes-base.merge/ /integrations/builtin/core-nodes/n8n-nodes-base.merge/
/nodes/n8n-nodes-base.messageBird/ /integrations/builtin/app-nodes/n8n-nodes-base.messageBird/
/nodes/n8n-nodes-base.messagebird/ /integrations/builtin/app-nodes/n8n-nodes-base.messageBird/
/nodes/n8n-nodes-base.metabase/ /integrations/builtin/app-nodes/n8n-nodes-base.metabase/
/nodes/n8n-nodes-base.microsoftDynamicsCrm/ /integrations/builtin/app-nodes/n8n-nodes-base.microsoftDynamicsCrm/
/nodes/n8n-nodes-base.microsoftdynamicscrm/ /integrations/builtin/app-nodes/n8n-nodes-base.microsoftDynamicsCrm/
/nodes/n8n-nodes-base.microsoftExcel/ /integrations/builtin/app-nodes/n8n-nodes-base.microsoftExcel/
@ -472,6 +502,7 @@
/nodes/n8n-nodes-base.pipedriveTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.pipedriveTrigger/
/nodes/n8n-nodes-base.pipedrivetrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.pipedriveTrigger/
/nodes/n8n-nodes-base.plivo/ /integrations/builtin/app-nodes/n8n-nodes-base.plivo/
/nodes/n8n-nodes-base.postbin/ /integrations/builtin/app-nodes/n8n-nodes-base.postbin/
/nodes/n8n-nodes-base.postgres/ /integrations/builtin/app-nodes/n8n-nodes-base.postgres/
/nodes/n8n-nodes-base.postHog/ /integrations/builtin/app-nodes/n8n-nodes-base.postHog/
/nodes/n8n-nodes-base.postmarkTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.postmarkTrigger/
@ -521,6 +552,10 @@
/nodes/n8n-nodes-base.segment/ /integrations/builtin/app-nodes/n8n-nodes-base.segment/
/nodes/n8n-nodes-base.sendGrid/ /integrations/builtin/app-nodes/n8n-nodes-base.sendGrid/
/nodes/n8n-nodes-base.sendgrid/ /integrations/builtin/app-nodes/n8n-nodes-base.sendGrid/
/nodes/n8n--nodes-base.sendInBlue/ /integrations/builtin/app-nodes/n8n-nodes-base.sendInBlue/
/nodes/n8n--nodes-base.sendinblue/ /integrations/builtin/app-nodes/n8n-nodes-base.sendinblue/
/nodes/n8n--nodes-base.sendInBlue/ /integrations/builtin/trigger-nodes/n8n-nodes-base.sendInBlueTrigger/
/nodes/n8n--nodes-base.sendinblue/ /integrations/builtin/trigger-nodes/n8n-nodes-base.sendinbluetrigger/
/nodes/n8n-nodes-base.sendy/ /integrations/builtin/app-nodes/n8n-nodes-base.sendy/
/nodes/n8n-nodes-base.sentryIo/ /integrations/builtin/app-nodes/n8n-nodes-base.sentryIo/
/nodes/n8n-nodes-base.sentryio/ /integrations/builtin/app-nodes/n8n-nodes-base.sentryIo/
@ -610,7 +645,7 @@
/nodes/n8n-nodes-base.wisetrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.wiseTrigger/
/nodes/n8n-nodes-base.wooCommerce/ /integrations/builtin/app-nodes/n8n-nodes-base.wooCommerce/
/nodes/n8n-nodes-base.woocommerce/ /integrations/builtin/app-nodes/n8n-nodes-base.wooCommerce/
/trigger-nodes/n8n-nodes-base.wooCommerceTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.wooCommerceTrigger/
/nodes/n8n-nodes-base.wooCommerceTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.wooCommerceTrigger/
/nodes/n8n-nodes-base.woocommercetrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.wooCommerceTrigger/
/nodes/n8n-nodes-base.wordpress/ /integrations/builtin/app-nodes/n8n-nodes-base.wordpress/
/nodes/n8n-nodes-base.workableTrigger/ /integrations/builtin/trigger-nodes/n8n-nodes-base.workableTrigger/

View File

@ -0,0 +1,14 @@
# Using console.log in the Code node
You can use `console.log()` in the Code node to help when writing and debugging your code.
For help opening your browser console, refer to [this guide by Balsamiq](https://balsamiq.com/support/faqs/browserconsole/){:target=_blank .external-link}.
For technical information on `console.log()`, refer to the [MDN developer docs](https://developer.mozilla.org/en-US/docs/Web/API/Console/log){:target=_blank .external-link}.
For example, copy the following code into a Code node, then open your console and run the node:
```js
let a = "apple";
console.log(a);
```

View File

@ -27,7 +27,7 @@ To use an expression to set a parameter value:
3. Write your expression in the expression editor. You can browse some of the available data in the **Variable selector**. All expressions have the format `{{ your expression here }}`.
### Example: get data from webhook body
### Example: Get data from webhook body
Consider the following scenario: you have a webhook trigger that receives data through the webhook body. You want to extract some of that data for use in the workflow.
@ -66,7 +66,7 @@ This expression:
2. Finds the value of `city` (in this example, "New York"). Note that this example uses JMESPath syntax to query the JSON data. You can also write this expression as `{{$json['body']['city']}}`.
### Example: writing longer JavaScript
### Example: Writing longer JavaScript
An expression contains one line of JavaScript. This means you can'd do things like variable assignments or multiple standalone operations.

View File

@ -1,8 +0,0 @@
# Custom methods
--8<-- "_snippets/code-examples/methods-list.md"

View File

@ -1,25 +0,0 @@
# Custom variables
--8<-- "_snippets/code-examples/variables-list.md"
## Examples
### $workflow
Gives information about the current workflow.
```js
// Boolean. Whether the workflow is active (true) or not (false)
$workflow.active
// Number. The workflow ID.
$workflow.id
// String. The workflow name.
$workflow.name
```
### $resumeWebhookUrl
The webhook URL to call to resume a [waiting](/integrations/builtin/core-nodes/n8n-nodes-base.wait/) workflow.
See the [Wait > On webhook call](/integrations/builtin/core-nodes/n8n-nodes-base.wait/#webhook-call) documentation to learn more.

View File

@ -1,18 +1,19 @@
# Overview
# Code in n8n
There are two places in n8n where you need to use code:
* In [expressions](/code-examples/expressions/), for example programmatically setting the value of a field based on incoming data.
* In the [function node](/integrations/builtin/core-nodes/n8n-nodes-base.function/), when you need to add JavaScript to your workflow.
* In the [Code node](/integrations/builtin/core-nodes/n8n-nodes-base.code/), when you need to add JavaScript to your workflow.
This section covers:
* Expressions:
* Built-in [methods and variables](/code-examples/methods-variables-reference/).
* Expressions examples:
* [Introduction to expressions in n8n](/code-examples/expressions/).
* Built in [methods](/code-examples/expressions/methods/) and [variables](/code-examples/expressions/variables/).
* Supported libraries: [Luxon](/code-examples/expressions/luxon/) (for data and time) and [JMESPath](/code-examples/expressions/jmespath/) (for working with JSON).
* JavaScript:
* JavaScript examples:
* [Introduction to JavaScript in n8n](/code-examples/javascript-functions/).
* Built in [methods](/code-examples/javascript-functions/methods/) and [variables](/code-examples/javascript-functions/variables/).
* Supported libraries: [Luxon](/code-examples/javascript-functions/luxon/) (for data and time) and [JMESPath](/code-examples/javascript-functions/jmespath/) (for working with JSON).
* [Checking incoming data](/code-examples/javascript-functions/check-incoming-data/).
* [Get the number of items returned by the last node](/code-examples/javascript-functions/number-items-last-node/).
* [Get the number of items returned by the last node](/code-examples/javascript-functions/number-items-last-node/).
* Working with binary data: [Get the binary data buffer](/code-examples/javascript-functions/get-binary-data-buffer/) and [Split binary file data into individual items](/code-examples/javascript-functions/split-binary-file-data/).

View File

@ -1,9 +1,9 @@
# JavaScript Code Snippets
# JavaScript examples
In n8n, you can write custom JavaScript code snippets to add, remove, and update the data you receive from a node. You can also use code snippets to modify the data structure of the data returned by a node.
!!! note "Keep in mind"
We are using Set node for illustrating expressions here. However, you can use the code snippets as an expression in any node. To do that, click on the gears icon next to a field and click on ***Add Expression***.
We are using Set node for illustrating expressions here. However, you can use the code snippets as an expression in any node. To do that, click on the gears icon next to a field and click on **Add Expression**.
For each section, we'll share code snippets that can be used in the function node as well as the expressions. You can read more about [Expressions](/code-examples/expressions/) and adding code snippets to the [Function](/integrations/builtin/core-nodes/n8n-nodes-base.function/) node in our documentation.

View File

@ -1,80 +0,0 @@
# Custom methods
--8<-- "_snippets/code-examples/methods-list.md"
### $evaluateExpression(expression: string, itemIndex: number)
Evaluates a given string as expression.
If no `itemIndex` is provided it uses by default in the Function-Node the data of item 0 and
in the Function Item-Node the data of the current item.
Example:
```javascript
items[0].json.variable1 = $evaluateExpression('{{1+2}}');
items[0].json.variable2 = $evaluateExpression($node["Set"].json["myExpression"], 1);
return items;
```
### $items(nodeName?: string, outputIndex?: number, runIndex?: number)
This gives access to all the items of current or parent nodes. If no parameters are supplied,
it returns all the items of the current node.
If a node-name is given, it returns the items the node output on its first output
(index: 0, most nodes only have one output, exceptions are IF and Switch-Node) on
its last run.
Example:
```typescript
// Returns all the items of the current node and current run
const allItems = $items();
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of its most recent run)
const allItems = $items("IF");
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
const allItems = $items("IF", 0, $runIndex);
// Returns all items the node "IF" outputs (index: 1 which is Output "false" of run 0 which is the first run)
const allItems = $items("IF", 1, 0);
```
### $item(index: number, runIndex?: number)
This method allows you to return an item at a specific index. The index is zero-based. Hence, `$item(0)` will return the first item, `$item(1)` the second one, and so on. Refer to [this](/integrations/builtin/core-nodes/n8n-nodes-base.function/) documentation to learn more.
Example:
```typescript
// Returns the first item returned by the Example node
const firstItem = $item(0).$node["Example Node"];
// Returns the second item returned by the Example node
const secondItem = $item(1).$node["Example Node"];
```
Refer to this [example workflow](https://n8n.io/workflows/1330) to learn how this method can be used.
### $node
Returns the data of a specified node. Similar to `$item`, with the difference that it always returns the data of the first output and the last run of the node.
```typescript
// Returns the fileName of binary property "data" of Node "HTTP Request"
const fileName = $node["HTTP Request"].binary["data"]["fileName"]}}
// Returns the context data "noItemsLeft" of Node "SplitInBatches"
const noItemsLeft = $node["SplitInBatches"].context["noItemsLeft"];
// Returns the value of the JSON data property "myNumber" of Node "Set"
const myNumber = $node["Set"].json['myNumber'];
// Returns the value of the parameter "channel" of Node "Slack"
const channel = $node["Slack"].parameter["channel"];
// Returns the index of the last run of Node "HTTP Request"
const runIndex = $node["HTTP Request"].runIndex}}
```

View File

@ -1,37 +0,0 @@
# Custom variables
--8<-- "_snippets/code-examples/variables-list.md"
## Examples
### $executionId
Contains the unique ID of the current workflow execution.
```typescript
const executionId = $executionId;
return [{json:{executionId}}];
```
### $runIndex
Contains the index of the current run of the node.
```typescript
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
const allItems = $items("IF", 0, $runIndex);
```
### $workflow
Gives information about the current workflow.
```js
// Boolean. Whether the workflow is active (true) or not (false)
$workflow.active
// Number. The workflow ID.
$workflow.id
// String. The workflow name.
$workflow.name
```

View File

@ -0,0 +1,30 @@
# `$("<node-name>").all(branchIndex?: number, runIndex?: number)`
This gives access to all the items of the current or parent nodes. If you don't supply any parameters, it returns all the items of the current node.
## Getting items
```typescript
// Returns all the items of the given node and current run
const allItems = $("<node-name>").all();
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of its most recent run)
const allItems = $("IF").all();
// Returns all items the node "IF" outputs (index: 0 which is Output "true" of the same run as current node)
const allItems = $("IF").all(0, $runIndex);
// Returns all items the node "IF" outputs (index: 1 which is Output "false" of run 0 which is the first run)
const allItems = $("IF").all(1, 0);
```
## Accessing item data
Get all items output by a previous node, and log out the data they contain:
```typescript
previousNodeData = $("<node-name>").all();
for(let i=0; i<previousNodeData.length; i++) {
console.log(previousNodeData[i].json);
}
```

View File

@ -0,0 +1,17 @@
# `$evaluateExpression(expression: string, itemIndex?: number)`
Evaluates a given string as expression.
If you don't provide `itemIndex`, n8n uses:
* The data from item 0 in the Function node.
* The data from the current item in the Function Item node.
Example:
```javascript
items[0].json.variable1 = $evaluateExpression('{{1+2}}');
items[0].json.variable2 = $evaluateExpression($node["Set"].json["myExpression"], 1);
return items;
```

View File

@ -0,0 +1,17 @@
# `$execution`
## `$execution.id`
Contains the unique ID of the current workflow execution.
```typescript
const executionId = $execution.id;
return [{json:{executionId}}];
```
## `$execution.resumeUrl`
The webhook URL to call to resume a [waiting](/integrations/builtin/core-nodes/n8n-nodes-base.wait/) workflow.
See the [Wait > On webhook call](/integrations/builtin/core-nodes/n8n-nodes-base.wait/#webhook-call) documentation to learn more.

View File

@ -0,0 +1,36 @@
# `$getWorkflowStaticData(type)`
This gives access to the static workflow data.
!!! note "Experimental feature"
Static data isn't available when testing workflows. The workflow must be active and called by a trigger or webhook to save static data.
You can save data directly in the workflow. This data should be small.
As an example: you can save a timestamp of the last item processed from
an RSS feed or database. It will always return an object. Properties can then read, delete or
set on that object. When the workflow execution succeeds, n8n checks automatically if the data
has changed and saves it, if necessary.
There are two types of static data, "global" and "node". Global static data is the
same in the whole workflow. Every node in the workflow can access it. The node static data is unique to the node. Only the node that set it can retrieve it again.
Example:
```javascript
// Get the global workflow static data
const staticData = getWorkflowStaticData('global');
// Get the static data of the node
const staticData = getWorkflowStaticData('node');
// Access its data
const lastExecution = staticData.lastExecution;
// Update its data
staticData.lastExecution = new Date().getTime();
// Delete data
delete staticData.lastExecution;
```

View File

@ -0,0 +1,3 @@
# Overview
n8n provides built-in methods and variables for working with data and accessing n8n data. This section provides usage examples.

View File

@ -0,0 +1,18 @@
# `$("<node-name>").item`
!!! info "Not avaialble in Function node"
`$("<node-name>").item` isn't available in the Function node.
Returns the data of a specified node.
```typescript
// Returns the fileName of binary property "data" of Node "HTTP Request"
const fileName = $("HTTP Request").item.binary["data"]["fileName"]}}
// Returns the value of the JSON data property "myNumber" of Node "Set"
const myNumber = $("Set").item.json['myNumber'];
// Returns the value of the parameter "channel" of Node "Slack"
const channel = $("Slack").item.parameter["channel"];
```

View File

@ -0,0 +1,8 @@
# `$runIndex`
Contains the index of the current run of the node.
```typescript
// Returns all items the node "IF" outputs (index: -1)
const allItems = $("<node-name").all("IF", 0, $runIndex-1);
```

View File

@ -0,0 +1,12 @@
# `$workflow`
Gives information about the current workflow.
```js
// Boolean. Whether the workflow is active (true) or not (false)
$workflow.active
// Number. The workflow ID.
$workflow.id
// String. The workflow name.
$workflow.name
```

View File

@ -0,0 +1,81 @@
# Built-in methods and variables
n8n provides built-in methods and variables for working with data and accessing n8n data. This document provides a reference list of available methods and variables, with a short description. Note that some methods and variables aren't available in the Function node.
## Current node input
| Method | Description | Available in Function node? |
| ------ | ----------- | :-------------------------: |
| `$binary` | Shorthand for `$input.item.binary`. Incoming binary data from a node | :x: |
| `$input.item` | The input item of the current node that's being processed. Refer to [Item linking](/data/data-mapping/data-item-linking/) for more information on paired items and item linking. | :x: |
| `$input.all()` | All input items in current node. | :white_check_mark: |
| `$input.first()` | First input item in current node. | :white_check_mark: |
| `$input.last()` | Last input item in current node. | :white_check_mark: |
| `$input.params` | Object containing the query settings of the previous node. This includes data such as the operation it ran, result limits, and so on. | :white_check_mark: |
| `$json` | Shorthand for `$input.item.json`. Incoming JSON data from a node. Refer to [Data structure](/data/data-structure/) for information on item structure. | :x: |
| `$input.context.noItemsLeft` | Boolean. Only available when working with the Split in Batches node. Provides information about what's happening in the node, allowing you to see if the node is still processing items. | :white_check_mark: |
## Output of other nodes
| Method | Description | Available in Function node? |
| ------ | ----------- | :-------------------------: |
| `$("<node-name>").all(branchIndex?, runIndex?)` | Returns all items from a given node. | :white_check_mark: |
| `$("<node-name>").first(branchIndex?, runIndex?)` | The first item output by the given node | :white_check_mark: |
| `$("<node-name>").last(branchIndex?, run Index?)` | The last item output by the given node. | :white_check_mark: |
| `$("<node-name>").item` | The linked item. This is the item in the specified node used to produce the current item. Refer to [Item linking](/data/data-mapping/data-item-linking/) for more information on item linking. | :x: |
| `$("<node-name>").params` | Object containing the query settings of the given node. This includes data such as the operation it ran, result limits, and so on. | :white_check_mark: |
| `$("<node-name>").context` | Only available when working with the Split in Batches node. Provides information about what's happening in the node, allowing you to see if the node is still processing items. | :white_check_mark: |
| `$("<node-name>").itemMatching(currentNodeinputIndex)` | Use instead of `$("<node-name>").item` in the Function node if you need to trace back from an input item. | :white_check_mark: |
<!-- possibly not live yet?
| `$("<node-name>").itemAt(itemIndex, branchIndex?, runIndex?)` | [TODO: is this in? not working in expr] Returns an item at a given index. Replaces `$item()`. | :white_check_mark: | :white_check_mark: | :white_check_mark: |
-->
## Date and time
| Method | Description | Available in Function node? |
| ------ | ----------- | :-------------------------: |
| `$now` | A Luxon object containing the current timestamp. Equivalent to `DateTime.now()`. | :white_check_mark: |
| `$today` | A Luxon object containing the current timestamp, rounded down to the day. Equivalent to `DateTime.now().set({ hour: 0, minute: 0, second: 0, millisecond: 0 })`. | :white_check_mark: |
## n8n metadata
This includes:
* Access to n8n environment variables for self-hosted n8n.
* Metadata about workflows, executions, and nodes.
| Method | Description | Available in Function node? |
| ------ | ----------- | :-------------------------: |
| `$env` | Contains [environment variables](/hosting/environment-variables/). | :white_check_mark: |
| `$execution.id` | The unique ID of the current workflow execution. | :white_check_mark: |
| `$execution.mode` | Whether the execution was triggered automatically, or by manually running the workflow. Possible values are `test` and `production`. | :white_check_mark: |
| `$execution.resumeUrl` | The webhook URL to call to resume a workflow waiting at a [Wait node](/integrations/builtin/core-nodes/n8n-nodes-base.wait/). | :white_check_mark: |
| `$getWorkflowStaticData(type)` | View an [example](/code-examples/methods-variables-examples/get-workflow-static-data/). Static data isn't available when testing workflows. The workflow must be active and called by a trigger or webhook to save static data. This gives access to the static workflow data. | :white_check_mark: |
| `$itemIndex` | The index of an item in a list of items. | :x: |
| `$prevNode.name` | The name of the node that the current input came from. When using the Merge node, note that `$prevNode` always uses the first input connector. | :white_check_mark: |
| `$prevNode.outputIndex` | The index of the output connector that the current input came from. Use this when the previous node had multiple outputs (such as an If or Switch node). When using the Merge node, note that `$prevNode` always uses the first input connector. | :white_check_mark: |
| `$prevNode.runIndex` | The run of the previous node that generated the current input. When using the Merge node, note that `$prevNode` always uses the first input connector. | :white_check_mark: |
| `$runIndex` | How many times n8n has executed the current node. Zero-based (the first run is 0, the second is 1, and so on). | :white_check_mark: |
| `$workflow.active` | Whether the workflow is active (true) or not (false). | :white_check_mark: |
| `$workflow.id` | The workflow ID. | :white_check_mark: |
| `$workflow.name` | The workflow name. | :white_check_mark: |
## Advanced
| Method | Description | Available in Function node? |
| ------ | ----------- | :-------------------------: |
| `$evaluateExpression` | Evaluates a string as an expression | :white_check_mark: |
| `$jmespath()` | Perform a search on a JSON object using JMESPath. | :white_check_mark: |

View File

@ -1,25 +1,8 @@
# How can I contribute?
# How can you contribute?
There are a several ways in which you can contribute to n8n, depending on your skills and interests. Each form of contribution is valuable to us!
## Contributor quick start
Here is a quick list of the contributions we are looking for:
- Build community nodes
- Write an n8n tutorial
- Host an n8n event (virtual or locally)
- Write for our docs
- Create workflow templates
- Write a review
- Participate on our support forum
To start contributing or to get ideas of what to do, check out our [Contributor board on GitHub](https://github.com/orgs/n8n-io/projects/3){:target=_blank class=.external-link}. If there is a project you want on the board, please assign it to yourself and start contributing!
Keep reading for more ideas on contributions.
## Share some love
## Share some love: review us
- Star n8n on [GitHub](https://github.com/n8n-io/n8n){:target=_blank class=.external-link} and [Docker Hub](https://hub.docker.com/r/n8nio/n8n){:target=_blank class=.external-link}.
- Follow us on [Twitter](https://twitter.com/n8n_io){:target=_blank class=.external-link}, [LinkedIn](https://www.linkedin.com/company/28491094), and [Facebook](https://www.facebook.com/n8nio/){:target=_blank class=.external-link}.
@ -51,14 +34,12 @@ To share a workflow, follow these steps:
1. Sign in to [n8n.io](https://n8n.io/login){:target=_blank class=.external-link}.
2. Open the [workflows](https://n8n.io/workflows){:target=_blank class=.external-link} page.
3. Click on the **+ Share New Workflow** button.
4. Enter the name of your workflow in the **Name** field.
The name should be short and descriptive, so that other users can understand the purpose of the workflow at a glance.
5. Enter a detailed description of the workflow in the **Description** field.
In the description you should add a screenshot of the workflow and briefly explain what the nodes used in the workflow do.
3. Select **+ Share New Workflow**.
4. Enter the name of your workflow in the **Name** field. The name should be short and descriptive, so that other users can understand the purpose of the workflow at a glance.
5. Enter a detailed description of the workflow in the **Description** field. Add a screenshot of the workflow and briefly explain what the nodes used in the workflow do.
6. In your n8n instance, select all the nodes in your workflow (Ctrl + A or Cmd + A) and copy them (Ctrl + C or Cmd + C).
7. Back on the workflows page, delete the existing code in the **Workflow Code** field and paste your workflow in it (Ctrl + V or Cmd + V).
8. Click on the **Publish Workflow to Share** button to share your workflow.
8. Select **Publish Workflow to Share** to share your workflow.
See the above steps in action in this video:
@ -70,13 +51,16 @@ See the above steps in action in this video:
-->
## Build a node
Create an integration for a third party service. Check out [the node creation docs](/integrations/creating-nodes/) for guidance on how to create and publish a community node.
## Contribute to the code
There are different ways in which you can contribute to the n8n code base:
- Fix [issues](https://github.com/n8n-io/n8n/issues){:target=_blank class=.external-link} reported on GitHub. The [CONTRIBUTING guide](https://github.com/n8n-io/n8n/blob/master/CONTRIBUTING.md){:target=_blank class=.external-link} will help you get your development environment ready in minutes.
- Add additional functionality to an existing third party integration.
- Create an integration for a third party service. Check out [the node creation docs](/integrations/creating-nodes/) for guidance on how to create a node.
- Add a new feature to n8n.
## Contribute to the docs

View File

@ -30,8 +30,10 @@ The panel contains the following sections:
- *Admin Panel*: Access the management Dashboard (for n8n Cloud users).
- *Workflows*: Contains operations for creating and editing workflows.
- *Templates*: Contains pre-built workflows that can be searched.
- *Credentials*: Contains operations for creating credentials.
- *Executions*: Contains information about your workflow executions.
- *Settings*: Contains editable configuration for the account and other things.
- *Help*: Contains resources around n8n product and community.
<figure style="text-align: center;"><img src="/_images/courses/level-one/chapter-one/Left-side-menu.png" alt="Editor UI left-side menu" style="height: 600px;"><figcaption align = "center"><i>Editor UI left-side menu</i></figcaption></figure>

View File

@ -27,10 +27,10 @@ The *Hacker News node* has several parameters that need to be configured in orde
- *Resource:* All <br/>
This resource selects all data records (articles).
- *Operation:* Get All <br/>
- *Operation:* Get Many <br/>
This operation fetches all the selected articles.
- *Limit:* 10 <br/>
This parameter sets a limit to how many results are returned by the Get All operation.
This parameter sets a limit to how many results are returned by the Get Many operation.
- *Additional fields > Add Field > Keyword:* automation <br/>
Additional fields are options that you can add to certain nodes to make your request more specific or filter the results. In our case, we want to get only articles that include the keyword “automation”. <br/>
@ -103,7 +103,7 @@ The node window displays more information about the node execution:
This field displays the number of items (records) that are returned by the node request. In our case, it's expected to be 10, since this is the limit we set in the node. But if you don't set a limit, it's useful to see how many records are actually returned.
- Next to the *Items* information, notice a small orange *i* icon. If you hover on it, you'll get two more pieces of information: ***Start Time*** (when the node execution started) and ***Execution Time*** (how long it took for the node to return the results from the moment it started executing).
*Start Time* and *Execution Time* can provide insights into the performance of each individual node.
- In the bottom right corner right under the node window, there is a reference link to the node's **documentation**. Check it out if you run into trouble or are not sure how to configure the node's parameters.
- Under the node name beside the **Parameters** tab, there is a link to the node's **Docs**. Check it out if you run into trouble or are not sure how to configure the node's parameters.
!!! warning "Error in nodes"

View File

@ -31,7 +31,7 @@ In the left panel, select:
- *Headers > Add Header:*
- *Name:* `unique_id`
- *Value:* The Unique ID your received in the email when you signed up for this course.
- *Authentication:* Header Auth<br/>
- *Authentication > Generic Credential Type > Generic Auth Type:* Header Auth<br/>
This option requires credentials to allow you to access the data.
!!! note "Credentials"

View File

@ -15,7 +15,7 @@ Back to your workflow, remove the connection between the *HTTP Request* node and
In the *IF* node window click on *Add Condition* > *string* and configure the parameters:
- *Value 1*: Current Node > Input Data > JSON > orderStatus → `{{$json["orderStatus"]}}` <br>
To select this value, click on the wheel icon “Add Expression” on the right side of the Value 1 field.
To select this value, click the **Expression** tab on the right side of the Value 1 field.
!!! note "Expressions"
An expression is a string of characters and symbols in a programming language that represents a value depending upon its input. In n8n workflows, you can use expressions in a node to refer to another node for input data. In our example, the IF node references the data output by the HTTP Request node.

View File

@ -29,15 +29,15 @@ In n8n, the data that is passed between nodes is an array of objects with the fo
// Any kind of JSON data is allowed. So arrays and the data being deeply nested is fine.
json: { // The actual data n8n operates on (required)
// This data is only an example it could be any kind of JSON data
jsonKeyName: 'keyValue',
anotherJsonKey: {
lowerLevelJsonKey: 1
apple: 'beets',
carrot: {
dill: 1
}
},
// Binary data of item. The most items in n8n do not contain any (optional)
binary: {
// The key-name "binaryKeyName" is only an example. Any kind of key-name is possible.
binaryKeyName: {
// The key-name "apple" is only an example. Any kind of key-name is possible.
apple-picture: {
data: '....', // Base64 encoded binary data (required)
mimeType: 'image/png', // Optional but should be set if possible (optional)
fileExtension: 'png', // Optional but should be set if possible (optional)

View File

@ -25,7 +25,7 @@ The *Workflow Executions* window displays a table with the following information
* _Running Time:_ The duration it took the workflow to execute
!!! note "Workflow execution status"
In the *Workflow Executions* window you can filter the displayed executions by workflow and by status (*All*, *Error*, *Running*, or *Success*).\
In the **Workflow Executions** window you can filter the displayed executions by workflow and by status (**All**, **Error**, **Running**, or **Success**).
The information displayed here depends on what workflows and executions you set up in *Workflow Settings* to be saved.

View File

@ -1,4 +1,4 @@
# Introduction
# Level one: Introduction
Welcome to the **n8n Course Level 1**!

View File

@ -62,12 +62,12 @@ Now that you are familiar with the n8n data structure, you can use it to create
```javascript
return [
{
json: {
key: 'value',
}
}
];
{
json: {
apple: 'beets',
}
}
];
```
For example, the array of objects representing the Ninja turtles would look like this in the Function node:
@ -131,7 +131,7 @@ In a Function node, create an array of objects named `myContacts` that contains
## Referencing node data with the Function node
Just like you can use [expressions](/code-examples/expressions/){:target="_blank" .external} to reference data from other nodes, you can also use some [methods](/code-examples/expressions/methods/){:target="_blank" .external} and [variables](/code-examples/expressions/variables/){:target="_blank" .external} in the Function node.
Just like you can use [expressions](/code-examples/expressions/) to reference data from other nodes, you can also use some [methods and variables](/code-examples/methods-variables-reference/) in the Function node.
### Exercise

View File

@ -1,4 +1,4 @@
# Introduction
# Level two: Introduction
Welcome to the **n8n Course Level 2**!

View File

@ -0,0 +1,10 @@
# Create and edit credentials
You can get to the credential modal by either:
* Opening the left menu, then selecting **Credentials** > **New** and browsing for the service you want to connect to.
* Selecting **Create New** in the **Credential** dropdown in a node.
Once in the credential modal, enter the details required by your service. Refer to your service's page in the [credentials library](/integrations/builtin/credentials/) for guidance.
When you save a credential, n8n tests it to confirm it works.

View File

@ -0,0 +1,27 @@
# Credential sharing
!!! info "Feature availability"
* Limited Cloud plans. Refer to [Cloud Pricing](https://n8n.io/pricing/){:target=_blank .external-link} for more information.
* Not available outside Cloud.
Credential sharing allows you to share a credential you created with other users in the same n8n workspace as you. The other users can then use the credential in their workflows. They can't access or edit the credential details.
To use credential sharing, you must enable [user management](/hosting/user-management/).
## Share a credential
1. Open the left menu and select **Credentials**. n8n shows a list of your credentials.
2. Select the credential you want to share. n8n opens the credential modal.
3. Select **Sharing**.
4. In **Add people**, browse or search for the user you want to share the credential with.
5. Select a user.
## Remove access to a credential
To unshare a credential:
1. Open the left menu and select **Credentials**. n8n shows a list of your credentials.
2. Select the credential you want to share. n8n opens the credential modal.
3. Select **Sharing**.
4. Select **Options** <span class="inline-image">![Options menu icon](/_images/common-icons/three-dot-options-menu.png)</span> on the user you want to remove.
5. Select **Remove**.

11
docs/credentials/index.md Normal file
View File

@ -0,0 +1,11 @@
# Credentials
Credentials are private pieces of information issued by apps and services to authenticate you as a user and allow you to connect and share information between the app or service and the n8n node.
Access the credentials UI by opening the left menu and selecting **Credentials**. n8n lists credentials you created on the **My credentials** tab. The **All credentials** tab shows all credentials you can use, included credentials shared with you by other users.
* [Create and edit credentials](/credentials/add-edit-credentials/).
* Learn about [credential sharing](/credentials/credential-sharing/).
* Find information on setting up credentials for your services in the [credentials library](/integrations/builtin/credentials/).

View File

@ -4,13 +4,13 @@
A function is a block of code designed to perform a certain task. In n8n, you can write custom JavaScript code snippets to add, remove, and update the data you receive from a node.
The [Function](/integrations/builtin/core-nodes/n8n-nodes-base.function/) and [Function Item](/integrations/builtin/core-nodes/n8n-nodes-base.functionItem/) nodes are the most powerful in n8n. Both nodes work very similarly, they give you access to the incoming data and you can manipulate it. With these nodes you can implement any function you want using JavaScript code.
The [Function](/integrations/builtin/core-nodes/n8n-nodes-base.function/) and [Function Item](/integrations/builtin/core-nodes/n8n-nodes-base.functionItem/) nodes are the most powerful in n8n. Both nodes work similarly: they give you access to the incoming data and you can manipulate it. With these nodes you can implement any function you want using JavaScript code.
The code of the **Function node** gets executed only once. The node receives the full items (JSON and binary data) as an array and expects an array of items as a return value. The items returned can be totally different from the incoming ones. So it is not only possible to remove and edit existing items, but also to add or return totally new ones.
The code of the **Function node** gets executed once. The node receives the full items (JSON and binary data) as an array and expects an array of items as a return value. The items returned can be totally different from the incoming ones. It's possible to remove and edit existing items, and also to add or return totally new ones.
The code of the **Function Item node** gets executed once for every item. The node receives one item (just the JSON data) at a time as input. As a return value, it expects the JSON data of one single item. That makes it possible to add, remove, and edit JSON properties of items, but it is not possible to add new or remove existing items. Accessing and changing binary data is only possible via the methods `getBinaryData` and `setBinaryData`.
The code of the **Function Item node** gets executed once for every item. The node receives one item (just the JSON data) at a time as input. As a return value, it expects the JSON data of one single item. That makes it possible to add, remove, and edit JSON properties of items, but it's not possible to add new or remove existing items. Accessing and changing binary data is only possible using the methods `getBinaryData` and `setBinaryData`.
Both the Function node and Function Item node support promises. So instead of returning the item or items directly, it is also possible to return a promise which resolves accordingly.
Both the Function node and Function Item node support promises. Instead of returning the item or items directly, it's also possible to return a promise which resolves accordingly.
Here is a comparative overview of the Function and Function Item nodes:

View File

@ -1,43 +0,0 @@
# Data mapping
Data mapping means referencing data from previous nodes. It doesn't include changing (transforming) data, just referencing it.
You can map data in the following ways:
* Using the expressions editor. Refer to [expressions](/code-examples/expressions/) for more information.
* By dragging and dropping data from the **INPUT** table into parameters. This generates the expression for you.
## How to drag and drop data
1. Run your workflow to load data.
2. Open the node where you need to map data.
3. Make sure the **INPUT** view is in **Table** layout.
4. Click and hold a table heading to map top level data, or a field in the table to map nested data.
5. Drag the item into the parameter field where you want to use the data.
### Understand nested data
Given the following data:
```js
[
{
"name": "First item",
"nested": {
"example-number-field": 1,
"example-string-field": "apples"
}
},
{
"name": "Second item",
"nested": {
"example-number-field": 2,
"example-string-field": "oranges"
}
}
]
```
n8n displays it in table form like this:
!["Screenshot of a table in the INPUT panel. It includes a top level field named "nested". This field contains nested data, which is indicated in bold."](/_images/data/data-mapping/nested-data.png)

View File

@ -0,0 +1,18 @@
# Data item linking
An item is a single piece of data. Nodes receive one or more items, operate on them, and output new items. Each item links back to previous items.
You need to be understand this behavior if you're:
* Building a programmatic-style node that implements complex behaviors with its input and output data. Refer
* Using the Code node or expressions editor to access data from earlier items in the workflow.
* Using the Code node to implement complex behaviors with input and output data.
This section provides:
* A conceptual overview of [Item linking concepts](/data/data-mapping/data-item-linking/item-linking-concepts/).
* Information on [Item linking for node creators](/data/data-mapping/data-item-linking/item-linking-node-building/).
* Support for end users who need to [Work with the data path](/data/data-mapping/data-item-linking/item-linking-code-node/) to retrieve item data from previous nodes, and link items when using the Code node.
* Guidance on troubleshooting [Errors](/data/data-mapping/data-item-linking/item-linking-errors/).

View File

@ -0,0 +1,4 @@
# Item linking in the Code node
--8<-- "_snippets/data/data-mapping/item-linking-code-node.md"

View File

@ -0,0 +1,30 @@
# Item linking concepts
Each output item created by a node includes metadata that links them to the input item (or items) that the node used to generate them. This creates a chain of items that you can work back along to access previous items. This can be complicated to understand, especially if the node splits or merges data. You need to understand item linking when building your own programmatic nodes, or in some scenarios using the Code node.
This document provides a conceptual overview of this feature. For usage details, refer to:
* [Item linking for node creators](/data/data-mapping/data-item-linking/item-linking-node-building/), for details on how to handle item linking when building a node.
* [Item linking in the Code node](/data/data-mapping/data-item-linking/item-linking-code-node/), to learn how to handle item linking in the Code node.
* [Item linking errors](/data/data-mapping/data-item-linking/item-linking-errors/), to understand the errors you may encounter in the editor UI.
## n8n's automatic item linking
If a node doesn't control how to link input items to output items, n8n tries to guess how to link the items automatically:
* Single input, single output: the output links to the input.
* Single input, multiple outputs: all outputs link to that input.
* Multiple inputs and outputs:
* If you keep the input items, but change the order (or remove some but keep others), n8n can automatically add the correct linked item information.
* If the number of inputs and outputs is equal, n8n links the items in order. This means that output-1 links to input-1, output-2 to input-2, and so on.
* If the number isn't equal, or you create completely new items, n8n can't automatically link items.
If n8n can't link items automatically, and the node doesn't handle the item linking, n8n displays an error. Refer to [Item linking errors](/data/data-mapping/data-item-linking/item-linking-errors/) for more information.
## An item linking example
![A diagram showing how you can track back from an item in your current node, to one in a previous node, even when items have been re-ordered](/_images/data/data-mapping/data-item-linking/item-linking.png)
In this example, it's possible for n8n to link an item in the current node back several steps, despite the item order changing. This means the current node can access information about the linked item in the first node.

View File

@ -0,0 +1,26 @@
# Item linking errors
n8n displays errors related to data mapping when there are problems tracing an item's linked parent items back through the workflow.
## Errors when pinning data
If you see this error message:
> ERROR: '`<node-name>`' must be unpinned to execute
Unpin the data in the named node, and execute the node to get fresh data.
This error has two possible causes:
* The number of inputs into the pinned node has changed since you pinned it.
* You've edited the pinned data and changed the number of items.
## Errors when using the Function node
If you see this error message:
> ERROR: Can't get data for expression under '`<field-name>`' field
You need to supply item linking information yourself, because you have an item linking scenario that n8n can't automatically handle. Refer to [Item linking concepts](/data/data-mapping/data-item-linking/item-linking-concepts/) for a conceptual understanding of item linking, and [Manage item linking in the Function node](/data/data-mapping/data-item-linking/item-linking-code-node/) for detailed guidance on handling item linking.

View File

@ -0,0 +1,3 @@
# Item linking for node creators
--8<-- "_snippets/data/data-mapping/item-linking-node-creators.md"

Some files were not shown because too many files have changed in this diff Show More