D: 🚀 Automate like a pro with n8n’s HTTP Node! Whether you’re fetching data from APIs, sending requests, or building complex workflows, the HTTP Node is your Swiss Army knife. This guide covers setup, authentication, advanced features, and real-world examples to supercharge your automation.
🔧 1. What is the HTTP Node?
The HTTP Node in n8n lets you send/receive HTTP/HTTPS requests (GET, POST, PUT, DELETE, etc.). It’s perfect for:
- Fetching data from REST APIs (e.g., weather, stocks, CRM).
- Sending data to webhooks (e.g., Slack, Discord).
- Integrating with external services (e.g., Google Sheets, Airtable).
👉 Example: Fetch Bitcoin prices from CoinGecko:
Method: GET
URL: https://api.coingecko.com/api/v3/simple/price?ids=bitcoin&vs_currencies=usd
⚙️ 2. HTTP Node Setup
Basic Configuration
- Method: Choose GET/POST/PUT/DELETE.
- URL: Enter the API endpoint (e.g.,
https://api.example.com/data
). - Headers: Add keys like
Content-Type: application/json
.
🔹 Pro Tip: Use Expressions ({{ }}
) for dynamic URLs/headers (e.g., {{$node["Webhook"].json["id"]}}
).
Authentication
- Basic Auth: Username + password.
- API Key: Add to headers (e.g.,
x-api-key: YOUR_KEY
). - OAuth2: For services like Google, Twitter.
🚀 3. Advanced Features
A. Query Parameters & Headers
- Add parameters directly in the URL (
?param1=value1
) or via the “Query Parameters” section. - Custom headers (e.g.,
Authorization: Bearer TOKEN
) for secure requests.
B. Body (for POST/PUT)
- JSON: Send structured data (e.g.,
{"name": "Alice", "age": 30}
). - Form-Data: Upload files or multipart data.
C. Error Handling
- Use “Continue on Fail” to skip errors.
- Access error details with
{{$node["HTTP"].error}}
.
💡 4. Real-World Examples
Example 1: Slack Alert on New Data
- HTTP Node: Fetch data from an API (e.g.,
GET https://api.weather.com/today
). - IF Node: Check if temperature > 30°C.
- HTTP Node: Send a Slack message via webhook.
Example 2: Auto-Save to Google Sheets
- Webhook Node: Receive form submissions.
- HTTP Node: POST data to Google Sheets API.
🔥 5. Pro Tips
- Paginate APIs: Use loops +
{{$prevNode.json["next_page"]}}
. - Rate Limiting: Add delays (
$wait(5000)
) between calls. - Debugging: Inspect raw requests/responses in “Execution Data”.
📌 Conclusion
The HTTP Node unlocks endless possibilities—from simple API calls to enterprise-grade automation. Start small, experiment, and scale up!
🔗 Resources:
💬 Got questions? Drop them below! 👇 #n8n #Automation #NoCode