Introduction to n8n
n8n is a powerful workflow automation tool that allows you to connect various applications and automate tasks in an intuitive interface. It supports dozens of APIs, making it easy to integrate different services and streamline your operations. In this post, we introduce n8n, its features, and provide examples of how you can use its APIs to create automation workflows.
Useful API Examples
1. Google Sheets API
The Google Sheets API allows you to read and write data from Google Sheets.
{
"nodes": [
{
"parameters": {
"authentication": "serviceAccount",
"sheetId": "your_google_sheet_id",
"range": "Sheet1!A1:C10"
},
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [
250,
300
]
}
],
"connections": {}
}
2. Slack API
The Slack API enables communication within your teams by sending messages to channels.
{
"nodes": [
{
"parameters": {
"authentication": "accessToken",
"channel": "general",
"text": "Hello from n8n!"
},
"name": "Slack",
"type": "n8n-nodes-base.slack",
"typeVersion": 1,
"position": [
450,
300
]
}
],
"connections": {}
}
3. HTTP Request Node
The HTTP Request node lets you make any HTTP request to interact with web services.
{
"nodes": [
{
"parameters": {
"url": "https://jsonplaceholder.typicode.com/posts",
"method": "GET"
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
650,
300
]
}
],
"connections": {}
}
App Example
Here is an example of an application that uses n8n to automate the process of collecting data from a Google Sheet, processing it, and then sending the result to a Slack channel.
{
"nodes": [
{
"parameters": {
"sheetId": "your_google_sheet_id",
"range": "Sheet1!A1:C10",
"authentication": "serviceAccount"
},
"name": "Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"url": "https://your-processing-api.com/process",
"method": "POST",
"jsonParameters": true,
"options": {},
"bodyParametersUi": {
"parameter": [
{
"name": "data",
"value": "={{$node[\"Google Sheets\"].json}}"
}
]
}
},
"name": "HTTP Request",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
450,
300
]
},
{
"parameters": {
"authentication": "accessToken",
"channel": "general",
"text": "={{$node[\"HTTP Request\"].json[\"result\"]}}"
},
"name": "Slack",
"type": "n8n-nodes-base.slack",
"typeVersion": 1,
"position": [
650,
300
]
}
],
"connections": {
"Google Sheets": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request": {
"main": [
[
{
"node": "Slack",
"type": "main",
"index": 0
}
]
]
}
}
}
With these simple steps, you can collect, process, and share information automatically using n8n. This example showcases the integration power of n8n with various services, saving time and reducing manual intervention.
Hash: 636396f02b6571e40d8fe91cba550515c0cdc0e7d314c210e00b02256375a796