1. The SEO Marketer’s Weekly Reporting Challenge
Meet Sarah, an SEO specialist at a growing digital agency. Every Monday morning, Sarah spends nearly two hours manually logging into Google Search Console, extracting performance data, and compiling it into readable reports for her clients. This tedious routine often leads to delays, causing frustration for both Sarah and her clients who depend on timely SEO insights to make strategic decisions. With multiple clients to manage, this repetitive manual work not only drains Sarah’s time but also increases the risk of errors in data transcription.
Imagine if Sarah could instantly receive a clear, concise SEO report every Monday at 7 AM without lifting a finger. This is precisely the problem solved by the n8n workflow we’ll explore today.
2. What This Automation Does
When triggered every Monday at 7 AM, this n8n workflow performs several key tasks to streamline Sarah’s weekly SEO reporting:
- Automatically fetches the latest SEO performance data from Google Search Console using a secure HTTP request.
- Processes and summarizes key metrics such as clicks, impressions, click-through rate (CTR), and average position for the top search queries over the past week.
- Generates a well-formatted SEO report highlighting the top 10 search queries with their detailed metrics.
- Sends the SEO report via Gmail directly to Sarah’s inbox or any specified recipient’s email address.
- Ensures consistent weekly delivery so Sarah and her clients never miss their critical SEO updates again.
This automation could save Sarah up to 8+ hours per month and improve the accuracy and reliability of her SEO reporting process.
3. Prerequisites ⚙️
- n8n Account: An active n8n automation platform account (cloud or self-hosted).
- Google Search Console Access: A verified property for your website in Google Search Console with API access permissions.
- HTTP Basic Credentials: Access credentials for authenticating the API requests to Google Search Console.
- Gmail Account: A Gmail account with OAuth2 credentials configured in n8n for sending emails.
⚠️ Optional: If you prefer self-hosting n8n for full control, consider hosting services like Hostinger.
4. Step-by-Step Guide to Building This Workflow
Step 1: Add a Cron Trigger Node for Weekly Execution
Navigate to the Nodes panel → drag and drop the Cron node. Configure it to trigger every Monday at 7 AM:
- Under ‘Settings,’ select ‘Every Week’ and pick ‘Monday’ as the day.
- Set the time to ’07:00′ to run early in the morning.
You should see a scheduled cron trigger icon indicating it will fire weekly.
Common mistake: Forgetting to set the correct timezone may cause unexpected trigger times. Double-check your n8n timezone settings.
Step 2: Set Up an HTTP Request to Google Search Console API
Drag in an HTTP Request node right after the Cron node. Configure it as follows:
- Method: POST (since Google Search Console’s query API requires POST requests)
- URL:
https://searchconsole.googleapis.com/webmasters/v3/sites/YOUR_SITE_URL/searchAnalytics/query(replaceYOUR_SITE_URLwith URL-encoded version of your site, e.g., https%3A%2F%2Fexample.com/) - Authentication: Select your configured HTTP Basic Auth credentials for Google Search Console.
- Request Body: Include a JSON payload specifying the date range (last 7 days) and dimensions (query).
This node fetches the raw search analytics data needed for your report.
Note: The workflow uses genericCredentialType with HTTP Basic Auth set up.
Step 3: Process the Response Using a Function Node
Add a Function node next, named “Generate SEO Report.” Paste this JavaScript code to extract and format data:
const rows = items[0].json.rows || [];
const reportLines = rows.map((row, index) => {
return `${index + 1}. ${row.keys[0]} - Clicks: ${row.clicks}, Impressions: ${row.impressions}, CTR: ${row.ctr.toFixed(2)}, Position: ${row.position.toFixed(2)}`;
});
return [{
json: {
report: `Top 10 Search Queries (Last 7 Days):nn${reportLines.join("n")}`
}
}];This script loops through the retrieved data rows, then formats a clean report string listing each query with its key SEO metrics.
Common mistake: Not handling missing rows gracefully can cause errors. This code uses a fallback to an empty array.
Step 4: Send the Report via Gmail
Add the Gmail node after the Function node. Configure it to:
- Send to Sarah’s or your desired email address (e.g.,
[email protected]). - Set the subject to something like “Weekly SEO Performance Report.”
- In the message body, use an expression to reference the report generated by the Function node:
{{ $json.report }}. - Ensure your Gmail OAuth2 credentials are correctly configured in n8n for authentication.
Once you activate this workflow, it will email the report every Monday automatically.
Step 5: Test Your Workflow
Save and manually trigger the workflow to ensure the report is generated and emailed successfully.
You should receive a clean, formatted SEO report in your inbox within moments.
5. Customizations ✏️
- Change Report Frequency: Adjust the Cron node to run daily or monthly by changing the schedule settings for finer or broader data insight.
- Add More SEO Metrics: Modify the HTTP Request payload to include other dimensions like “page” or “device” for deeper analysis.
- Customize Email Format: In the Gmail node, switch to HTML content by enabling “HTML” and styling your report with HTML tags for better readability.
- Send to Multiple Recipients: Add comma-separated emails in the Gmail node’s ‘Send To’ field to share reports with your entire SEO team.
6. Troubleshooting 🔧
Problem: “HTTP Request fails with 401 Unauthorized”
Cause: Incorrect or expired Google Search Console authentication.
Solution: Verify your credentials in n8n and refresh tokens if needed by re-authorizing the Google API.
Problem: “Empty report or no rows received”
Cause: Incorrect API request body or no recent data in Google Search Console.
Solution: Double-check the API POST payload includes correct date ranges and dimensions.
Problem: “Emails not sending or Gmail node errors”
Cause: Gmail OAuth2 credentials misconfiguration.
Solution: Reconnect your Gmail account credentials in n8n, ensure Gmail API is enabled in Google Cloud Console.
7. Pre-Production Checklist ✅
- Verify Google Search Console site URL and API access permissions.
- Test HTTP Request node separately to confirm data retrieval.
- Confirm the Function node outputs formatted report text.
- Send manual test emails via Gmail node to your inbox.
- Ensure Cron schedule matches your expected report timing and timezone.
8. Deployment Guide
Activate the workflow in n8n by toggling the “Active” switch on. Monitor the first few runs via the execution history to catch any errors early. Utilize logging features in n8n for detailed inspections of node runs. If self-hosted, set up server monitoring to ensure uptime.
9. FAQs
Q: Can I replace Gmail with other email services?
A: Yes, n8n supports various email nodes like SMTP or Outlook that can be configured similarly.
Q: Does this workflow consume a lot of API quota?
A: The workflow runs once a week, so API usage is minimal, but monitor your Google API quotas to stay within limits.
Q: Is my SEO data secure?
A: Data is handled securely within n8n’s environment and Google’s API, but ensure your credentials are stored with strict access control.
10. Conclusion
By building this n8n workflow, you have automated Sarah’s weekly SEO reporting, saving valuable time and reducing errors. You now receive a detailed SEO performance summary every Monday morning, enabling faster strategic decisions. Next, consider adding automated alerts for significant SEO drops or integrating Google Sheets for historical data tracking.
Start running your own automated SEO reports today and transform how you handle SEO insights!