Opening Problem Statement
Meet Alex, the owner of a small online store who struggles every evening to compile the day’s sales data. Each order comes in throughout the day, and by 7PM Alex spends nearly an hour sifting through scattered records, manually copying order IDs and prices from various sources into a spreadsheet. This tedious process not only wastes valuable time but also invites errors — a misplaced decimal or missed order means inaccurate sales reports and unhappy accounting.
Alex knew there had to be a better way. With multiple orders pouring in day after day, the manual tracking and reporting was draining energy, causing delays in decision-making, and sometimes resulting in missed opportunities to follow up on valuable customer orders.
What This Automation Does
This n8n workflow revolutionizes how Alex tracks daily orders by combining Airtable and Gmail in an automated, reliable process. Here’s what happens when the workflow runs:
- Automatically collects orders throughout the day: Whenever a new order is placed, it’s sent via a Webhook to n8n and immediately stored in an Airtable base.
- Stores detailed order info in Airtable: Captures order ID, price, and timestamp for consistent, centralized record-keeping.
- Runs a daily scheduled trigger at 7PM: Initiates the workflow to compile all orders from the previous 24-hour period.
- Generates an HTML table summary: Formats the collected data into a clean, easy-to-read table showing all orders.
- Emails the summary: Sends the formatted daily order summary via Gmail to Alex’s inbox automatically.
- Saves hours of manual reporting: Eliminates tedious copy-pasting, reducing errors and ensuring timely sales insights.
Prerequisites ⚙️
- Airtable account with a base and table configured for orders (fields: time, orderID, orderPrice)
- n8n account with workflow access (self-hosting optional: https://buldrr.com/hostinger)
- Airtable Personal Access Token with necessary scopes (
data.records:read,data.records:write,schema.bases:read) - Gmail account with OAuth2 credentials configured in n8n
- Order system or software capable of sending POST requests to a Webhook URL with orderID and orderPrice in JSON
Step-by-Step Guide
1. Setup the Airtable Base and Table
Open your Airtable account. Create a new base (or use an existing one). Create a table named orders with fields:
timeas date/timeorderIDas numberorderPriceas number
This structure will hold your incoming order data.
Common mistake: Forgetting to set time as a date field may cause filtering issues later.
2. Create Airtable API Access Token
Go to Airtable tokens page. Create a new personal access token with scopes:
- data.records:read
- data.records:write
- schema.bases:read
and access to your base.
Copy this token; you’ll use it in n8n credentials.
Common mistake: Skipping writing down the token immediately; it’s only shown once.
3. Configure Airtable Credentials in n8n
In n8n, go to Credentials → Create New Credential → select Airtable API. Paste your token.
Test the credential to ensure connectivity.
4. Set Up Gmail OAuth2 Credentials
Follow Google developer guidelines to create OAuth2 credentials with Gmail API enabled, download client_secret.json, and configure them in n8n Credentials section for Gmail OAuth2.
Visual cue: Credential test success message will confirm setup.
5. Add the Webhook Node
Drag a Webhook node into your workflow and set the HTTP Method to POST. Note the Webhook URL for later use.
This URL is where your order system will send new orders.
Testing: Use CURL or Postman to send test data:
curl -X POST
-H "Content-Type: application/json"
-d '{"orderID":12345,"orderPrice":99.99}'
YOUR_WEBHOOK_URLLook for “Node executed successfully” in n8n.
6. Configure ‘Set Order Fields’ Node
This Set node extracts incoming order info from the Webhook. Map JSON fields:
orderID:{{$json.body.orderID}}orderPrice:{{$json.body.orderPrice}}time: current timestamp withnew Date().toISOString()
Ensures every order gets timestamped and stored correctly.
7. Configure ‘Store Order’ Airtable Node
Set operation to create to append new records. Map fields from the previous node to Airtable columns accurately.
Test the workflow with a POST to the webhook and verify record creation in Airtable.
8. Schedule ‘Everyday at 7PM’ Trigger
Add the Schedule Trigger node and set its cron expression to 0 0 19 * * * which means 7:00 PM daily.
This fires the workflow daily to send the summary email.
9. Create ‘Yesterday Date’ Code Node
Use this node to generate two ISO date strings:
// Create a new date object for yesterday, 7pm
const yesterday = new Date();
yesterday.setDate( new Date().getDate() - 1);
yesterday.setHours(19, 0, 0, 0);
const isoString = yesterday.toISOString();
return {yesterday: isoString, now: new Date().toISOString()};This output helps filter Airtable results between yesterday evening and now.
10. Configure ‘Airtable Get Today’s Orders’ Node
Set to search orders created between the two generated dates with this filter formula:
=AND(time < "{{ $json.now }}", time > "{{ $json.yesterday }}")This collects all orders placed since yesterday 7PM until now (7PM today).
11. Format the Orders Using ‘HTML’ Node
Map the retrieved orders into an HTML table format. The code in this node dynamically builds table headers from the first order’s properties and then fills rows with each order’s values.
This HTML will be used as the email body.
12. Send Email with ‘Send to Gmail’ Node
Use the Gmail node configured with OAuth2 to send the email. Set recipient address, subject line like “Daily Order Summary,” and the message body to {{ $json.html }} output from the HTML node.
Review your inbox at 7PM to see the order summary automatically arrive.
Customizations ✏️
1. Change Email Time
In the Everyday at 7PM Schedule Trigger node, modify the cron expression to your preferred send time. For example, for 6AM: 0 0 6 * * *.
2. Add Customer Details
Modify the Set Order Fields node to include customerID or other relevant fields from incoming Webhook data, and update Airtable and filter accordingly.
3. Use a Different Email Service
You can swap the Send to Gmail node with another email provider supported by n8n, such as SMTP or Outlook.
4. Improve Table Styling
Customize the HTML node’s inline styles or structure to add better branding or readability formats.
Troubleshooting 🔧
Problem: “Airtable Get Today’s Orders” node returns empty data.
Cause: Time filtering formula may not match your Airtable date format or no orders between recorded times.
Solution: Check Airtable’s time zone settings and adjust date filters. Ensure orders are timestamped correctly with the Set Order Fields node.
Problem: Gmail node fails with authentication error.
Cause: OAuth2 credentials expired or improperly configured.
Solution: Re-create Gmail OAuth2 credentials, verify scopes, and update in n8n.
Pre-Production Checklist ✅
- Verify Airtable base and table names match exactly in both Airtable nodes.
- Test Webhook URL with sample POST data; check Airtable record creation.
- Confirm Schedule Trigger fires at correct system time.
- Send test emails manually using the Gmail node with sample HTML content.
- Backup your workflow and Airtable data before going live.
Deployment Guide
Activate the workflow in n8n once all nodes are configured and tested thoroughly. Make sure the trigger node is enabled for scheduled execution.
Monitor initial runs for successful order capturing and email dispatch. Use n8n’s execution logs for troubleshooting any anomalies.
FAQs
Can I use Google Sheets instead of Airtable?
Yes, but this workflow is tailored to Airtable’s API and filtering formula. You’d need to adjust nodes accordingly.
Does sending daily emails consume Gmail API quota?
Typically, daily summaries are within free limits, but check Gmail API quotas if you scale up.
Is my data secure in this workflow?
Yes, Airtable uses secure API with token-based authentication, and Gmail OAuth2 ensures secure emails.
Can it handle hundreds of orders per day?
Yes, Airtable and n8n handle bulk data well but test scalability as your data grows.
Conclusion
By building this n8n workflow, you’ve automated daily order aggregation for Alex’s online store, saving hours each evening and eliminating costly human errors. The process ensures a reliable archive of sales data in Airtable and delivers a concise email summary exactly when needed.
Next, consider automating order status updates via SMS, integrating payment confirmations, or generating weekly sales forecasts based on the collected data.
You’ve set a solid foundation for smart, data-driven order management with n8n, Airtable, and Gmail working seamlessly together.