Skip to content

Commit 3e9f71d

Browse files
jakcinmarinaB4nan
andauthored
docs: add n8n documentation (#1699)
Co-authored-by: Martin Adámek <[email protected]>
1 parent ca23f97 commit 3e9f71d

File tree

10 files changed

+191
-0
lines changed

10 files changed

+191
-0
lines changed
60.2 KB
Loading
191 KB
Loading
84.5 KB
Loading
52.9 KB
Loading
74.6 KB
Loading
54 KB
Loading
130 KB
Loading
79.6 KB
Loading
50.4 KB
Loading
Lines changed: 191 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,191 @@
1+
---
2+
title: n8n integration
3+
description: Connect Apify with n8n to automate workflows by running Actors, extracting data, and responding to Actor or task events.
4+
sidebar_label: n8n
5+
sidebar_position: 7
6+
slug: /integrations/n8n
7+
---
8+
9+
**Connect Apify with n8n to automate workflows by running Actors, extracting structured data, and responding to Actor or task events.**
10+
11+
---
12+
13+
[n8n](https://n8n.io/) is an open source, fair-code licensed tool for workflow automation. With the [Apify integration for n8n](https://github.com/apify/n8n-nodes-apify), you can connect Apify Actors and storage to hundreds of services You can run scrapers, extract data, and trigger workflows based on Actor or task events.
14+
15+
In this guide, you'll learn how to install the Apify node, set up authentication, and incorporate it into your n8n workflows as either a trigger or an action.
16+
17+
## Prerequisites
18+
19+
Before you begin, make sure you have:
20+
21+
- An [Apify account](https://console.apify.com/)
22+
- An [n8n instance](https://docs.n8n.io/getting-started/) (self‑hosted or cloud)
23+
24+
## Install the Apify Node (self-hosted)
25+
26+
If you're running a self-hosted n8n instance, you can install the Apify community node directly from the editor. This process adds the node to your available tools, enabling Apify operations in workflows.
27+
28+
1. Open your n8n instance.
29+
1. Go to **Settings > Community Nodes**.
30+
1. Select **Install**.
31+
1. Enter the npm package name: `@apify/n8n-nodes-apify` (for latest version). To install a specific [version](https://www.npmjs.com/package/@apify/n8n-nodes-apify?activeTab=versions) enter e.g `@apify/[email protected]`.
32+
1. Agree to the [risks](https://docs.n8n.io/integrations/community-nodes/risks/) of using community nodes and select **Install**.
33+
1. You can now use the node in your workflows.
34+
35+
![Apify Install Node](../images/n8n-install-node-self-hosted.png)
36+
37+
## Install the Apify Node (n8n Cloud)
38+
39+
For n8n Cloud users, installation is even simpler and doesn't require manual package entry. Just search and add the node from the canvas.
40+
41+
1. Go to the **Canvas** and open the **nodes panel**
42+
1. Search for **Apify** in the community node registry
43+
1. Click **Install node** to add the Apify node to your instance
44+
45+
![Apify Install Node](../images/n8n-install-node-cloud.png)
46+
47+
:::note Verified community nodes visibility
48+
49+
On n8n Cloud, instance owners can toggle visibility of verified community nodes in the Cloud Admin Panel. Ensure this setting is enabled to install the Apify node.
50+
51+
:::
52+
53+
Once installed, the next step is authentication.
54+
55+
## Authentication
56+
57+
The Apify node offers two authentication methods to securely connect to your Apify account. Choose based on your setup - API key works for both self-hosted and cloud instances, while OAuth2 is cloud-only.
58+
59+
### API Key (cloud & self-hosted instance)
60+
61+
1. In the n8n Editor UI, click on **Create Credential**.
62+
1. Search for Apify API and click **Continue**.
63+
1. Enter your Apify API token. (find it in the [Apify Console](https://console.apify.com/settings/integrations)).
64+
1. Click **Save**.
65+
66+
![Apify Auth](../images/n8n-api-auth.png)
67+
68+
### OAuth2 (cloud instance only)
69+
70+
1. In n8n Cloud, select **Create Credential**.
71+
1. Search for Apify OAuth2 API and select **Continue**.
72+
1. Select **Connect my account** and authorize with your Apify account.
73+
1. n8n automatically retrieves and stores the OAuth2 tokens.
74+
75+
![Apify Auth](../images/n8n-oauth.png)
76+
77+
:::note
78+
79+
For simplicity on n8n Cloud, use the API key method if you prefer manual control over credentials.
80+
81+
:::
82+
83+
With authentication set up, you can now create workflows that incorporate the Apify node.
84+
85+
## Create a Workflow with the Apify Node
86+
87+
Start by building a basic workflow in n8n, then add the Apify node to handle tasks like running Actors or fetching data.
88+
89+
1. Create a new workflow in n8n.
90+
1. Select **Add Node**, search for **Apify**, and select it.
91+
1. Choose the desired **Resource** and **Operation**.
92+
1. In the node's **Credentials** dropdown, choose the Apify credential you configured earlier. If you haven't configured any credentials, you can do so in this step. The process will be the same.
93+
1. You can now use Apify node as a trigger or action in your workflow.
94+
95+
![Apify Node](../images/n8n-list-of-operations.png)
96+
97+
## Use Apify node as trigger
98+
99+
Triggers let your workflow respond automatically to events in Apify, such as when an Actor run finishes. This is ideal for real-time automation, like processing scraped data as soon as it's available.
100+
101+
1. Create a new workflow.
102+
1. Click **Add Node**, search for **Apify**, and select it.
103+
1. Select **On new Apify Event** trigger.
104+
1. Configure the trigger:
105+
- **Actor or Actor task**: select the Actor or task to listen for terminal events.
106+
- **Event Type**: the status of the Actor or task run that should trigger the workflow.
107+
1. Add subsequent nodes (e.g., HTTP Request, Google Sheets) to process or store the output.
108+
1. Save and execute the workflow.
109+
110+
![Apify Node](../images/n8n-trigger-example.png)
111+
112+
## Use Apify node as an action
113+
114+
Actions allow you to perform operations like running an Actor within a workflow. For instance, you could trigger a scraper and then retrieve its results.
115+
116+
1. Create a new workflow.
117+
1. Click **Add Node**, search for **Apify**, and select it.
118+
1. Select any operation. In this example we will use **Run Actor**.
119+
1. Configure it:
120+
- **Custom input**: JSON input for the Actor run, which you can find on the Actor input page in Apify Console. See [Inputs](/platform/actors/running/input-and-output#input) for more information. If empty, the run uses the input specified in the default run configuration
121+
- **Timeout**: Timeout for the Actor run in seconds. Zero value means there is no timeout
122+
- **Memory**: Amount of memory allocated for the Actor run, in megabytes
123+
- **Build Tag**: Specifies the Actor build tag to run. By default, the run uses the build specified in the default run configuration for the Actor (typically `latest`)
124+
- **Wait for finish**: Whether to wait for the run to finish before continuing. If true, the node will wait for the run to complete (successfully or not) before moving to the next node
125+
![Apify Node](../images/n8n-run-actor-example.png)
126+
1. Add another Apify operation called **Get Dataset Items**.
127+
- Set **Dataset ID** parameter as **defaultDatasetId** value received from the previous **Run Actor** node. This will give you the output of the Actor run
128+
![Apify Node](../images/n8n-get-dataset-items-example.png)
129+
1. Add any subsequent nodes (e.g. Google Sheets) to process or store the output
130+
1. Save and execute the workflow
131+
![Apify Node](../images/n8n-workflow-example.png)
132+
133+
## Available Operations
134+
135+
The Apify node provides a range of operations for managing Actors, tasks, runs, and storage. These can be used as actions in your workflows. For triggers, focus on event-based activations to start workflows automatically.
136+
137+
### Actors
138+
139+
Run and manage Actors directly.
140+
141+
- **Run Actor**: Starts a specified Actor with customizable parameters
142+
- **Scrape Single URL**: Runs a scraper for a specified website and returns its content
143+
- **Get Last Run**: Retrieve metadata for the most recent run of an Actor
144+
145+
### Actor Tasks
146+
147+
Execute predefined tasks efficiently.
148+
149+
- **Run Task**: Executes a specified Actor task
150+
151+
### Actor Runs
152+
153+
Retrieve run details.
154+
155+
- **Get User Runs List**: Retrieve a list of all runs for a user
156+
- **Get Run**: Retrieve detailed information for a specific run ID
157+
- **Get Runs**: Retrieve all runs for a specific Actor
158+
159+
### Storage
160+
161+
Pull data from Apify storage.
162+
163+
#### Datasets
164+
165+
- **Get Items**: Retrieves items from a [dataset](/platform/storage/dataset)
166+
167+
#### Key-Value Stores
168+
169+
- **Get Record**: Retrieves a value from a [key-value store](/platform/storage/key-value-store)
170+
171+
### Triggers
172+
173+
Automatically start an n8n workflow when an Actor or task run finishes:
174+
175+
- **Actor Run Finished**: Activates when a selected Actor run completes
176+
- **Task Run Finished**: Activates when a selected Actor task run completes
177+
178+
## Resources
179+
180+
- [n8n Community Nodes Documentation](https://docs.n8n.io/integrations/community-nodes/)
181+
- [Apify API Documentation](https://docs.apify.com)
182+
- [n8n Documentation](https://docs.n8n.io)
183+
184+
## Troubleshooting
185+
186+
If you encounter issues, start by double-checking basics.
187+
188+
- **Authentication errors**: Verify your API token or OAuth2 settings in **Credentials**.
189+
- **Operation failures**: Check input parameters, JSON syntax, and resource IDs in your Apify account.
190+
191+
Feel free to explore other resources and contribute to the integration on [GitHub](https://github.com/apify/n8n-nodes-apify).

0 commit comments

Comments
 (0)