🎓 Learn Code Node (JavaScript) with an Interactive Hands-On Tutorial
How it works This workflow is a hands-on tutorial for the Code node in n8n, covering both basic and advanced concepts through a simple data processing task. Provides Sample Data: The workflow begins with a sample list of users. Processes Each Item (Run Once for Each Item): The first Code node iterates through each user to calculate their fullName and age. This demonstrates basic item-by-item data manipulation using $input.item.json. Fetches External Data (Advanced): The second Code node showcases a more advanced feature. For each user, it uses the built-in this.helpers.httpRequest function to call an external API (genderize.io) to enrich the data with a predicted gender. Processes All Items at Once (Run Once for All Items): The third Code node receives the fully enriched list of users and runs only once. It uses $items() to access the entire list and calculate the averageAge, returning a single summary item. Create a Binary File: The final Code node gets the fully enriched list of users once again and creates a binary CSV file to show how to use binary data Buffer in JavaScript. Set up steps Setup time: < 1 minute This workflow is a self-contained tutorial and requires no setup. Explore the Nodes: Click on each of the Code nodes to read the code and the comments explaining each step, from basic to advanced. Run the Workflow: Click "Execute Workflow" to see it in action. Check the Output: Click on each node after the execution to see how the data is transformed at each stage. Notice how the data is progressively enriched. Experiment! Try changing the data in the 1. Sample Data node, or modify the code in the Code nodes to see what happens.
B2B lead qualification
This automated n8n workflow qualifies B2B leads via voice calls using the VAPI API and integrates the collected data into Google Sheets. It triggers when a new lead’s phone number is added, streamlining lead qualification and data capture. What is VAPI? VAPI is an API service that enables voice call automation, used here to qualify leads by capturing structured data through interactive calls. Good to Know VAPI API calls may incur costs based on usage; check VAPI pricing for details. Ensure Google Sheets access is properly authorized to avoid data issues. Use credential fields for the HTTP Request node 'Bearer token' instead of hardcoding. Use a placeholder Google Sheet document ID (e.g., "your-sheet-id-placeholder") to avoid leaking private data. How It Works Detect when a new phone number is added for a lead using the New Lead Captured node. Use the Receive Lead Details from VAPI node to capture structured data (name, company, challenges) via a POST request. Trigger an outbound VAPI call to qualify the lead with the Initiate Voice Call (VAPI) node. Store the collected data into a Google Sheet using the Save Qualified Lead to CRM Sheet node. Send a success response back to VAPI with the Send Call Data Acknowledgement node. How to Use Import the workflow into n8n. Configure VAPI API credentials in the HTTP Request node using credential fields. Set up Google Sheets API access and authorize the app. Create a Google Sheet with the following columns: Name (text), Company (text), Challenges (text), Date (date). Test with a sample lead phone number to verify call initiation and data storage. Adjust the workflow as needed and retest. Requirements VAPI API credentials Google Sheets API access Customizing This Workflow Modify the Receive Lead Details from VAPI node to capture additional lead fields or adjust call scripts for specific industries.
Sync Shopify customers to Google Sheets + Squarespace compatible csv
This workflow retrieves all Shopify Customers and saves them into a Google Sheets spreadsheet using the Shopify Admin REST API. It uses pagination to ensure all customers are collected efficiently. N8n does not have built-in actions for Customers, so I built the workflow using an HTTP Request node. How It Works This workflow uses the HTTP Request node to fetch paginated chunks manually. Shopify uses cursor-based pagination (page_info) instead of traditional page numbers. Pagination data is stored in the response headers, so we need to enable Include Response Headers and Status in the HTTP Request node. The workflow processes customer data, saves it to Google Sheets, and formats a compatible CSV for Squarespace Contacts import. This workflow can be run on demand or scheduled to keep your data up to date. Parameters You can adjust these parameters in the HTTP Request node: limit – The number of customers per request (default: 50, max: 250). fields – Comma-separated list of fields to retrieve. page_info – Used for pagination; only limit and fields are allowed when paginating. 📌 Note: When you query paginated chunks with page_info, only the limit and fields parameters are allowed. Credentials Shopify API Key – Required for authentication. Google Sheets API credentials – Needed to insert data into the spreadsheet. Google Sheets Template Clone this spreadsheet: 📎 Google Sheets Template According to Squarespace documentation, your spreadsheet can have up to three columns and must be arranged in this order (no header): Email Address First Name (optional) Last Name (optional) Shopify Customer ID (this field will be ignored) Exporting a Compatible CSV for Squarespace Contacts This workflow also generates a CSV file that can be imported into Squarespace Contacts. How to Import the CSV to Squarespace: Open the Lists & Segments panel and click on your mailing list. Click Add Subscribers, then select Upload a list. Click Add a CSV file and select the file to import. Toggle These subscribers accept marketing to confirm permission. Preview your list, then click Import. Who Is This For? Shopify store owners who need to export all customers to Google Sheets. Anyone looking for a flexible and scalable Shopify customers extraction solution. Squarespace website owners who want to bulk-create their Contacts using CSV. --- Explore More Templates 👉 Check out my other n8n templates