The full dataset viewer is not available (click to read why). Only showing a preview of the rows.
The dataset generation failed because of a cast error
Error code: DatasetGenerationCastError
Exception: DatasetGenerationCastError
Message: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 1 new columns ({'messages'}) and 3 missing columns ({'instruction', 'output', 'input'}).
This happened while the json dataset builder was generating data using
hf://datasets/mbakgun/n8nbuilder-n8n-workflows-dataset/train_openai.jsonl (at revision 5be890993335fbb9db41ee799daacc91e0e3a271)
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)
Traceback: Traceback (most recent call last):
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1831, in _prepare_split_single
writer.write_table(table)
File "/usr/local/lib/python3.12/site-packages/datasets/arrow_writer.py", line 714, in write_table
pa_table = table_cast(pa_table, self._schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2272, in table_cast
return cast_table_to_schema(table, schema)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/table.py", line 2218, in cast_table_to_schema
raise CastError(
datasets.table.CastError: Couldn't cast
messages: list<item: struct<role: string, content: string>>
child 0, item: struct<role: string, content: string>
child 0, role: string
child 1, content: string
to
{'instruction': Value('string'), 'input': Value('string'), 'output': Value('string')}
because column names don't match
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 1339, in compute_config_parquet_and_info_response
parquet_operations = convert_to_parquet(builder)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/src/services/worker/src/worker/job_runners/config/parquet_and_info.py", line 972, in convert_to_parquet
builder.download_and_prepare(
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 894, in download_and_prepare
self._download_and_prepare(
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 970, in _download_and_prepare
self._prepare_split(split_generator, **prepare_split_kwargs)
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1702, in _prepare_split
for job_id, done, content in self._prepare_split_single(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/site-packages/datasets/builder.py", line 1833, in _prepare_split_single
raise DatasetGenerationCastError.from_cast_error(
datasets.exceptions.DatasetGenerationCastError: An error occurred while generating the dataset
All the data files must have the same columns, but at some point there are 1 new columns ({'messages'}) and 3 missing columns ({'instruction', 'output', 'input'}).
This happened while the json dataset builder was generating data using
hf://datasets/mbakgun/n8nbuilder-n8n-workflows-dataset/train_openai.jsonl (at revision 5be890993335fbb9db41ee799daacc91e0e3a271)
Please either edit the data files to have matching columns, or separate them into different configurations (see docs at https://hf.co/docs/hub/datasets-manual-configuration#multiple-configurations)Need help to make the dataset viewer work? Make sure to review how to configure the dataset viewer, and open a discussion for direct support.
instruction
string | input
string | output
string |
|---|---|---|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
What this workflow does
This workflow retrieves Google Analytics data from the last 7 days and the same period in the previous year. The data is then prepared by AI as a table, analyzed and provided with a small summary.
The summary is then sent by email to a desired address and, shortened and summarized again, sent to a Telegram account.
This workflow has the following sequence:
time trigger (e.g. every Monday at 7 a.m.)
retrieval of Google Analytics data from the last 7 days
assignment and summary of the data
retrieval of Google Analytics data from the last 7 days of the previous year
allocation and summary of the data
preparation in tabular form and brief analysis by AI.
sending the report as an email
preparation in short form by AI for Telegram (optional)
sending as Telegram message.
Requirements
The following accesses are required for the workflow:
Google Analytics (via Google Analytics API): Documentation
AI API access (e.g. via OpenAI, Anthropic, Google or Ollama)
SMTP access data (for sending the mail)
Telegram access data (optional for sending as Telegram message): Documentation
Feel free to contact me via LinkedIn, if you have any questions!
|
{"id": "AAjX1BuwhyXpo8xP", "meta": {"instanceId": "558d88703fb65b2d0e44613bc35916258b0f0bf983c5d4730c00c424b77ca36a"}, "name": "Google Analytics: Weekly Report", "tags": [], "nodes": [{"id": "91ba5982-e226-4f0b-af0d-8c9a44b08279", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [-1740, 300], "parameters": {"rule": {"interval": [{"field": "weeks", "triggerAtDay": [1], "triggerAtHour": 7}]}}, "typeVersion": 1.2}, {"id": "62c38eaf-2222-4d22-8589-677f36bce10d", "name": "Google Analytics Letzte 7 Tage", "type": "n8n-nodes-base.googleAnalytics", "position": [-1540, 300], "parameters": {"metricsGA4": {"metricValues": [{"listName": "screenPageViews"}, {}, {"listName": "sessions"}, {"listName": "sessionsPerUser"}, {"name": "averageSessionDuration", "listName": "other"}, {"name": "ecommercePurchases", "listName": "other"}, {"name": "averagePurchaseRevenue", "listName": "other"}, {"name": "purchaseRevenue", "listName": "other"}]}, "propertyId": {"__rl": true, "mode": "list", "value": "345060083", "cachedResultUrl": "https://analytics.google.com/analytics/web/#/p345060083/", "cachedResultName": "https://www.ep-reisen.de – GA4"}, "dimensionsGA4": {"dimensionValues": [{}]}, "additionalFields": {}}, "credentials": {"googleAnalyticsOAuth2": {"id": "onRKXREI8izfGzv0", "name": "Google Analytics account"}}, "typeVersion": 2}, {"id": "0a51c2f3-a487-4226-884f-63d4cb2bf4e4", "name": "Send Email", "type": "n8n-nodes-base.emailSend", "position": [420, 80], "parameters": {"html": "={{ $json.message.content }}", "options": {}, "subject": "Weekly Report: Google Analytics: Last 7 days", "toEmail": "[email protected]", "fromEmail": "[email protected]"}, "credentials": {"smtp": {"id": "A71x7hx6lKj7nxp1", "name": "SMTP account"}}, "typeVersion": 2.1}, {"id": "04963783-f455-4983-afea-e94b316d8532", "name": "Telegram", "type": "n8n-nodes-base.telegram", "position": [420, 420], "parameters": {"text": "={{ $json.message.content }}", "chatId": "1810565648", "additionalFields": {}}, "credentials": {"telegramApi": {"id": "0hnyvxyUMN77sBmU", "name": "Telegram account"}}, "typeVersion": 1.2}, {"id": "3b6b4902-15b3-4bbc-8427-c35471a7431b", "name": "Processing for Telegram", "type": "@n8n/n8n-nodes-langchain.openAi", "position": [60, 420], "parameters": {"modelId": {"__rl": true, "mode": "list", "value": "gpt-4o-mini", "cachedResultName": "GPT-4O-MINI"}, "options": {}, "messages": {"values": [{"content": "=Convert the following text from HTML to normal text:\n\n{{ $json.message.content }}\n\nPlease format the table so that each metric is a separate paragraph!\n\nExample:\n\nTotal views: xx.xxx\nTotal views previous year: xx,xxx\nDifference: x.xx %\n\nTotal users: xx,xxx\nTotal users previous year: xx,xxx\nDifference: -x.xx %"}]}}, "credentials": {"openAiApi": {"id": "niikB3HA4fT5WAqt", "name": "OpenAi account"}}, "typeVersion": 1.7}, {"id": "d761980c-0327-4d4e-92aa-d0342b2e249e", "name": "Calculator", "type": "@n8n/n8n-nodes-langchain.toolCalculator", "position": [140, 300], "parameters": {}, "typeVersion": 1}, {"id": "ce7ba356-80bb-4b17-9445-fb535267cdf0", "name": "Google Analytics: Past 7 days of the previous year", "type": "n8n-nodes-base.googleAnalytics", "position": [-600, 300], "parameters": {"endDate": "={{ $json.endDate }}", "dateRange": "custom", "startDate": "={{ $json.startDate }}", "metricsGA4": {"metricValues": [{"listName": "screenPageViews"}, {}, {"listName": "sessions"}, {"listName": "sessionsPerUser"}, {"name": "averageSessionDuration", "listName": "other"}, {"name": "ecommercePurchases", "listName": "other"}, {"name": "averagePurchaseRevenue", "listName": "other"}, {"name": "purchaseRevenue", "listName": "other"}]}, "propertyId": {"__rl": true, "mode": "list", "value": "345060083", "cachedResultUrl": "https://analytics.google.com/analytics/web/#/p345060083/", "cachedResultName": "https://www.ep-reisen.de – GA4"}, "dimensionsGA4": {"dimensionValues": [{}]}, "additionalFields": {}}, "credentials": {"googleAnalyticsOAuth2": {"id": "onRKXREI8izfGzv0", "name": "Google Analytics account"}}, "typeVersion": 2}, {"id": "d2062aaa-e41b-4405-8470-9e7b4cd77245", "name": "Summarize Data", "type": "n8n-nodes-base.summarize", "position": [-1080, 300], "parameters": {"options": {}, "fieldsToSummarize": {"values": [{"field": "Aufrufe", "aggregation": "sum"}, {"field": "Nutzer", "aggregation": "sum"}, {"field": "Sitzungen", "aggregation": "sum"}, {"field": "Sitzungen pro Nutzer", "aggregation": "average"}, {"field": "Sitzungsdauer", "aggregation": "average"}, {"field": "Käufe", "aggregation": "sum"}, {"field": "Revenue pro Kauf", "aggregation": "average"}, {"field": "Revenue", "aggregation": "sum"}, {"field": "date"}]}}, "typeVersion": 1}, {"id": "d1f48d36-9f27-4cda-af53-e6d430d1a8db", "name": "Summarize Data1", "type": "n8n-nodes-base.summarize", "position": [-220, 300], "parameters": {"options": {}, "fieldsToSummarize": {"values": [{"field": "Aufrufe", "aggregation": "sum"}, {"field": "Nutzer", "aggregation": "sum"}, {"field": "Sitzungen", "aggregation": "sum"}, {"field": "Sitzungen pro Nutzer", "aggregation": "average"}, {"field": "Sitzungsdauer", "aggregation": "average"}, {"field": "Käufe", "aggregation": "sum"}, {"field": "Revenue pro Kauf", "aggregation": "average"}, {"field": "Revenue", "aggregation": "sum"}, {"field": "date"}]}}, "typeVersion": 1}, {"id": "5b6a0644-3839-4a62-8ff3-bf866aa4568c", "name": "Calculation same period previous year", "type": "n8n-nodes-base.code", "position": [-840, 300], "parameters": {"jsCode": "return {\n // Berechnung des Startdatums: Vorjahr, gleiche Woche, 7 Tage zurück\n startDate: (() => {\n const date = new Date();\n date.setFullYear(date.getFullYear() - 1); // Zurück ins Vorjahr\n date.setDate(date.getDate() - 7); // 7 Tage zurück\n return date.toISOString().split('T')[0];\n })(),\n \n // Berechnung des Enddatums: Vorjahr, heutiges Datum\n endDate: (() => {\n const date = new Date();\n date.setFullYear(date.getFullYear() - 1); // Zurück ins Vorjahr\n return date.toISOString().split('T')[0];\n })(),\n};\n"}, "typeVersion": 2}, {"id": "ab813532-cbe6-4c41-b20b-7efaa1ae4389", "name": "Assign data", "type": "n8n-nodes-base.set", "position": [-1300, 300], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "9c2f8b9a-e964-49a0-8837-efb0dfd7bcae", "name": "Aufrufe", "type": "number", "value": "={{ $json.screenPageViews }}"}, {"id": "8b524518-1268-4971-b5c9-ae7da09d94f9", "name": "Nutzer", "type": "number", "value": "={{ $json.totalUsers }}"}, {"id": "ca7279b9-c643-425f-aa99-cb17146e9994", "name": "Sitzungen", "type": "number", "value": "={{ $json.sessions }}"}, {"id": "591288f7-e8cf-445e-872a-5b83f997b825", "name": "Sitzungen pro Nutzer", "type": "number", "value": "={{ $json.sessionsPerUser }}"}, {"id": "dc1a43da-3f3a-4dca-bbde-904222d7f693", "name": "Sitzungsdauer", "type": "number", "value": "={{ $json.averageSessionDuration }}"}, {"id": "eac0b53e-c452-40b8-92bc-8af8ea349984", "name": "=Käufe", "type": "number", "value": "={{ $json.ecommercePurchases }}"}, {"id": "b96439be-189d-4ebe-b49e-d5c31fefe9f0", "name": "Revenue pro Kauf", "type": "number", "value": "={{ $json.averagePurchaseRevenue }}"}, {"id": "94835d43-2fc8-49c0-97f0-6f0f8699337a", "name": "Revenue", "type": "number", "value": "={{ $json.purchaseRevenue }}"}, {"id": "d70f8138-3b84-4b88-a98f-eb929e1cc29a", "name": "date", "type": "string", "value": "={{ $json.date }}"}]}}, "typeVersion": 3.4}, {"id": "2454fe8a-005d-46dc-ae22-1044c1b793b7", "name": "Assign data1", "type": "n8n-nodes-base.set", "position": [-400, 300], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "9c2f8b9a-e964-49a0-8837-efb0dfd7bcae", "name": "Aufrufe", "type": "number", "value": "={{ $json.screenPageViews }}"}, {"id": "8b524518-1268-4971-b5c9-ae7da09d94f9", "name": "Nutzer", "type": "number", "value": "={{ $json.totalUsers }}"}, {"id": "ca7279b9-c643-425f-aa99-cb17146e9994", "name": "Sitzungen", "type": "number", "value": "={{ $json.sessions }}"}, {"id": "591288f7-e8cf-445e-872a-5b83f997b825", "name": "Sitzungen pro Nutzer", "type": "number", "value": "={{ $json.sessionsPerUser }}"}, {"id": "dc1a43da-3f3a-4dca-bbde-904222d7f693", "name": "Sitzungsdauer", "type": "number", "value": "={{ $json.averageSessionDuration }}"}, {"id": "eac0b53e-c452-40b8-92bc-8af8ea349984", "name": "=Käufe", "type": "number", "value": "={{ $json.ecommercePurchases }}"}, {"id": "b96439be-189d-4ebe-b49e-d5c31fefe9f0", "name": "Revenue pro Kauf", "type": "number", "value": "={{ $json.averagePurchaseRevenue }}"}, {"id": "94835d43-2fc8-49c0-97f0-6f0f8699337a", "name": "Revenue", "type": "number", "value": "={{ $json.purchaseRevenue }}"}, {"id": "dd8255c6-65b1-41ce-b596-70c09108d6e2", "name": "=date", "type": "string", "value": "={{ $json.date }}"}]}}, "typeVersion": 3.4}, {"id": "0a48cbb0-3d4c-4ac8-8dba-08213f7fc430", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [-2220, 80], "parameters": {"width": 440, "height": 560, "content": "Welcome to my Google Analytics Weekly Report Workflow!\n\nThis workflow has the following sequence:\n\n1. time trigger (e.g. every Monday at 7 a.m.)\n2. retrieval of Google Analytics data from the last 7 days\n3. assignment and summary of the data\n4. retrieval of Google Analytics data from the last 7 days of the previous year\n5. allocation and summary of the data\n6. preparation in tabular form and brief analysis by AI.\n7. sending the report as an email\n8. preparation in short form by AI for Telegram (optional)\n9. sending as Telegram message.\n\nThe following accesses are required for the workflow:\n- Google Analytics (via Google Analytics API): https://docs.n8n.io/integrations/builtin/credentials/google/\n- AI API access (e.g. via OpenAI, Anthropic, Google or Ollama)\n- SMTP access data (for sending the mail)\n- Telegram access data (optional for sending as Telegram message): https://docs.n8n.io/integrations/builtin/credentials/telegram/\n\nYou can contact me via LinkedIn, if you have any questions: https://www.linkedin.com/in/friedemann-schuetz"}, "typeVersion": 1}, {"id": "c87bc648-8fe8-4cec-84d4-2742060f9c53", "name": "Processing for email", "type": "@n8n/n8n-nodes-langchain.openAi", "position": [60, 80], "parameters": {"modelId": {"__rl": true, "mode": "list", "value": "gpt-4o", "cachedResultName": "GPT-4O"}, "options": {}, "messages": {"values": [{"content": "=Please analyze the following data and output the results in tabular form:\n\n| Metrics | Last 7 days | Previous year | Percentage change |\n|-------------------------------|---------------|---------|\n| Total page views | {{ $('Summarize Data').item.json.sum_Aufrufe }} | {{ $('Summarize Data1').item.json.sum_Aufrufe }} | Percentage change |\n| total users | {{ $('Summarize Data').item.json.sum_Nutzer }} | {{ $('Summarize Data1').item.json.sum_Nutzer }} | Percentage change |\n| Total sessions | {{ $('Summarize Data').item.json.sum_Sitzungen }} | {{ $('Summarize Data1').item.json.sum_Sitzungen }} | Percentage change |\n| Average sessions/user | {{ $('Summarize Data').item.json.average_Sitzungen_pro_Nutzer }} | {{ $('Summarize Data1').item.json.average_Sitzungen_pro_Nutzer }} | Percentage change |\n| Average session duration | {{ $('Summarize Data').item.json.average_Sitzungsdauer }} | {{ $('Summarize Data1').item.json.average_Sitzungsdauer }} | Percentage change |\n| Total purchases | {{ $('Summarize Data').item.json['sum_Käufe'] }} | {{ $('Summarize Data1').item.json['sum_Käufe'] }} | Percentage change |\n| Average revenue/purchase | {{ $('Summarize Data').item.json.average_Revenue_pro_Kauf }} | {{ $('Summarize Data1').item.json.average_Revenue_pro_Kauf }} | Percentage change |\n| Total revenue | {{ $('Summarize Data').item.json.sum_Revenue }} | {{ $('Summarize Data1').item.json.sum_Revenue }} | Percentage change |\n\nFormat for numbers:\n- Dot (.) for numbers in thousands (e.g. 4,000)\n- Comma (,) for decimal numbers (e.g. 3.4)\n- Conversion of average session duration in minutes instead of seconds\n- Average turnover/purchase and total turnover in €\n\nPlease write a short summary of the analyzed data above the table (in a maximum of 3 sentences!)\n\nPlease format to a sleek and modern HTML format so that the result can be sent as HTML mail!\n\nStructure of the e-mail:\n\n“Hello! Here is the Weekly Report: Google Analytics of the last 7 days!\n[Summary]\n[Table]”"}]}}, "credentials": {"openAiApi": {"id": "niikB3HA4fT5WAqt", "name": "OpenAi account"}}, "typeVersion": 1.7}], "active": false, "settings": {"executionOrder": "v1"}, "versionId": "556c3292-0d40-4c75-8037-90bacf1b2ccb", "connections": {"Telegram": {"main": [[]]}, "Calculator": {"ai_tool": [[{"node": "Processing for email", "type": "ai_tool", "index": 0}]]}, "Assign data": {"main": [[{"node": "Summarize Data", "type": "main", "index": 0}]]}, "Assign data1": {"main": [[{"node": "Summarize Data1", "type": "main", "index": 0}]]}, "Summarize Data": {"main": [[{"node": "Calculation same period previous year", "type": "main", "index": 0}]]}, "Summarize Data1": {"main": [[{"node": "Processing for email", "type": "main", "index": 0}]]}, "Schedule Trigger": {"main": [[{"node": "Google Analytics Letzte 7 Tage", "type": "main", "index": 0}]]}, "Processing for email": {"main": [[{"node": "Send Email", "type": "main", "index": 0}, {"node": "Processing for Telegram", "type": "main", "index": 0}]]}, "Processing for Telegram": {"main": [[{"node": "Telegram", "type": "main", "index": 0}]]}, "Google Analytics Letzte 7 Tage": {"main": [[{"node": "Assign data", "type": "main", "index": 0}]]}, "Calculation same period previous year": {"main": [[{"node": "Google Analytics: Past 7 days of the previous year", "type": "main", "index": 0}]]}, "Google Analytics: Past 7 days of the previous year": {"main": [[{"node": "Assign data1", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
Generating Stripe invoices through the API can be tricky since it requires four steps to generate and send it via email to the customer.
With this workflow you can create Stripe invoices automatically and make Stripe send the invoices to the customer email.
How it works
To generate a Stripe invoice, you need to create a customer, specify the invoice items, create the invoice, and finalize it.
What should be a simple task involves multiple steps.
This workflow simplifies the process by providing everything pre-built for you.
Who is this for?
Anyone who wants to generate invoices automatically and send them to the customer’s email.
Stripe will only send invoices to customers if you generate the invoice correctly through the API.
.
Check out my other templates
👉 https://n8n.io/creators/solomon/
|
{"nodes": [{"id": "75b0894b-fc6b-4e91-afd2-0bc60d04a1a9", "name": "Create Customer", "type": "n8n-nodes-base.stripe", "position": [380, -20], "parameters": {}, "typeVersion": 1}, {"id": "ff65a11c-f5ae-4f89-a747-7e8e2f7af75f", "name": "Stripe | Invoice Items", "type": "n8n-nodes-base.httpRequest", "position": [680, -20], "parameters": {}, "typeVersion": 4.2}, {"id": "3c19382a-adde-45d0-a73d-da2b124d7343", "name": "Stripe | Create invoice", "type": "n8n-nodes-base.httpRequest", "position": [1000, -20], "parameters": {}, "typeVersion": 4.2}, {"id": "8f87207b-68e4-4f17-95fb-95a9a1bf6f77", "name": "Stripe | Finalize invoice", "type": "n8n-nodes-base.httpRequest", "position": [1300, -20], "parameters": {}, "typeVersion": 4.2}, {"id": "0c21fb33-2466-439d-92bf-7b3bdd8e7759", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [-320, -140], "parameters": {}, "typeVersion": 1}, {"id": "739880d6-0faf-49cd-94cf-cff09229b818", "name": "When clicking ‘Test workflow’", "type": "n8n-nodes-base.manualTrigger", "position": [140, -20], "parameters": {}, "typeVersion": 1}, {"id": "eb42c466-213b-4692-948f-d6a6ef3c606c", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [600, 160], "parameters": {}, "typeVersion": 1}, {"id": "0b0d6e87-91b3-4e9b-910d-d531f5d394c3", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [920, 160], "parameters": {}, "typeVersion": 1}, {"id": "c6bee5f2-f19b-4349-941d-643cee7fa46c", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [1240, 160], "parameters": {}, "typeVersion": 1}], "connections": {"Create Customer": {"main": [[{"node": "Stripe | Invoice Items", "type": "main", "index": 0}]]}, "Stripe | Invoice Items": {"main": [[{"node": "Stripe | Create invoice", "type": "main", "index": 0}]]}, "Stripe | Create invoice": {"main": [[{"node": "Stripe | Finalize invoice", "type": "main", "index": 0}]]}, "When clicking ‘Test workflow’": {"main": [[{"node": "Create Customer", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
Analyze Emails for Security Insights
Who is this for?
This workflow is ideal for security teams, IT Ops professionals, and managed service providers (MSPs) responsible for monitoring and validating email traffic. It’s especially useful for organizations that need to identify potential phishing attempts, spam, or compromised accounts by analyzing email headers and IP reputation.
What problem is this workflow solving?
This workflow helps identify malicious or suspicious emails by verifying email authentication headers (SPF, DKIM, DMARC) and analyzing the reputation of the originating IP address. By automating these checks, it reduces manual analysis time and flags potential threats efficiently.
What this workflow does
Email Monitoring:** Polls a specified Microsoft Outlook folder for new emails in real-time.
Header Analysis:** Retrieves and processes email headers to extract critical information such as authentication results and the sender’s IP address.
IP Reputation Check:** Leverages external APIs (IP Quality Score and IP-API) to analyze the originating IP for potential spam or malicious activity.
Authentication Validation:** Validates SPF, DKIM, and DMARC headers, determining if the email passes industry-standard authentication protocols.
Data Aggregation and Reporting:** Combines all analyzed data into a unified format, ready for reporting or integration into downstream systems.
Webhook Integration:** Outputs the findings via a webhook, enabling integration with alerting tools or security information and event management (SIEM) platforms.
Setup
Connect to Outlook:
Configure the Microsoft Outlook trigger node with valid OAuth2 credentials.
Specify the email folder to monitor for new messages.
API Keys (Optional):
Obtain an API key for IP Quality Score (https://ipqualityscore.com).
Ensure the IP-API endpoint is accessible.
This step is optional as ipqualityscore.com will provide a limited number of free lookups each month. See more details here.
Webhook Configuration:
Set up a webhook endpoint to receive the output of the workflow.
Optional Adjustments:
Customize polling intervals in the trigger node.
Modify header filters or extend the validation logic as needed.
How to customize this workflow to your needs
Add Alerts:** Use the Respond to Webhook node to trigger notifications in Slack, email, or any other communication channel.
Integrate with SIEM:** Forward the workflow output to SIEM tools like Splunk or ELK Stack for further analysis.
Modify Validation Rules:** Update SPF, DKIM, or DMARC logic in the Set nodes to align with your organization’s security policies.
Expand IP Analysis:** Add more APIs or services to enrich IP reputation data, such as VirusTotal or AbuseIPDB.
This workflow provides a robust foundation for email security monitoring and can be tailored to fit your organization's unique requirements. With its modular design and integration options, it’s a versatile tool to enhance your cybersecurity operations.
|
{"meta": {"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"}, "nodes": [{"id": "363be6de-5e8d-46b2-a31f-6f7bc204c986", "name": "Trigger on New Email", "type": "n8n-nodes-base.microsoftOutlookTrigger", "disabled": true, "position": [-760, 1400], "parameters": {"output": "raw", "filters": {"foldersToInclude": ["AQMkADM5MWVmZWEwLTQ4OTMtNGMyYy1iOWUxLTQ4N2M1YmU0ODJjNQAuAAADWJOZOf0oRkGpsGIMN2VBCwEAbttrza1gUEiEMFJJPqIeZQAAAgEMAAAA"]}, "options": {}, "pollTimes": {"item": [{"mode": "everyMinute"}]}}, "credentials": {"microsoftOutlookOAuth2Api": {"id": "vTCK0oVQ0WjFrI5H", "name": "Outlook Credential"}}, "typeVersion": 1}, {"id": "0da8b1ab-6dbe-41b7-92f1-6e8637d082cb", "name": "Retrieve Headers of Email", "type": "n8n-nodes-base.httpRequest", "position": [-560, 1400], "parameters": {"url": "=https://graph.microsoft.com/v1.0/me/messages/{{ $json.id }}?$select=internetMessageHeaders", "options": {}, "sendHeaders": true, "authentication": "predefinedCredentialType", "headerParameters": {"parameters": [{"name": "Accept", "value": "application/json"}]}, "nodeCredentialType": "microsoftOutlookOAuth2Api"}, "credentials": {"microsoftOutlookOAuth2Api": {"id": "vTCK0oVQ0WjFrI5H", "name": "Outlook Credential"}}, "typeVersion": 4.2}, {"id": "2f28e47d-f010-4f0b-bbe4-074bbdf39a45", "name": "Extract Received Headers", "type": "n8n-nodes-base.code", "position": [80, 1460], "parameters": {"jsCode": "// Extract the headers array from the JSON\nconst headers = $('Set Headers').item.json.headers;\n\n// Filter headers where the name is \"Received\"\nconst receivedHeaders = headers.filter(header => header.name === \"Received\");\n\n// Return the filtered headers\nreturn receivedHeaders;\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "530fd9c3-94c2-4d5e-a686-57738cc10ae6", "name": "Remove Extra Received Headers", "type": "n8n-nodes-base.limit", "position": [300, 1460], "parameters": {"keep": "lastItems"}, "typeVersion": 1}, {"id": "9942704e-e0ac-42e9-b714-b2bdb3117c02", "name": "Extract Original From IP", "type": "n8n-nodes-base.set", "position": [500, 1460], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "5f740d1f-de62-4fe0-aa20-625063344c07", "name": "extractedfromip", "type": "string", "value": "={{ $json.value.replace(/\\b(127\\.(?:\\d{1,3}\\.){2}\\d{1,3})|(10\\.(?:\\d{1,3}\\.){2}\\d{1,3})|(172\\.(?:1[6-9]|2[0-9]|3[0-1])\\.\\d{1,3}\\.\\d{1,3})|(192\\.168\\.\\d{1,3}\\.\\d{1,3})\\b/g, \"\").match(/(\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:)))(%.+)?\\s*)|(\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b)/)[0] }}"}]}}, "typeVersion": 3.4}, {"id": "6093bcd2-1101-4685-8d2c-751dd451afc4", "name": "Query IP Quality Score API", "type": "n8n-nodes-base.httpRequest", "position": [980, 1360], "parameters": {"url": "=https://ipqualityscore.com/api/json/ip/Mlg6aZdzI1mVehUD3Z5Ak5Vl4yNN7P8v/{{ $('Extract Original From IP').item.json.extractedfromip }}?strictness=1&allow_public_access_points=true&lighter_penalties=true", "options": {}}, "typeVersion": 4.2}, {"id": "feb4203c-4f9b-456c-9640-82ce8f6f550f", "name": "Query IP API", "type": "n8n-nodes-base.httpRequest", "position": [1180, 1360], "parameters": {"url": "=http://ip-api.com/json/{{ $('Extract Original From IP').item.json.extractedfromip }}", "options": {}}, "typeVersion": 4.2}, {"id": "f628e421-4cb5-4612-83c2-bde0f4f57367", "name": "Authentication-Results Header?", "type": "n8n-nodes-base.if", "position": [1440, 1600], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "ead2b640-ad80-4189-a692-ae454723fd85", "operator": {"type": "boolean", "operation": "true", "singleValue": true}, "leftValue": "={{ $('Set Headers').item.json.headers.some(header => header.name === \"Authentication-Results\") }}", "rightValue": "true"}]}}, "typeVersion": 2.2}, {"id": "8616ecd3-1c71-49ff-a32c-4b09f3214edb", "name": "Extract Authentication-Results Header", "type": "n8n-nodes-base.code", "position": [1720, 1360], "parameters": {"jsCode": "// Extract the headers array from the JSON\nconst headers = $('Set Headers').item.json.headers;\n\n// Filter headers where the name is \"Received\"\nconst receivedHeaders = headers.filter(header => header.name === \"Authentication-Results\");\n\n// Return the filtered headers\nreturn receivedHeaders;\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "7d3a37dc-6bbe-4c3b-9c2c-c9d2c1c24213", "name": "Received-SPF Header?", "type": "n8n-nodes-base.if", "position": [1700, 2220], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "a38ebc9b-f896-4432-81fb-4f3db98f3409", "operator": {"type": "boolean", "operation": "true", "singleValue": true}, "leftValue": "={{ $('Set Headers').item.json.headers.some(header => header.name === \"Received-SPF\") }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "f1ca55fb-07d8-4825-8850-f5a3c58e358a", "name": "DKIM-Signature Header?", "type": "n8n-nodes-base.if", "position": [1700, 2620], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "a38ebc9b-f896-4432-81fb-4f3db98f3409", "operator": {"type": "boolean", "operation": "true", "singleValue": true}, "leftValue": "={{ $('Set Headers').item.json.headers.some(header => header.name === \"DKIM-Signature\") }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "df19f38c-b263-4b97-bd22-adc8ff44f631", "name": "Set SPF Value", "type": "n8n-nodes-base.set", "position": [2480, 2140], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "179c48eb-97e5-48ab-82b8-ef4269f11366", "name": "spfvalue", "type": "string", "value": "={{ $json.data.last().value.toLowerCase().includes('fail') ? \"fail\" : $json.data.last().value.toLowerCase().includes('pass') ? \"pass\" : \"unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "1613d276-3ec4-44b2-91ca-f76985e1b4c2", "name": "Extract Received-SPF Header", "type": "n8n-nodes-base.code", "position": [1940, 2140], "parameters": {"jsCode": "// Extract the headers array from the JSON\nconst headers = $('Set Headers').item.json.headers;\n\n// Filter headers where the name is \"Received\"\nconst receivedHeaders = headers.filter(header => header.name === \"Received-SPF\");\n\n// Return the filtered headers\nreturn receivedHeaders;\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "47697f60-99e7-4c91-ab7c-7f966b1b5307", "name": "DKIM Signature Found", "type": "n8n-nodes-base.set", "position": [2480, 2520], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "dkimvalue", "type": "string", "value": "=found"}]}}, "typeVersion": 3.4}, {"id": "2383e7b4-fe13-4c36-80a3-67ba3f02ce1d", "name": "DMARC Header?", "type": "n8n-nodes-base.if", "position": [1700, 3060], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "a38ebc9b-f896-4432-81fb-4f3db98f3409", "operator": {"type": "boolean", "operation": "true", "singleValue": true}, "leftValue": "={{ $('Set Headers').item.json.headers.some(header => header.name === \"dmarc\") }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "2c41e06d-0dc1-474e-a13f-302fc3e4d4ad", "name": "No DMARC Header", "type": "n8n-nodes-base.set", "position": [2480, 3160], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "dmarcvalue", "type": "string", "value": "=not found"}]}}, "typeVersion": 3.4}, {"id": "81bd5082-634b-4f0e-951f-1374573fc6c0", "name": "Extract DMARC Header", "type": "n8n-nodes-base.code", "position": [2120, 2960], "parameters": {"jsCode": "// Extract the headers array from the JSON\nconst headers = $('Set Headers').item.json.headers;\n\n// Filter headers where the name is \"Received\"\nconst receivedHeaders = headers.filter(header => header.name === \"dmarc\");\n\n// Return the filtered headers\nreturn receivedHeaders;\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "55a5745c-2c73-492c-b63c-20936043b0b6", "name": "Set DMARC Value", "type": "n8n-nodes-base.set", "position": [2480, 2960], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "179c48eb-97e5-48ab-82b8-ef4269f11366", "name": "spfvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('pass') ? \"pass\" : $json.value.toLowerCase().includes('fail') ? \"fail\" : \"unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "48a5b283-7aa4-4e10-b784-fcce25465fc0", "name": "Original IP Found?", "type": "n8n-nodes-base.if", "position": [700, 1460], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "1c27e7ba-d243-4673-b1cc-608c35951168", "operator": {"type": "boolean", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ $json.extractedfromip?.toBoolean() }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "75818bdc-3ffb-42a7-a0a3-93fc413b757f", "name": "No DKIM Signature Found", "type": "n8n-nodes-base.set", "position": [2480, 2720], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "dkimvalue", "type": "string", "value": "not found"}]}}, "typeVersion": 3.4}, {"id": "17bc160b-618f-4893-80c8-4e4c2638adc3", "name": "Determine Auth Values", "type": "n8n-nodes-base.set", "position": [2040, 1360], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "cd0b3f49-fe38-4686-a1f5-bc03a145adef", "name": "spfvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('spf=pass') ? \"pass\" : $json.value.toLowerCase().includes('spf=fail') ? \"fail\" : $json.value.toLowerCase().includes('spf=neutral') ? \"neutral\" : \"unknown\" }}"}, {"id": "6aa90f4d-773e-475f-8cbc-fe5c4fe93653", "name": "dkimvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('dkim=pass') ? \"pass\" : $json.value.toLowerCase().includes('dkim=fail') ? \"fail\" : $json.value.toLowerCase().includes('dkim=temperror') ? \"error\" : \"unknown\" }}"}, {"id": "d3b7b0c1-0680-4cb9-b376-d365e5602a29", "name": "dmarcvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('dmarc=pass') ? \"pass\" : $json.value.toLowerCase().includes('dmarc=fail') ? \"fail\" : \"unknown\" }}"}]}}, "typeVersion": 3.4}, {"id": "8ee70aff-0907-44f5-b675-1de26660c2e3", "name": "No SPF Found", "type": "n8n-nodes-base.set", "position": [2480, 2320], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "spfvalue", "type": "string", "value": "not found"}]}}, "typeVersion": 3.4}, {"id": "a658b7d1-ec0e-40c9-a6c6-1f81e776fcfb", "name": "Merge", "type": "n8n-nodes-base.merge", "position": [2840, 1600], "parameters": {"numberInputs": 3}, "typeVersion": 3}, {"id": "bb688aec-d7ae-4e5a-ac38-a8d9554966bd", "name": "Aggregate", "type": "n8n-nodes-base.aggregate", "position": [3000, 1600], "parameters": {"options": {}, "aggregate": "aggregateAllItemData"}, "typeVersion": 1}, {"id": "e393c3b1-b756-44a8-ac3c-b2d9e15f4f47", "name": "No Operation, do nothing", "type": "n8n-nodes-base.noOp", "position": [980, 1600], "parameters": {}, "typeVersion": 1}, {"id": "d651412c-9e58-4ef6-a6eb-6556647a7223", "name": "Format Webhook Output", "type": "n8n-nodes-base.set", "position": [3400, 1460], "parameters": {"options": {}, "assignments": {"assignments": []}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "03c70339-8e92-4d62-b346-7e669c83d338", "name": "Format Individual Auth Outputs", "type": "n8n-nodes-base.set", "position": [3180, 1600], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "1f466a9d-e8a1-4095-918c-89fd8e3dae57", "name": "spf", "type": "string", "value": "={{ $json.data[0].spfvalue }}"}, {"id": "797b0e35-9a2e-4261-8741-a8d636e0d1ae", "name": "dkim", "type": "string", "value": "={{ $json.data[1].dkimvalue }}"}, {"id": "8b6f9dda-081d-45b6-98a9-04a96642800b", "name": "dmarc", "type": "string", "value": "={{ $json.data[2].dmarcvalue }}"}, {"id": "6d24a794-0d06-4f12-8bfb-cc3c71720a1b", "name": "initialIP", "type": "string", "value": "={{ $('Extract Original From IP').item.json.extractedfromip || 'Originating IP Not Found'}}"}, {"id": "e9ec6f54-0ef7-451b-bbeb-8bb9291e4bcd", "name": "organization", "type": "string", "value": "={{ $('Query IP API').item.json.org || \"No Organization Found\" }}"}, {"id": "719b8414-72e1-4916-855b-00abdfc8e776", "name": "country", "type": "string", "value": "={{ $('Query IP API').item.json.country || \"No Country Found\" }}"}, {"id": "ab0dc08c-ba54-4e2c-b4df-9f23d36cb350", "name": "city", "type": "string", "value": "={{ $('Query IP API').item.json.city || \"No City Found\" }}"}, {"id": "f8214eea-dfb6-4fe1-8e45-e0b8d3d44ee3", "name": "recentSpamActivity", "type": "string", "value": "={{ $('Query IP Quality Score API').item.json.fraud_score>=85 ? \"Identified spam in the last 48 hours\" : $('Query IP Quality Score API').item.json.fraud_score>=75 ? \"Identified spam in the last month\" : \"Not associated with recent spam\" }}"}, {"id": "fe3488b2-ad00-45ad-b947-ca2dc4242363", "name": "ipSenderReputation", "type": "string", "value": "={{ $('Query IP Quality Score API').item.json.fraud_score>=85 ? \"Bad\" : $('Query IP Quality Score API').item.json.fraud_score>=75 ? \"Poor\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=50 ? \"Suspicious\" : $('Query IP Quality Score API').item.json.fraud_score>=11 ? \"OK\" : $('Query IP Quality Score API').item.json.fraud_score<11 ? \"Good\" : \"Unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "762153b7-0364-498f-9dba-547d676b9d74", "name": "Format Combined Auth Output", "type": "n8n-nodes-base.set", "position": [2400, 1360], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "1f466a9d-e8a1-4095-918c-89fd8e3dae57", "name": "spf", "type": "string", "value": "={{ $json.spfvalue }}"}, {"id": "797b0e35-9a2e-4261-8741-a8d636e0d1ae", "name": "dkim", "type": "string", "value": "={{ $json.dkimvalue }}"}, {"id": "8b6f9dda-081d-45b6-98a9-04a96642800b", "name": "dmarc", "type": "string", "value": "={{ $json.dmarcvalue }}"}, {"id": "6d24a794-0d06-4f12-8bfb-cc3c71720a1b", "name": "initialIP", "type": "string", "value": "={{ $('Extract Original From IP').item.json.extractedfromip || 'Originating IP Not Found'}}"}, {"id": "e9ec6f54-0ef7-451b-bbeb-8bb9291e4bcd", "name": "organization", "type": "string", "value": "={{ $('Query IP API').item.json.org || \"No Organization Found\" }}"}, {"id": "719b8414-72e1-4916-855b-00abdfc8e776", "name": "country", "type": "string", "value": "={{ $('Query IP API').item.json.country || \"No Country Found\" }}"}, {"id": "ab0dc08c-ba54-4e2c-b4df-9f23d36cb350", "name": "city", "type": "string", "value": "={{ $('Query IP API').item.json.city || \"No City Found\" }}"}, {"id": "f8214eea-dfb6-4fe1-8e45-e0b8d3d44ee3", "name": "recentSpamActivity", "type": "string", "value": "={{ $('Query IP Quality Score API').item.json.fraud_score>=85 ? \"Identified spam in the last 48 hours\" : $('Query IP Quality Score API').item.json.fraud_score>=75 ? \"Identified spam in the last month\" : \"Not associated with recent spam\" }}"}, {"id": "fe3488b2-ad00-45ad-b947-ca2dc4242363", "name": "ipSenderReputation", "type": "string", "value": "={{ $('Query IP Quality Score API').item.json.fraud_score>=85 ? \"Bad\" : $('Query IP Quality Score API').item.json.fraud_score>=75 ? \"Poor\" : $('Query IP Quality Score API').item.json.fraud_score>=50 ? \"Suspicious\" : $('Query IP Quality Score API').item.json.fraud_score>=11 ? \"OK\" : $('Query IP Quality Score API').item.json.fraud_score<11 ? \"Good\" : \"Unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "391615b6-4996-4687-a07c-3f9af1246840", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "position": [3620, 1460], "parameters": {"options": {}}, "typeVersion": 1.1}, {"id": "ff28eb77-d095-440e-a95f-9f3727a3c219", "name": "Webhook1", "type": "n8n-nodes-base.webhook", "position": [-780, 2140], "webhookId": "da28e0c6-ebe2-43e7-92fe-dde3278746a9", "parameters": {"path": "da28e0c6-ebe2-43e7-92fe-dde3278746a8", "options": {}, "httpMethod": "POST", "responseMode": "responseNode"}, "typeVersion": 2}, {"id": "80d4ce98-c26b-4f14-9058-6dda098f4f14", "name": "Set Headers", "type": "n8n-nodes-base.set", "position": [-100, 1460], "parameters": {"options": {}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "fddadcd8-ecaf-4fb3-bd38-12d6e48124be", "name": "Aggregate Received-SPF Headers", "type": "n8n-nodes-base.aggregate", "position": [2140, 2140], "parameters": {"options": {}, "aggregate": "aggregateAllItemData"}, "typeVersion": 1}, {"id": "175f81f1-f5ff-4170-9496-7adae5351ff4", "name": "Set Headers Here", "type": "n8n-nodes-base.set", "position": [-360, 1400], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "5bf15ec1-a009-4473-a3da-fca15a6cd29a", "name": "headers", "type": "array", "value": "={{ $json.internetMessageHeaders }}"}]}}, "typeVersion": 3.4}, {"id": "6aa1040e-1c57-4ef3-9a06-9e25ca66247f", "name": "Set Webhook Headers Here", "type": "n8n-nodes-base.set", "position": [-380, 2140], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "80d3bf91-ce79-44b7-b8d6-a612ef810891", "name": "headers", "type": "array", "value": "={{ $json.body.headers }}"}]}}, "typeVersion": 3.4}, {"id": "6d177ff6-333f-40af-87ee-28f5808b90b6", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [-840, 849.3566000559811], "parameters": {"color": 7, "width": 635.6437587743126, "height": 738.7992581051316, "content": "\n## **Testing Email Header Analysis Workflow**\n\nThis section of the workflow is designed for testing purposes to ensure that the setup functions correctly with your Outlook email client before deploying it as an API for third-party platforms. The process begins with the `Trigger on New Email` node, which monitors a specified folder in your Outlook mailbox and triggers the workflow whenever a new email arrives. Configured to poll every minute, it ensures timely detection and processing of incoming emails.\n\nOnce an email is detected, the `Retrieve Headers of Email` node uses the Microsoft Graph API to fetch the detailed headers of the new email. These headers contain critical metadata, such as routing information and authentication results, essential for the analysis of the email's origin and legitimacy.\n\nFinally, the `Set Headers Here` node extracts and organizes the email headers into a standardized format as an array called `headers`. This structured format prepares the email data for further processing in the subsequent sections of the workflow. By validating these steps, you can confirm the workflow is functioning correctly before integrating it into broader use cases."}, "typeVersion": 1}, {"id": "4347e3ac-6268-4f47-9ffa-d6cfdb9db6fe", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [-840, 1597.2834217449708], "parameters": {"color": 7, "width": 635.6437587743126, "height": 722.658386273084, "content": "\n## **Webhook Integration for Production**\n\nThis section transitions the workflow into production, enabling it to function as an API for analyzing email headers received from third-party platforms. To utilize this webhook functionality, it is essential to **activate the workflow**, as the webhook will only respond when the workflow is live.\n\nThe `Webhook1` node listens for incoming HTTP POST requests at the specified path. When the webhook is triggered, it receives and processes the payload containing email data, including headers sent by the third-party platform. This enables the workflow to operate dynamically with external systems.\n\nThe `Set Webhook Headers Here` node takes the received email data and extracts the `headers` array from the payload's body. This ensures the incoming data is formatted correctly and ready for further processing in subsequent steps of the workflow.\n\nBy activating the workflow and integrating it with external systems, users can automate the analysis of email headers seamlessly in a production environment."}, "typeVersion": 1}, {"id": "166afae1-13f7-4c61-b605-751e2692f272", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [-195.35026277953466, 1001.1991904481583], "parameters": {"color": 7, "width": 869.3564073187465, "height": 626.9566677129526, "content": "\n## **Extract and Process Email Headers**\n\nThis section processes the headers from incoming email data to extract critical information, particularly focusing on the originating IP address. The workflow begins with the `Set Headers` node, which takes the headers provided from the previous nodes and prepares them for analysis.\n\nThe `Extract Received Headers` node filters through the headers and isolates those labeled as \"Received.\" These headers document the servers through which the email has passed, providing a traceable path of its journey. Next, the `Remove Extra Received Headers` node narrows the focus to the most recent \"Received\" header, which typically contains the originating IP address of the email sender.\n\nUsing the `Extract Original From IP` node, the workflow applies a regular expression to extract the IP address from the retained header, removing any internal or private IP addresses that might be present. This ensures that only the relevant external IP address is identified."}, "typeVersion": 1}, {"id": "a676cc11-c48d-4160-a60f-5a2cce1ecc94", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [686.9090848322476, 800.8639469405958], "parameters": {"color": 7, "width": 922.1859426288208, "height": 965.2875565450952, "content": "\n## **Analyze IP Address and Check Authentication Results**\n\nThis section focuses on analyzing the originating IP address and verifying the presence of essential email authentication headers. The workflow begins with the `Original IP Found?` node, which evaluates whether the extracted IP address is valid and non-empty. If a valid IP address is found, the workflow proceeds; otherwise, it triggers the `No Operation, do nothing` node to halt further processing.\n\nThe `Query IP Quality Score API` node interacts with the IP Quality Score service, evaluating the IP’s reputation. This analysis identifies whether the IP is associated with spam, fraud, or other malicious activities. The results help determine the sender's trustworthiness.\n\nNext, the `Query IP API` node provides additional contextual information about the IP address, including geographical details (e.g., country, city) and the organization associated with the IP. This information enriches the analysis, offering insights into the sender’s origin.\n\nThe `Authentication-Results Header?` node checks for the presence of the \"Authentication-Results\" header in the email. This header indicates the results of SPF, DKIM, and DMARC checks performed by the receiving email server. If present, the workflow proceeds to analyze the header further in subsequent sections.\n\nBy validating the IP address and analyzing its reputation, this section ensures a comprehensive understanding of the email's legitimacy before moving forward in the workflow."}, "typeVersion": 1}, {"id": "999b7855-b515-45b7-a560-55882555a2c2", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [1622.1779104636253, 911.7549500344078], "parameters": {"color": 7, "width": 1016.1357697283069, "height": 619.3441192962306, "content": "\n## **Extract and Evaluate Authentication Results**\n\nIf the header is found, the workflow proceeds to the `Extract Authentication-Results Header` node, which isolates the relevant header and extracts its contents. This allows the workflow to parse the authentication results systematically.\n\nNext, the `Determine Auth Values` node processes the extracted data, determining the status of SPF, DKIM, and DMARC. It categorizes each result as `pass`, `fail`, `neutral`, `error`, or `unknown` based on the information present in the header. This step ensures a clear understanding of the email's adherence to authentication protocols.\n\nFinally, the `Format Combined Auth Output` node aggregates the authentication results with other relevant metadata, such as the originating IP, sender's organization, and geographical location, obtained from previous steps. Additionally, it evaluates the IP's reputation and recent spam activity using the data from the IP Quality Score API. This structured output provides a comprehensive overview of the email's security and legitimacy, making it ready for integration with external systems or reporting tools."}, "typeVersion": 1}, {"id": "f2fefb66-8325-4d00-932b-292b353f7b2f", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [2660, 890.7472796133279], "parameters": {"color": 7, "width": 1285.8545784346588, "height": 909.4741259295762, "content": "\n## **Combine Results and Respond to Webhook**\n\nThis final section consolidates the results from previous nodes and prepares the data for delivery via a webhook response. It ensures all authentication checks and metadata are aggregated into a cohesive output.\n\nThe process begins with the `Merge` node, which combines data streams from SPF, DKIM, and DMARC evaluations. The aggregated data is then processed by the `Aggregate` node, which organizes the results into a unified dataset.\n\nNext, the `Format Individual Auth Outputs` node formats the consolidated data into a structured JSON object. This output includes the SPF, DKIM, and DMARC results, as well as additional metadata such as the originating IP address, sender’s organization, geographical location, IP reputation, and recent spam activity. Each field is clearly labeled to ensure compatibility with external systems.\n\nThe formatted output is passed to the `Format Webhook Output` node, which finalizes the response structure for the webhook. The `Respond to Webhook` node then sends this structured response back to the calling system. This enables seamless integration with third-party platforms, allowing them to use the results for further analysis or automation.\n\nBy combining and formatting all authentication data, this section ensures that the workflow delivers clear, actionable insights to the consuming system, completing the email analysis pipeline."}, "typeVersion": 1}, {"id": "4c2592a3-3550-428c-9622-b1e95ad28d4f", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [1620, 1540], "parameters": {"color": 7, "width": 1016.1357697283069, "height": 1788.2607166792513, "content": "\n## **Evaluate SPF, DKIM, and DMARC Compliance**\n\nThis section focuses on detailed analysis and validation of SPF, DKIM, and DMARC headers. Each authentication mechanism is evaluated to determine its status, providing critical insights into the email’s legitimacy and adherence to security protocols.\n\nThe workflow begins with the `Received-SPF Header?` node, which checks if the \"Received-SPF\" header exists. If found, the workflow proceeds to the `Extract Received-SPF Header` node to isolate the SPF validation results. These results are aggregated and analyzed using the `Aggregate Received-SPF Headers` node, with the final outcome recorded by the `Set SPF Value` node. If no SPF header is found, the workflow instead records this absence using the `No SPF Found` node.\n\nThe `DKIM-Signature Header?` node performs a similar function for DKIM validation, checking for the presence of a DKIM signature. If the header is found, the `DKIM Signature Found` node confirms its presence, while the `No DKIM Signature Found` node handles its absence.\n\nThe `DMARC Header?` node checks for the presence of a DMARC header, indicating compliance with the domain’s published DMARC policy. If present, the workflow extracts and evaluates it via the `Extract DMARC Header` and `Set DMARC Value` nodes. If the header is missing, the `No DMARC Header` node records this information.\n\nBy systematically evaluating these headers, the workflow provides a comprehensive understanding of the email's authentication status. This granular analysis strengthens email security by detecting potential spoofing or misconfigurations in the sender’s authentication setup."}, "typeVersion": 1}], "connections": {"Merge": {"main": [[{"node": "Aggregate", "type": "main", "index": 0}]]}, "Webhook1": {"main": [[{"node": "Set Webhook Headers Here", "type": "main", "index": 0}]]}, "Aggregate": {"main": [[{"node": "Format Individual Auth Outputs", "type": "main", "index": 0}]]}, "Set Headers": {"main": [[{"node": "Extract Received Headers", "type": "main", "index": 0}]]}, "No SPF Found": {"main": [[{"node": "Merge", "type": "main", "index": 0}]]}, "Query IP API": {"main": [[{"node": "Authentication-Results Header?", "type": "main", "index": 0}]]}, "DMARC Header?": {"main": [[{"node": "Extract DMARC Header", "type": "main", "index": 0}], [{"node": "No DMARC Header", "type": "main", "index": 0}]]}, "Set SPF Value": {"main": [[{"node": "Merge", "type": "main", "index": 0}]]}, "No DMARC Header": {"main": [[{"node": "Merge", "type": "main", "index": 2}]]}, "Set DMARC Value": {"main": [[{"node": "Merge", "type": "main", "index": 2}]]}, "Set Headers Here": {"main": [[{"node": "Set Headers", "type": "main", "index": 0}]]}, "Original IP Found?": {"main": [[{"node": "Query IP Quality Score API", "type": "main", "index": 0}], [{"node": "No Operation, do nothing", "type": "main", "index": 0}]]}, "DKIM Signature Found": {"main": [[{"node": "Merge", "type": "main", "index": 1}]]}, "Extract DMARC Header": {"main": [[{"node": "Set DMARC Value", "type": "main", "index": 0}]]}, "Received-SPF Header?": {"main": [[{"node": "Extract Received-SPF Header", "type": "main", "index": 0}], [{"node": "No SPF Found", "type": "main", "index": 0}]]}, "Trigger on New Email": {"main": [[{"node": "Retrieve Headers of Email", "type": "main", "index": 0}]]}, "Determine Auth Values": {"main": [[{"node": "Format Combined Auth Output", "type": "main", "index": 0}]]}, "Format Webhook Output": {"main": [[{"node": "Respond to Webhook", "type": "main", "index": 0}]]}, "DKIM-Signature Header?": {"main": [[{"node": "DKIM Signature Found", "type": "main", "index": 0}], [{"node": "No DKIM Signature Found", "type": "main", "index": 0}]]}, "No DKIM Signature Found": {"main": [[{"node": "Merge", "type": "main", "index": 1}]]}, "Extract Original From IP": {"main": [[{"node": "Original IP Found?", "type": "main", "index": 0}]]}, "Extract Received Headers": {"main": [[{"node": "Remove Extra Received Headers", "type": "main", "index": 0}]]}, "No Operation, do nothing": {"main": [[{"node": "Authentication-Results Header?", "type": "main", "index": 0}]]}, "Set Webhook Headers Here": {"main": [[{"node": "Set Headers", "type": "main", "index": 0}]]}, "Retrieve Headers of Email": {"main": [[{"node": "Set Headers Here", "type": "main", "index": 0}]]}, "Query IP Quality Score API": {"main": [[{"node": "Query IP API", "type": "main", "index": 0}]]}, "Extract Received-SPF Header": {"main": [[{"node": "Aggregate Received-SPF Headers", "type": "main", "index": 0}]]}, "Format Combined Auth Output": {"main": [[{"node": "Format Webhook Output", "type": "main", "index": 0}]]}, "Remove Extra Received Headers": {"main": [[{"node": "Extract Original From IP", "type": "main", "index": 0}]]}, "Aggregate Received-SPF Headers": {"main": [[{"node": "Set SPF Value", "type": "main", "index": 0}]]}, "Authentication-Results Header?": {"main": [[{"node": "Extract Authentication-Results Header", "type": "main", "index": 0}], [{"node": "Received-SPF Header?", "type": "main", "index": 0}, {"node": "DKIM-Signature Header?", "type": "main", "index": 0}, {"node": "DMARC Header?", "type": "main", "index": 0}]]}, "Format Individual Auth Outputs": {"main": [[{"node": "Format Webhook Output", "type": "main", "index": 0}]]}, "Extract Authentication-Results Header": {"main": [[{"node": "Determine Auth Values", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
Analyze Emails for Security Insights
Who is this for?
This workflow is ideal for IT professionals, security analysts, and organizations looking to enhance their email security practices. It is particularly useful for those who need to analyze Gmail email headers for IP tracking, spoofing detection, and sender reputation assessment.
What problem is this workflow solving?
Email spoofing and phishing attacks are significant cybersecurity threats. By analyzing email headers, this workflow provides detailed insights into the email's origin, authentication status, and the reputation of the sending IP address. It helps detect potential spoofing attempts and assess the trustworthiness of incoming emails.
What this workflow does
This n8n workflow automates the process of analyzing email headers received in Gmail. It performs the following key functions:
Triggering and Email Header Extraction: It monitors Gmail inboxes for new emails and extracts their headers for analysis.
Authentication Analysis: It validates SPF, DKIM, and DMARC authentication results to ensure the email adheres to industry-standard security protocols.
IP Analysis: The workflow extracts the originating IP address and evaluates its reputation and geographic details using external APIs.
Reputation Scoring: It integrates with IP Quality Score to detect spam activity and assess the sender's reputation.
Consolidation and Webhook Response: All results are aggregated into a single JSON response, making it easy to integrate with third-party platforms or tools for further automation.
Setup
Authenticate Gmail: Configure the Gmail Trigger node with your Gmail account credentials.
API Keys (Optional):
Obtain an API key for IP Quality Score (https://ipqualityscore.com).
Ensure the IP-API endpoint is accessible.
This step is optional as ipqualityscore.com will provide a limited number of free lookups each month. See more details here.
Activate the Workflow: Ensure the workflow is active to process incoming emails in real-time.
How to customize this workflow to your needs
Add Alerts:** Use the Gmail - Respond to Webhook node to trigger notifications in Slack, email, or any other communication channel.
Integrate with SIEM:** Forward the workflow output to SIEM tools like Splunk or ELK Stack for further analysis.
Modify Validation Rules:** Update SPF, DKIM, or DMARC logic in the Set nodes to align with your organization’s security policies.
Expand IP Analysis:** Add more APIs or services to enrich IP reputation data, such as VirusTotal or AbuseIPDB.
This workflow provides a robust foundation for email security monitoring and can be tailored to fit your organization's unique requirements. With its modular design and integration options, it’s a versatile tool to enhance your cybersecurity operations.
|
{"meta": {"instanceId": "03e9d14e9196363fe7191ce21dc0bb17387a6e755dcc9acc4f5904752919dca8"}, "nodes": [{"id": "05096721-e15a-4d2a-83b3-3b31d6435c59", "name": "Gmail Trigger", "type": "n8n-nodes-base.gmailTrigger", "disabled": true, "position": [-680, -140], "parameters": {"simple": false, "filters": {}, "options": {}, "pollTimes": {"item": [{"mode": "everyMinute"}]}}, "credentials": {"gmailOAuth2": {"id": "kkhNhqKpZt6IUZd0", "name": "Gmail"}}, "typeVersion": 1.2}, {"id": "9eb59c41-fa15-45ee-b343-cf30ac058600", "name": "Gmail - Extract Received Headers", "type": "n8n-nodes-base.code", "position": [200, -80], "parameters": {"jsCode": "// Extract the headers object from the JSON\nconst headers = $('Gmail - Set Headers').item.json.headers;\n\n// Find all keys that start with \"received\" (case-insensitive)\nconst receivedHeaders = Object.entries(headers)\n .filter(([key, value]) => key.toLowerCase() === 'received')\n .map(([key, value]) => ({ key, value }));\n\n// Return each header as an object\nreturn receivedHeaders.map(header => ({ json: header }));\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "05ba1e0a-1f47-492b-b57c-c82b2b8af99d", "name": "Gmail - Extract Original From IP", "type": "n8n-nodes-base.set", "position": [620, -80], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "5f740d1f-de62-4fe0-aa20-625063344c07", "name": "extractedfromip", "type": "string", "value": "={{ $json.value.replace(/\\b(127\\.(?:\\d{1,3}\\.){2}\\d{1,3})|(10\\.(?:\\d{1,3}\\.){2}\\d{1,3})|(172\\.(?:1[6-9]|2[0-9]|3[0-1])\\.\\d{1,3}\\.\\d{1,3})|(192\\.168\\.\\d{1,3}\\.\\d{1,3})\\b/g, \"\").match(/(\\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])(\\.(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])){3}))|:)))(%.+)?\\s*)|(\\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)[.]){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\b)/)[0] }}"}]}}, "typeVersion": 3.4}, {"id": "86bdebd4-fa96-4622-bc9d-67cea96486a4", "name": "Gmail - Original IP Found?", "type": "n8n-nodes-base.if", "position": [840, -20], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "1c27e7ba-d243-4673-b1cc-608c35951168", "operator": {"type": "boolean", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ $json.extractedfromip?.toBoolean() }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "18c23866-58fc-4cdb-9bea-961da75dbac5", "name": "Gmail - Query IP Quality Score API", "type": "n8n-nodes-base.httpRequest", "position": [1080, -160], "parameters": {"url": "=https://ipqualityscore.com/api/json/ip/Mlg6aZdzI1mVehUD3Z5Ak5Vl4yNN7P8v/{{ $('Gmail - Extract Original From IP').item.json.extractedfromip }}?strictness=1&allow_public_access_points=true&lighter_penalties=true", "options": {}}, "typeVersion": 4.2}, {"id": "9b35ce2c-d382-41b2-8e31-3238cc7c83bc", "name": "Gmail - Query IP API", "type": "n8n-nodes-base.httpRequest", "position": [1280, -160], "parameters": {"url": "=http://ip-api.com/json/{{ $('Gmail - Extract Original From IP').item.json.extractedfromip }}", "options": {}}, "typeVersion": 4.2}, {"id": "dbd95b55-f54a-477e-bdfe-4fd564b71154", "name": "Gmail - Authentication-Results Header?", "type": "n8n-nodes-base.if", "position": [1480, -20], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "ead2b640-ad80-4189-a692-ae454723fd85", "operator": {"type": "array", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ Object.entries($('Gmail - Set Headers').item.json.headers)\n .filter(([key, value]) => key.toLowerCase() === 'authentication-results')\n .map(([key, value]) => ({ key, value })) }}", "rightValue": "true"}]}}, "typeVersion": 2.2}, {"id": "972aee72-e5fd-4215-91d5-ea099b0ce379", "name": "Gmail - Received-SPF Header?", "type": "n8n-nodes-base.if", "position": [1820, 620], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "a38ebc9b-f896-4432-81fb-4f3db98f3409", "operator": {"type": "array", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ Object.entries($('Gmail - Set Headers').item.json.headers)\n .filter(([key, value]) => key.toLowerCase() === 'received-spf')\n .map(([key, value]) => ({ key, value })) }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "814810d9-46d4-4c4b-8b48-09504b39bab9", "name": "Gmail - Extract Authentication-Results Header", "type": "n8n-nodes-base.code", "position": [1840, -180], "parameters": {"jsCode": "// Extract the headers object from the JSON\nconst headers = $('Gmail - Set Headers').item.json.headers;\n\n// Find all keys that start with \"received\" (case-insensitive)\nconst receivedHeaders = Object.entries(headers)\n .filter(([key, value]) => key.toLowerCase() === 'authentication-results')\n .map(([key, value]) => ({ key, value }));\n\n// Return each header as an object\nreturn receivedHeaders.map(header => ({ json: header }));\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "98fd0bec-db8c-41bf-b5da-b485872366a5", "name": "Gmail - Extract Received-SPF Header", "type": "n8n-nodes-base.code", "position": [2160, 460], "parameters": {"jsCode": "// Extract the headers object from the JSON\nconst headers = $('Gmail - Set Headers').item.json.headers;\n\n// Find all keys that start with \"received\" (case-insensitive)\nconst receivedHeaders = Object.entries(headers)\n .filter(([key, value]) => key.toLowerCase() === 'received-spf')\n .map(([key, value]) => ({ key, value }));\n\n// Return each header as an object\nreturn receivedHeaders.map(header => ({ json: header }));\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "6c893235-19dd-40fb-860d-368de317907b", "name": "Gmail - Determine Auth Values", "type": "n8n-nodes-base.set", "position": [2560, -180], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "cd0b3f49-fe38-4686-a1f5-bc03a145adef", "name": "spfvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('spf=pass') ? \"pass\" : $json.value.toLowerCase().includes('spf=fail') ? \"fail\" : $json.value.toLowerCase().includes('spf=neutral') ? \"neutral\" : \"unknown\" }}"}, {"id": "6aa90f4d-773e-475f-8cbc-fe5c4fe93653", "name": "dkimvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('dkim=pass') ? \"pass\" : $json.value.toLowerCase().includes('dkim=fail') ? \"fail\" : $json.value.toLowerCase().includes('dkim=temperror') ? \"error\" : \"unknown\" }}"}, {"id": "d3b7b0c1-0680-4cb9-b376-d365e5602a29", "name": "dmarcvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('dmarc=pass') ? \"pass\" : $json.value.toLowerCase().includes('dmarc=fail') ? \"fail\" : \"unknown\" }}"}]}}, "typeVersion": 3.4}, {"id": "66203758-da3b-499a-a95e-2e04f196fc30", "name": "Gmail - Set SPF Value", "type": "n8n-nodes-base.set", "position": [2600, 460], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "179c48eb-97e5-48ab-82b8-ef4269f11366", "name": "spfvalue", "type": "string", "value": "={{ $json.data.last().value.toLowerCase().includes('fail') ? \"fail\" : $json.data.last().value.toLowerCase().includes('pass') ? \"pass\" : \"unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "8393c205-673a-46d7-977e-9a60720b1c39", "name": "Gmail - No SPF Found", "type": "n8n-nodes-base.set", "position": [2600, 640], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "spfvalue", "type": "string", "value": "not found"}]}}, "typeVersion": 3.4}, {"id": "2d7c752a-32cf-4c2c-9e59-e703b0b22ee9", "name": "Gmail - Format Output", "type": "n8n-nodes-base.set", "position": [3520, 100], "parameters": {"options": {}, "assignments": {"assignments": []}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "08b8b071-a94e-43d6-b7a0-85c101630a5c", "name": "Gmail - DKIM Signature Found", "type": "n8n-nodes-base.set", "position": [2600, 820], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "dkimvalue", "type": "string", "value": "=found"}]}}, "typeVersion": 3.4}, {"id": "e90d4a39-7bd7-4475-a5fa-1a31077004d9", "name": "Gmail - DKIM-Signature Header?", "type": "n8n-nodes-base.if", "position": [1820, 900], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "a38ebc9b-f896-4432-81fb-4f3db98f3409", "operator": {"type": "array", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ Object.entries($('Gmail - Set Headers').item.json.headers)\n .filter(([key, value]) => key.toLowerCase() === 'dkim-signature')\n .map(([key, value]) => ({ key, value })) }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "c8136c1a-7fcd-4301-a36d-d27fb535c868", "name": "Gmail - No DKIM Signature Found", "type": "n8n-nodes-base.set", "position": [2600, 1020], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "dkimvalue", "type": "string", "value": "not found"}]}}, "typeVersion": 3.4}, {"id": "84f3ddb5-9a52-45ed-bb98-c88145b69d9a", "name": "Gmail - Set DMARC Value", "type": "n8n-nodes-base.set", "position": [2600, 1240], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "179c48eb-97e5-48ab-82b8-ef4269f11366", "name": "spfvalue", "type": "string", "value": "={{ $json.value.toLowerCase().includes('pass') ? \"pass\" : $json.value.toLowerCase().includes('fail') ? \"fail\" : \"unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "4ac86848-09db-47a0-afed-20aa92e86ff8", "name": "Gmail - Extract DMARC Header", "type": "n8n-nodes-base.code", "position": [2260, 1240], "parameters": {"jsCode": "// Extract the headers object from the JSON\nconst headers = $('Gmail - Set Headers').item.json.headers;\n\n// Find all keys that start with \"received\" (case-insensitive)\nconst receivedHeaders = Object.entries(headers)\n .filter(([key, value]) => key.toLowerCase() === 'dmarc')\n .map(([key, value]) => ({ key, value }));\n\n// Return each header as an object\nreturn receivedHeaders.map(header => ({ json: header }));\n"}, "executeOnce": false, "typeVersion": 2}, {"id": "9e80bfaf-c3f4-4ba9-acfd-c467ecf4563a", "name": "Gmail - DMARC Header?", "type": "n8n-nodes-base.if", "position": [1820, 1340], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "a38ebc9b-f896-4432-81fb-4f3db98f3409", "operator": {"type": "array", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ Object.entries($('Gmail - Set Headers').item.json.headers)\n .filter(([key, value]) => key.toLowerCase() === 'dmarc')\n .map(([key, value]) => ({ key, value })) }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "448095c0-5d26-4ab6-aae4-3a3ff568de62", "name": "Gmail - No DMARC Header", "type": "n8n-nodes-base.set", "position": [2600, 1440], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "ae3158bf-3d91-4a61-a58c-c151362e52d7", "name": "dmarcvalue", "type": "string", "value": "=not found"}]}}, "typeVersion": 3.4}, {"id": "a972ebae-67e6-4216-ae24-9db64906c523", "name": "Set Gmail Headers Here", "type": "n8n-nodes-base.set", "position": [-320, -140], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "851a621a-509a-4a10-818c-a885a053cbf6", "name": "headers", "type": "object", "value": "={{ $json.headers }}"}]}}, "typeVersion": 3.4}, {"id": "46b1e8fe-c564-49a7-b38b-22b267fb6fc5", "name": "Format Individual Auth Outputs1", "type": "n8n-nodes-base.set", "position": [3280, 100], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "1f466a9d-e8a1-4095-918c-89fd8e3dae57", "name": "spf", "type": "string", "value": "={{ $json.data[0].spfvalue }}"}, {"id": "797b0e35-9a2e-4261-8741-a8d636e0d1ae", "name": "dkim", "type": "string", "value": "={{ $json.data[1].dkimvalue }}"}, {"id": "8b6f9dda-081d-45b6-98a9-04a96642800b", "name": "dmarc", "type": "string", "value": "={{ $json.data[2].dmarcvalue }}"}, {"id": "6d24a794-0d06-4f12-8bfb-cc3c71720a1b", "name": "initialIP", "type": "string", "value": "={{ $('Gmail - Extract Original From IP').item.json.extractedfromip || 'Originating IP Not Found'}}"}, {"id": "e9ec6f54-0ef7-451b-bbeb-8bb9291e4bcd", "name": "organization", "type": "string", "value": "={{ $('Gmail - Query IP API').item.json.org || \"No Organization Found\" }}"}, {"id": "719b8414-72e1-4916-855b-00abdfc8e776", "name": "country", "type": "string", "value": "={{ $('Gmail - Query IP API').item.json.country || \"No Country Found\" }}"}, {"id": "ab0dc08c-ba54-4e2c-b4df-9f23d36cb350", "name": "city", "type": "string", "value": "={{ $('Gmail - Query IP API').item.json.city || \"No City Found\" }}"}, {"id": "f8214eea-dfb6-4fe1-8e45-e0b8d3d44ee3", "name": "recentSpamActivity", "type": "string", "value": "={{ $('Gmail - Query IP Quality Score API').item.json.fraud_score>=85 ? \"Identified spam in the last 48 hours\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=75 ? \"Identified spam in the last month\" : \"Not associated with recent spam\" }}"}, {"id": "fe3488b2-ad00-45ad-b947-ca2dc4242363", "name": "ipSenderReputation", "type": "string", "value": "={{ $('Gmail - Query IP Quality Score API').item.json.fraud_score>=85 ? \"Bad\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=75 ? \"Poor\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=50 ? \"Suspicious\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=11 ? \"OK\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score<11 ? \"Good\" : \"Unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "8532b9d6-a4e2-4185-a624-26559a6449f4", "name": "Format Combined Auth Output1", "type": "n8n-nodes-base.set", "position": [3100, -80], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "1f466a9d-e8a1-4095-918c-89fd8e3dae57", "name": "spf", "type": "string", "value": "={{ $json.spfvalue }}"}, {"id": "797b0e35-9a2e-4261-8741-a8d636e0d1ae", "name": "dkim", "type": "string", "value": "={{ $json.dkimvalue }}"}, {"id": "8b6f9dda-081d-45b6-98a9-04a96642800b", "name": "dmarc", "type": "string", "value": "={{ $json.dmarcvalue }}"}, {"id": "6d24a794-0d06-4f12-8bfb-cc3c71720a1b", "name": "initialIP", "type": "string", "value": "={{ $('Gmail - Extract Original From IP').item.json.extractedfromip || 'Originating IP Not Found'}}"}, {"id": "e9ec6f54-0ef7-451b-bbeb-8bb9291e4bcd", "name": "organization", "type": "string", "value": "={{ $('Gmail - Query IP API').item.json.org || \"No Organization Found\" }}"}, {"id": "ba720521-9c2d-4906-8567-714e411f1663", "name": "country", "type": "string", "value": "={{ $('Gmail - Query IP API').item.json.country || \"No Country Found\" }}"}, {"id": "2d53a2b1-2600-4fe3-8273-8a54db4e5b87", "name": "city", "type": "string", "value": "={{ $('Gmail - Query IP API').item.json.city || \"No City Found\" }}"}, {"id": "84158095-89e2-48f6-9f78-2f9e0f71fcc9", "name": "recentSpamActivity", "type": "string", "value": "={{ $('Gmail - Query IP Quality Score API').item.json.fraud_score>=85 ? \"Identified spam in the last 48 hours\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=75 ? \"Identified spam in the last month\" : \"Not associated with recent spam\" }}"}, {"id": "9907705d-5f70-4cc7-bac0-0411f4b4ea37", "name": "ipSenderReputation", "type": "string", "value": "={{ $('Gmail - Query IP Quality Score API').item.json.fraud_score>=85 ? \"Bad\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=75 ? \"Poor\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=50 ? \"Suspicious\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score>=11 ? \"OK\" : $('Gmail - Query IP Quality Score API').item.json.fraud_score<11 ? \"Good\" : \"Unknown\"}}"}]}}, "typeVersion": 3.4}, {"id": "3e1323d4-a963-4a13-bbca-b6bb8ee5a9ce", "name": "Gmail - Webhook", "type": "n8n-nodes-base.webhook", "position": [-673, 541], "webhookId": "fb37cff7-b543-45f0-922d-4e0edcae5e43", "parameters": {"path": "fb37cff7-b543-45f0-922d-4e0edcae5e43", "options": {}, "httpMethod": "POST", "responseMode": "responseNode"}, "typeVersion": 2}, {"id": "8938765f-c569-4935-91d7-15c555e9fb99", "name": "Gmail - Remove Extra Received Headers", "type": "n8n-nodes-base.limit", "position": [420, -80], "parameters": {"keep": "lastItems"}, "typeVersion": 1}, {"id": "755b1716-5f63-4f5c-bc76-4bcaa7ffbb03", "name": "Gmail - Merge", "type": "n8n-nodes-base.merge", "position": [2880, 100], "parameters": {"numberInputs": 3}, "typeVersion": 3}, {"id": "19bbc6ce-feb3-49f8-b8d6-a99538810555", "name": "Gmail - Aggregate", "type": "n8n-nodes-base.aggregate", "position": [3100, 100], "parameters": {"options": {}, "aggregate": "aggregateAllItemData"}, "typeVersion": 1}, {"id": "33625d80-1bb7-474c-935b-0878d9185a41", "name": "Gmail - Set Headers", "type": "n8n-nodes-base.set", "position": [0, -80], "parameters": {"options": {}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "db297206-5433-413b-8e78-dcf5f10dc41e", "name": "Gmail - Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "position": [3800, 100], "parameters": {"options": {}}, "typeVersion": 1.1}, {"id": "cd401445-2b7a-42c9-9bf9-b17cc12a817b", "name": "Aggregate Received-SPF Headers1", "type": "n8n-nodes-base.aggregate", "position": [2380, 460], "parameters": {"options": {}, "aggregate": "aggregateAllItemData"}, "typeVersion": 1}, {"id": "6863e527-bc58-438c-8c3c-87f43994ac61", "name": "Set Gmail Webhook Headers Here", "type": "n8n-nodes-base.set", "position": [-233, 541], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "851a621a-509a-4a10-818c-a885a053cbf6", "name": "headers", "type": "object", "value": "={{ $json.body.headers }}"}]}}, "typeVersion": 3.4}, {"id": "8af99afc-538f-4e5b-9d69-e3c41ee3d300", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [-722.5965764931168, -597.9994506078199], "parameters": {"color": 7, "width": 630.8094744668451, "height": 645.5004204663932, "content": " \n## **Testing Email Header Analysis Workflow**\n\nThis section of the workflow is designed for testing purposes to ensure that the setup functions correctly with your Gmail email client before deploying it as an API for third-party platforms. The process begins with the `Gmail Trigger` node, which monitors your Gmail inbox and triggers the workflow whenever a new email arrives.\n\nOnce an email is detected, the `Set Gmail Headers Here` node extracts the email headers from the detected email and organizes them into a standardized format as an object called `headers`. This prepares the email data for further processing in subsequent sections of the workflow. By validating these steps, you can confirm the workflow is functioning correctly before integrating it into broader use cases."}, "typeVersion": 1}, {"id": "eeca8b68-8536-4131-a370-02822a8a13df", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [-82, -524.2941123664101], "parameters": {"color": 7, "width": 869.3564073187465, "height": 611.2507800793627, "content": " \n## **Extract and Process Email Headers**\n\nThis section processes the headers from incoming email data to extract critical information, particularly focusing on the originating IP address. The workflow begins with the `Gmail - Set Headers` node, which prepares the headers for analysis.\n\nThe `Gmail - Extract Received Headers` node filters through the headers and isolates those labeled as \"Received.\" These headers document the servers through which the email has passed, providing a traceable path of its journey. Next, the `Gmail - Remove Extra Received Headers` node narrows the focus to the most recent \"Received\" header, typically containing the originating IP address of the email sender.\n\nUsing the `Gmail - Extract Original From IP` node, the workflow applies a regular expression to extract the IP address from the retained header, removing internal or private IP addresses. This ensures that only the relevant external IP address is identified."}, "typeVersion": 1}, {"id": "bdabc308-6f17-413d-beb6-fde80d54140a", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [800, -599.6286292747894], "parameters": {"color": 7, "width": 922.1859426288208, "height": 824.9161858198846, "content": " \n## **Analyze IP Address and Check Authentication Results**\n\nThis section analyzes the originating IP address and verifies the presence of essential email authentication headers. The `Gmail - Original IP Found?` node determines whether the extracted IP address is valid and non-empty. If valid, the workflow proceeds; otherwise, it triggers the `Skip IP Check` node to move on to the next steps.\n\nThe `Gmail - Query IP Quality Score API` node evaluates the IP’s reputation, identifying associations with spam, fraud, or other malicious activities. The `Gmail - Query IP API` node enriches the analysis by providing additional details such as geographic location and organizational affiliation of the IP. \n\nFinally, the `Gmail - Authentication-Results Header?` node checks for the presence of the \"Authentication-Results\" header, which indicates SPF, DKIM, and DMARC checks performed by the receiving email server. If present, the header is further analyzed in subsequent sections."}, "typeVersion": 1}, {"id": "164c6c86-582f-44a8-b866-8865c6d4c2e5", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [1735, -551.4521798091497], "parameters": {"color": 7, "width": 1016.1357697283069, "height": 541.7962991053803, "content": " \n## **Extract and Evaluate Authentication Results**\n\nThe workflow continues with the `Gmail - Extract Authentication-Results Header` node, which isolates and parses the authentication results header. The `Gmail - Determine Auth Values` node processes the extracted data, categorizing the SPF, DKIM, and DMARC results as `pass`, `fail`, `neutral`, `error`, or `unknown`.\n\nThe `Gmail - Format Combined Auth Output` node consolidates the authentication results with metadata from previous nodes, including the originating IP, geographic details, organization, IP reputation, and spam activity. This structured output provides a comprehensive overview of the email's legitimacy, ready for external integration or reporting."}, "typeVersion": 1}, {"id": "8019b817-c8f7-425a-b372-5ba3109f5b64", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [2773, -500.1753788350808], "parameters": {"color": 7, "width": 1285.8545784346588, "height": 759.649504764657, "content": "\n## **Combine Results and Respond to Webhook**\n\nThe final section consolidates results from previous nodes into a cohesive output for the webhook response. The `Gmail - Merge` node combines data streams from SPF, DKIM, and DMARC evaluations. The `Gmail - Aggregate` node structures the data into a unified format.\n\nThe `Gmail - Format Individual Auth Outputs1` and `Gmail - Format Combined Auth Output1` nodes prepare the data as a structured JSON object, including all authentication results and metadata such as IP reputation and geographic information. The `Gmail - Format Output` node finalizes the response structure, and the `Gmail - Respond to Webhook` node sends the response to the requesting system.\n\nThis ensures seamless integration and delivers actionable insights to external platforms, completing the email analysis pipeline."}, "typeVersion": 1}, {"id": "4d7e8d8f-bd8e-4152-b375-8561b6f2d3fb", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [1733, -1], "parameters": {"color": 7, "width": 1016.1357697283069, "height": 1666.528211982754, "content": "\n## **Evaluate SPF, DKIM, and DMARC Compliance**\n\nThis section performs detailed analysis of SPF, DKIM, and DMARC headers. The `Gmail - Received-SPF Header?` node identifies the presence of the \"Received-SPF\" header, while the `Gmail - Extract Received-SPF Header` and `Aggregate Received-SPF Headers1` nodes extract and analyze SPF validation results. The `Gmail - Set SPF Value` node records the SPF status, and the `Gmail - No SPF Found` node handles cases where the header is absent.\n\nSimilarly, the `Gmail - DKIM-Signature Header?` node checks for a DKIM signature. If found, the `Gmail - DKIM Signature Found` node records its presence; otherwise, the `Gmail - No DKIM Signature Found` node handles its absence. \n\nThe `Gmail - DMARC Header?` node evaluates the DMARC policy header, with results extracted by `Gmail - Extract DMARC Header` or noted as absent by the `Gmail - No DMARC Header` node."}, "typeVersion": 1}, {"id": "544764a9-35f1-4a42-a9c7-b97f6c09314e", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [-721.3492584351117, 60], "parameters": {"color": 7, "width": 625.8275790033185, "height": 660.0846008994936, "content": "\n## **Webhook Integration for Production**\n\nThis section transitions the workflow into production, enabling it to function as an API for analyzing email headers received from third-party platforms. To utilize this webhook functionality, it is essential to **activate the workflow**, as the webhook will only respond when the workflow is live.\n\nThe `Gmail - Webhook` node listens for incoming HTTP POST requests at the specified path. When the webhook is triggered, it receives and processes the payload containing email data, including headers sent by the third-party platform. The `Set Gmail Webhook Headers Here` node extracts the `headers` array from the payload's body, ensuring the incoming data is formatted correctly and ready for further processing in subsequent steps.\n\nBy activating the workflow and integrating it with external systems, users can automate the analysis of email headers seamlessly in a production environment."}, "typeVersion": 1}, {"id": "fe9bb5cc-8bbd-4929-9bbe-8a78adce5434", "name": "Skip IP Check", "type": "n8n-nodes-base.noOp", "position": [1160, 80], "parameters": {}, "typeVersion": 1}], "connections": {"Gmail - Merge": {"main": [[{"node": "Gmail - Aggregate", "type": "main", "index": 0}]]}, "Gmail Trigger": {"main": [[{"node": "Set Gmail Headers Here", "type": "main", "index": 0}]]}, "Skip IP Check": {"main": [[{"node": "Gmail - Authentication-Results Header?", "type": "main", "index": 0}]]}, "Gmail - Webhook": {"main": [[{"node": "Set Gmail Webhook Headers Here", "type": "main", "index": 0}]]}, "Gmail - Aggregate": {"main": [[{"node": "Format Individual Auth Outputs1", "type": "main", "index": 0}]]}, "Gmail - Set Headers": {"main": [[{"node": "Gmail - Extract Received Headers", "type": "main", "index": 0}]]}, "Gmail - No SPF Found": {"main": [[{"node": "Gmail - Merge", "type": "main", "index": 0}]]}, "Gmail - Query IP API": {"main": [[{"node": "Gmail - Authentication-Results Header?", "type": "main", "index": 0}]]}, "Gmail - DMARC Header?": {"main": [[{"node": "Gmail - Extract DMARC Header", "type": "main", "index": 0}], [{"node": "Gmail - No DMARC Header", "type": "main", "index": 0}]]}, "Gmail - Format Output": {"main": [[{"node": "Gmail - Respond to Webhook", "type": "main", "index": 0}]]}, "Gmail - Set SPF Value": {"main": [[{"node": "Gmail - Merge", "type": "main", "index": 0}]]}, "Set Gmail Headers Here": {"main": [[{"node": "Gmail - Set Headers", "type": "main", "index": 0}]]}, "Gmail - No DMARC Header": {"main": [[{"node": "Gmail - Merge", "type": "main", "index": 2}]]}, "Gmail - Set DMARC Value": {"main": [[{"node": "Gmail - Merge", "type": "main", "index": 2}]]}, "Gmail - Original IP Found?": {"main": [[{"node": "Gmail - Query IP Quality Score API", "type": "main", "index": 0}], [{"node": "Skip IP Check", "type": "main", "index": 0}]]}, "Format Combined Auth Output1": {"main": [[{"node": "Gmail - Format Output", "type": "main", "index": 0}]]}, "Gmail - DKIM Signature Found": {"main": [[{"node": "Gmail - Merge", "type": "main", "index": 1}]]}, "Gmail - Extract DMARC Header": {"main": [[{"node": "Gmail - Set DMARC Value", "type": "main", "index": 0}]]}, "Gmail - Received-SPF Header?": {"main": [[{"node": "Gmail - Extract Received-SPF Header", "type": "main", "index": 0}], [{"node": "Gmail - No SPF Found", "type": "main", "index": 0}]]}, "Gmail - Determine Auth Values": {"main": [[{"node": "Format Combined Auth Output1", "type": "main", "index": 0}]]}, "Gmail - DKIM-Signature Header?": {"main": [[{"node": "Gmail - DKIM Signature Found", "type": "main", "index": 0}], [{"node": "Gmail - No DKIM Signature Found", "type": "main", "index": 0}]]}, "Set Gmail Webhook Headers Here": {"main": [[{"node": "Gmail - Set Headers", "type": "main", "index": 0}]]}, "Aggregate Received-SPF Headers1": {"main": [[{"node": "Gmail - Set SPF Value", "type": "main", "index": 0}]]}, "Format Individual Auth Outputs1": {"main": [[{"node": "Gmail - Format Output", "type": "main", "index": 0}]]}, "Gmail - No DKIM Signature Found": {"main": [[{"node": "Gmail - Merge", "type": "main", "index": 1}]]}, "Gmail - Extract Original From IP": {"main": [[{"node": "Gmail - Original IP Found?", "type": "main", "index": 0}]]}, "Gmail - Extract Received Headers": {"main": [[{"node": "Gmail - Remove Extra Received Headers", "type": "main", "index": 0}]]}, "Gmail - Query IP Quality Score API": {"main": [[{"node": "Gmail - Query IP API", "type": "main", "index": 0}]]}, "Gmail - Extract Received-SPF Header": {"main": [[{"node": "Aggregate Received-SPF Headers1", "type": "main", "index": 0}]]}, "Gmail - Remove Extra Received Headers": {"main": [[{"node": "Gmail - Extract Original From IP", "type": "main", "index": 0}]]}, "Gmail - Authentication-Results Header?": {"main": [[{"node": "Gmail - Extract Authentication-Results Header", "type": "main", "index": 0}], [{"node": "Gmail - Received-SPF Header?", "type": "main", "index": 0}, {"node": "Gmail - DKIM-Signature Header?", "type": "main", "index": 0}, {"node": "Gmail - DMARC Header?", "type": "main", "index": 0}]]}, "Gmail - Extract Authentication-Results Header": {"main": [[{"node": "Gmail - Determine Auth Values", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
What does this template help with?
Save the data of activities recorded and stored in Strava to a Google Sheets document.
How it works:
We have a Google Sheets spreadsheet where each row represents a Strava activity with the date, reference, distance, time, and elevation.
Periodically, the workflow checks the latest activities in our Strava account to see if any are missing from the spreadsheet and adds them to the list.
All fields must be properly formatted according to how they are stored in the Google Sheets spreadsheet.
Set up instructions
Complete the Set up credentials step when you first open the workflow. You'll need a Google Sheets and Strava account.
In the 'activities' node, you must enter the name of the file and the sheet where you want to save the imported data.
In the 'Strava' node, you must select the corresponding credential.
You can adjust the format of dates, times, and distances according to your needs in the 'strava_last' node.
The rest of the information is available at sherblog.es
Template was created in n8n v1.72.1
|
{"nodes": [{"id": "fc128eed-1666-46b8-8feb-e6ddf05e85d1", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [380, 240], "parameters": {"rule": {"interval": [{"field": "hours", "hoursInterval": 2}]}}, "typeVersion": 1.2}, {"id": "830708eb-197b-4bf7-95da-893d78329ab2", "name": "Strava", "type": "n8n-nodes-base.strava", "position": [380, 480], "parameters": {"limit": 10, "operation": "getAll"}, "typeVersion": 1.1}, {"id": "de776ebf-3ad5-4c4c-b0c8-7bc74cba5446", "name": "Code", "type": "n8n-nodes-base.code", "position": [380, 740], "parameters": {"jsCode": "// Obtén los items del nodo \"Strava\"\nconst stravaItems = $('strava_last').all();\n\n// Obtén los items del nodo \"ultimas_id\"\nconst ultimasGuardadasItems = $('saved_last').all();\n\n// Extrae las referencias guardadas en un Set, asegurando el formato como cadena\nconst referenciasGuardadas = new Set(\n ultimasGuardadasItems.map(item => String(item.json.id))\n);\n\n// Filtra los items de \"Strava\" cuyos IDs no estén en las referencias guardadas\nconst filteredItems = stravaItems.filter(item => {\n // Convertir el ID actual de Strava a cadena para comparar correctamente\n return !referenciasGuardadas.has(String(item.json.id));\n});\n\n// Depuración: imprime las referencias y los resultados\nconsole.log('Referencias guardadas:', [...referenciasGuardadas]);\nconsole.log('Items filtrados:', filteredItems);\n\n// Devuelve los items filtrados\nreturn filteredItems;\n\n\n"}, "typeVersion": 2}, {"id": "c8a93e6e-67fc-4f6d-bcde-83d3a885c622", "name": "Google Sheets", "type": "n8n-nodes-base.googleSheets", "position": [900, 740], "parameters": {"columns": {"value": {"Kms": "={{ $json.distancia }}", "Ref": "={{ $json.id }}", "Fecha": "={{ $json.fecha }}", "Track": "=http://www.strava.com/activities/{{ $json.id }}", "Tiempo": "={{ $json.tiempo }}", "Desnivel": "={{ $json.elevacion }}"}, "schema": [{"id": "Fecha", "type": "string", "display": true, "required": false, "displayName": "Fecha", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Kms", "type": "string", "display": true, "required": false, "displayName": "Kms", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Tiempo", "type": "string", "display": true, "required": false, "displayName": "Tiempo", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Ref", "type": "string", "display": true, "removed": false, "required": false, "displayName": "Ref", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Track", "type": "string", "display": true, "required": false, "displayName": "Track", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Bicicleta", "type": "string", "display": true, "required": false, "displayName": "Bicicleta", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Terreno", "type": "string", "display": true, "required": false, "displayName": "Terreno", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Desnivel", "type": "string", "display": true, "required": false, "displayName": "Desnivel", "defaultMatch": false, "canBeUsedToMatch": true}], "mappingMode": "defineBelow", "matchingColumns": []}, "options": {}, "operation": "append", "sheetName": {"__rl": true, "mode": "list", "value": 419561402, "cachedResultUrl": "https://docs.google.com/spreadsheets/d/159k8cDL8hZooz-dsHE6ueWf68mBkHhxVCKnWm-lYLqs/edit#gid=419561402", "cachedResultName": "n8n"}, "documentId": {"__rl": true, "mode": "list", "value": "159k8cDL8hZooz-dsHE6ueWf68mBkHhxVCKnWm-lYLqs", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/159k8cDL8hZooz-dsHE6ueWf68mBkHhxVCKnWm-lYLqs/edit?usp=drivesdk", "cachedResultName": "Sherlo_Bike"}}, "credentials": {"googleSheetsOAuth2Api": {"id": "tyg7FJlIITkSazyi", "name": "Nik's Google"}}, "typeVersion": 4.5}, {"id": "0ce07d54-97af-4e88-9d27-452191a0b3ba", "name": "strava_last", "type": "n8n-nodes-base.set", "position": [1420, 480], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "423ae4b8-287c-4dc1-b32b-d1b6f1f45efa", "name": "id", "type": "number", "value": "={{ $json.id }}"}, {"id": "595802d2-17d0-40be-9e43-d655ffbf4ce0", "name": "fecha", "type": "string", "value": "={{ DateTime.fromISO($json.start_date_local).toFormat('d/M/yyyy') }}"}, {"id": "4b39d783-19f2-4a7e-b0e6-dbe2b98f1ae0", "name": "distancia", "type": "number", "value": "={{ Math.round($json.distance / 100) / 10 }}"}, {"id": "2f321dc0-435f-4b4d-866c-091ff9eaf9df", "name": "elevacion", "type": "number", "value": "={{ Math.round($json.total_elevation_gain) }}"}, {"id": "ba1bb089-5ae7-4e42-ac65-07323c4e1842", "name": "tiempo", "type": "string", "value": "={{ `${Math.floor($json.moving_time / 3600)}:${Math.floor(($json.moving_time % 3600) / 60).toString().padStart(2, '0')}:${($json.moving_time % 60).toString().padStart(2, '0')}` }}\n"}]}}, "typeVersion": 3.4}, {"id": "490f7be9-73c9-4431-8b83-fcdbbcc283eb", "name": "Remove Duplicates", "type": "n8n-nodes-base.removeDuplicates", "position": [900, 480], "parameters": {"compare": "selectedFields", "options": {}, "fieldsToCompare": "id"}, "typeVersion": 2}, {"id": "2d1c4dc5-2baa-4c89-a312-4b40381d4e5d", "name": "activities", "type": "n8n-nodes-base.googleSheets", "position": [660, 240], "parameters": {"options": {}, "sheetName": {"__rl": true, "mode": "list", "value": 419561402, "cachedResultUrl": "https://docs.google.com/spreadsheets/d/159k8cDL8hZooz-dsHE6ueWf68mBkHhxVCKnWm-lYLqs/edit#gid=419561402", "cachedResultName": "n8n"}, "documentId": {"__rl": true, "mode": "list", "value": "159k8cDL8hZooz-dsHE6ueWf68mBkHhxVCKnWm-lYLqs", "cachedResultUrl": "https://docs.google.com/spreadsheets/d/159k8cDL8hZooz-dsHE6ueWf68mBkHhxVCKnWm-lYLqs/edit?usp=drivesdk", "cachedResultName": "Sherlo_Bike"}}, "credentials": {"googleSheetsOAuth2Api": {"id": "tyg7FJlIITkSazyi", "name": "Nik's Google"}}, "typeVersion": 4.5}, {"id": "2c7b7939-4ca1-4868-92bf-5fd7384a1103", "name": "sort_saved", "type": "n8n-nodes-base.sort", "position": [900, 240], "parameters": {"options": {}, "sortFieldsUi": {"sortField": [{"fieldName": "Ref"}]}}, "typeVersion": 1}, {"id": "4e1d9064-6dda-4a01-af48-f278792f8b6b", "name": "last_saved", "type": "n8n-nodes-base.limit", "position": [1160, 240], "parameters": {"keep": "lastItems", "maxItems": 10}, "typeVersion": 1}, {"id": "6eb2053a-1101-477b-86e9-113813be2d92", "name": "saved_last", "type": "n8n-nodes-base.set", "position": [1420, 240], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "50097932-ab91-4af7-9412-925fab1982f0", "name": "id", "type": "string", "value": "={{ $json.Ref }}"}]}}, "typeVersion": 3.4}, {"id": "afd986f1-0c49-4a69-b948-aefcbff1010f", "name": "sort_strava", "type": "n8n-nodes-base.sort", "position": [660, 480], "parameters": {"options": {}, "sortFieldsUi": {"sortField": [{"fieldName": "id"}]}}, "typeVersion": 1}, {"id": "16094d29-f35b-492c-9d93-3145dab30cd3", "name": "last_strava", "type": "n8n-nodes-base.limit", "position": [1160, 480], "parameters": {"keep": "lastItems", "maxItems": 10}, "typeVersion": 1}, {"id": "9986360b-fcd3-42f4-ad13-aea69f6d1a80", "name": "sort_results", "type": "n8n-nodes-base.sort", "position": [660, 740], "parameters": {"options": {}, "sortFieldsUi": {"sortField": [{"fieldName": "id"}]}}, "typeVersion": 1}], "connections": {"Code": {"main": [[{"node": "sort_results", "type": "main", "index": 0}]]}, "Strava": {"main": [[{"node": "sort_strava", "type": "main", "index": 0}]]}, "activities": {"main": [[{"node": "sort_saved", "type": "main", "index": 0}]]}, "last_saved": {"main": [[{"node": "saved_last", "type": "main", "index": 0}]]}, "saved_last": {"main": [[{"node": "Strava", "type": "main", "index": 0}]]}, "sort_saved": {"main": [[{"node": "last_saved", "type": "main", "index": 0}]]}, "last_strava": {"main": [[{"node": "strava_last", "type": "main", "index": 0}]]}, "sort_strava": {"main": [[{"node": "Remove Duplicates", "type": "main", "index": 0}]]}, "strava_last": {"main": [[{"node": "Code", "type": "main", "index": 0}]]}, "sort_results": {"main": [[{"node": "Google Sheets", "type": "main", "index": 0}]]}, "Schedule Trigger": {"main": [[{"node": "activities", "type": "main", "index": 0}]]}, "Remove Duplicates": {"main": [[{"node": "last_strava", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
-- Disclaimer: This workflow uses a community node and therefore only works for self-hosted n8n users --
Transform YouTube videos into comprehensive summaries and structured analysis instantly. This n8n workflow automatically extracts, processes, and analyzes video transcripts to deliver clear, organized insights without watching the entire video.
Time-Saving Features
🚀 Instant Processing
Simply provide a YouTube URL and receive a structured summary within seconds, eliminating the need to watch lengthy videos. Perfect for research, learning, or content analysis.
🤖 AI-Powered Analysis
Leverages GPT-4o-mini to analyze video transcripts, organizing key concepts and insights into a clear, hierarchical structure with main topics and essential points.
Smart Processing Pipeline
📝 Automated Transcript Extraction
Supports public YouTube video
Handles multiple URL formats
Extracts complete video transcripts automatically
🧠 Intelligent Content Organization
Breaks down content into main topics
Highlights key concepts and terminology
Maintains technical accuracy while improving clarity
Structures information logically with markdown formatting
Perfect For
📚 Researchers & Students
Quick comprehension of educational content and lectures without watching entire videos.
💼 Business Professionals
Efficient analysis of industry talks, presentations, and training materials.
🎯 Content Creators
Rapid research and competitive analysis of video content in your niche.
Technical Implementation
🔄 Workflow Components
Webhook endpoint for URL submission
YouTube API integration for video details
Transcript extraction system
GPT-4 powered analysis engine
Telegram notification system (optional)
Transform your video content consumption with an intelligent system that delivers structured, comprehensive summaries while saving hours of viewing time.
|
{"nodes": [{"id": "9320d08a-4868-4103-abdf-3f8f54a7a0a0", "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [0, 0], "webhookId": "9024e29e-9080-4cf5-9a6b-0d918468f195", "parameters": {"path": "ytube", "options": {}, "httpMethod": "POST", "responseMode": "responseNode"}, "typeVersion": 2}, {"id": "a5cc8922-8124-4269-9cfd-e891b29cc2b7", "name": "YouTube Transcript", "type": "n8n-nodes-youtube-transcription.youtubeTranscripter", "position": [800, 0], "parameters": {}, "typeVersion": 1}, {"id": "ff3c0fd1-36d8-4d64-b405-0600efd4d93b", "name": "Split Out", "type": "n8n-nodes-base.splitOut", "position": [200, 260], "parameters": {"options": {}, "fieldToSplitOut": "transcript"}, "typeVersion": 1}, {"id": "423276e0-81bf-487a-bbdd-26e9b84fa755", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "position": [1200, 140], "parameters": {"options": {}}, "typeVersion": 1.1}, {"id": "27344649-8029-48ae-867b-7363d904fc59", "name": "Telegram", "type": "n8n-nodes-base.telegram", "position": [1200, 380], "parameters": {"text": "={{ $json.title }}\n{{ $json.youtubeUrl }}", "additionalFields": {"parse_mode": "HTML", "appendAttribution": false}}, "typeVersion": 1.2}, {"id": "230c0325-d22a-4070-9460-748a6fef48d5", "name": "Get YouTube URL", "type": "n8n-nodes-base.set", "position": [200, 0], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "3ee42e4c-3cee-4934-97e7-64c96b5691ed", "name": "youtubeUrl", "type": "string", "value": "={{ $json.body.youtubeUrl }}"}]}}, "typeVersion": 3.4}, {"id": "420e90c3-9dfa-4f41-825a-9874b5ebe43a", "name": "YouTube Video ID", "type": "n8n-nodes-base.code", "position": [400, 0], "parameters": {"jsCode": "const extractYoutubeId = (url) => {\n // Regex pattern that matches both youtu.be and youtube.com URLs\n const pattern = /(?:youtube\\.com\\/(?:[^\\/]+\\/.+\\/|(?:v|e(?:mbed)?)\\/|.*[?&]v=)|youtu\\.be\\/)([^\"&?\\/\\s]{11})/;\n const match = url.match(pattern);\n return match ? match[1] : null;\n};\n\n// Input URL from previous node\nconst youtubeUrl = items[0].json.youtubeUrl; // Adjust this based on your workflow\n\n// Process the URL and return the video ID\nreturn [{\n json: {\n videoId: extractYoutubeId(youtubeUrl)\n }\n}];\n"}, "typeVersion": 2}, {"id": "a4171c3e-1ff2-40de-af7f-b3971a1ebe79", "name": "Get YouTube Video", "type": "n8n-nodes-base.youTube", "position": [600, 0], "parameters": {"options": {}, "videoId": "={{ $json.videoId }}", "resource": "video", "operation": "get"}, "typeVersion": 1}, {"id": "73e6bfc5-8b62-4880-acd4-292f2f692540", "name": "gpt-4o-mini", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [620, 440], "parameters": {"options": {}}, "typeVersion": 1}, {"id": "ea14e296-b30c-46f7-b283-746822ae1af4", "name": "Summarize & Analyze Transcript", "type": "@n8n/n8n-nodes-langchain.chainLlm", "position": [600, 260], "parameters": {"text": "=Please analyze the given text and create a structured summary following these guidelines:\n\n1. Break down the content into main topics using Level 2 headers (##)\n2. Under each header:\n - List only the most essential concepts and key points\n - Use bullet points for clarity\n - Keep explanations concise\n - Preserve technical accuracy\n - Highlight key terms in bold\n3. Organize the information in this sequence:\n - Definition/Background\n - Main characteristics\n - Implementation details\n - Advantages/Disadvantages\n4. Format requirements:\n - Use markdown formatting\n - Keep bullet points simple (no nesting)\n - Bold important terms using **term**\n - Use tables for comparisons\n - Include relevant technical details\n\nPlease provide a clear, structured summary that captures the core concepts while maintaining technical accuracy.\n\nHere is the text: {{ $json.concatenated_text\n }}", "promptType": "define"}, "typeVersion": 1.4}, {"id": "90e3488f-f854-483e-9106-a5760d0c0457", "name": "Concatenate", "type": "n8n-nodes-base.summarize", "position": [400, 260], "parameters": {"options": {}, "fieldsToSummarize": {"values": [{"field": "text", "separateBy": " ", "aggregation": "concatenate"}]}}, "typeVersion": 1}, {"id": "9c5c249c-5eeb-4433-ba93-ace4611f4858", "name": "Response Object", "type": "n8n-nodes-base.set", "position": [960, 260], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "bf132004-6636-411f-9d85-0c696fda84c4", "name": "summary", "type": "string", "value": "={{ $json.text }}"}, {"id": "63c8d0e3-685c-488a-9b45-363cf52479ea", "name": "topics", "type": "array", "value": "=[]"}, {"id": "171f30cf-34e9-42f3-8735-814024bfde0b", "name": "title", "type": "string", "value": "={{ $('Get YouTube Video').item.json.snippet.title }}"}, {"id": "7f26f5a3-e695-49d1-b1e8-9260c31f1b3d", "name": "description", "type": "string", "value": "={{ $('Get YouTube Video').item.json.snippet.description }}"}, {"id": "d0594232-cb39-453c-b015-3b039c098e1f", "name": "id", "type": "string", "value": "={{ $('Get YouTube Video').item.json.id }}"}, {"id": "17b6ca08-ce89-4467-bd25-0d2d182f7a8b", "name": "youtubeUrl", "type": "string", "value": "={{ $('Webhook').item.json.body.youtubeUrl }}"}]}}, "typeVersion": 3.4}], "connections": {"Webhook": {"main": [[{"node": "Get YouTube URL", "type": "main", "index": 0}]]}, "Split Out": {"main": [[{"node": "Concatenate", "type": "main", "index": 0}]]}, "Concatenate": {"main": [[{"node": "Summarize & Analyze Transcript", "type": "main", "index": 0}]]}, "gpt-4o-mini": {"ai_languageModel": [[{"node": "Summarize & Analyze Transcript", "type": "ai_languageModel", "index": 0}]]}, "Get YouTube URL": {"main": [[{"node": "YouTube Video ID", "type": "main", "index": 0}]]}, "Response Object": {"main": [[{"node": "Respond to Webhook", "type": "main", "index": 0}, {"node": "Telegram", "type": "main", "index": 0}]]}, "YouTube Video ID": {"main": [[{"node": "Get YouTube Video", "type": "main", "index": 0}]]}, "Summarize & Analyze Transcript": {"main": [[{"node": "Response Object", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
> Reach out to me for any setup help/consulting.
Automate the curation and sharing of trending GitHub discussions from Hacker News to Twitter and LinkedIn. This workflow leverages AI to generate engaging posts, streamlining your social media content creation and distribution.
How it Works
Crawl Hacker News for GitHub Posts: The workflow fetches trending GitHub-related discussions from Hacker News.
Extract Key Information: Relevant data such as post titles, URLs, and metadata are extracted and filtered to focus only on unposted content.
Fetch Additional Details: For each GitHub post, the workflow retrieves extra information from the GitHub repository page to enrich the post content.
Generate Social Media Posts: Using AI, the workflow automatically generates tailored posts for Twitter and LinkedIn based on the collected data.
Post to Twitter & LinkedIn: The generated content is posted to your Twitter and LinkedIn accounts.
Track and Log Posts: Each post is logged in Airtable for tracking, and its status is updated to ensure no duplicate posts are made.
Telegram Notification: After posting, a summary of the posts is sent to your Telegram chat for real-time updates.
Requirements
n8n Account**: Set up and configured. Sign up here.
API Credentials**: Valid keys for LinkedIn, Twitter, Airtable, OpenAI, and Telegram.
Airtable Base**: Configured with fields such as Title, URL, Post Content, Status, and Timestamp. Get started with Airtable.
Telegram Chat ID**: For receiving real-time notifications.
Set Up Steps
Clone the Workflow: Import the workflow into your n8n environment using the provided JSON.
Configure API Credentials: Enter your API keys for LinkedIn, Twitter, Airtable, OpenAI, and Telegram into the respective nodes.
Set Up Airtable Base: Create an Airtable base with fields such as Title, URL, Post Content, Status, and Timestamp.
Customize Telegram Chat ID: Modify the 'Ping me' node with your Telegram chat ID to receive notifications.
Run the Workflow: Activate the workflow to start the automated content curation and posting process.
Additional Resources
n8n AI Agentic Workflows Guide
n8n AI Workflow Tutorial
n8n Community Tutorial on Building an AI-Powered Telegram Bot
> Note: Chat GPT prompt should/can be tweaked in the step to give the desired behaviour.
Sample Posts from my X and LinkedIn -**
|
{"id": "ZeSJSbwXI593H1Qj", "meta": {"instanceId": "8e1a7e3413df437923cda0e92c098469371d84f7001856e525beaff17be8b941", "templateCredsSetupCompleted": true}, "name": "Social Media AI Agent - Telegram", "tags": [], "nodes": [{"id": "814303e0-5fe9-474e-a4ed-e4a728fd4acf", "name": "Crawl HN Home", "type": "n8n-nodes-base.httpRequest", "position": [-1540, 1640], "parameters": {"url": "https://news.ycombinator.com/", "options": {"response": {"response": {"neverError": true, "fullResponse": true}}}}, "executeOnce": true, "typeVersion": 4.2, "alwaysOutputData": true}, {"id": "32e20b1d-b3f1-4ed2-acbf-4d5bd56b0d8b", "name": "Extract Meta", "type": "n8n-nodes-base.code", "position": [-1260, 1720], "parameters": {"language": "python", "pythonCode": "# Import necessary modules\nimport asyncio\nimport micropip\n\n# Define an asynchronous function to install packages\nasync def install_packages():\n await micropip.install(\"beautifulsoup4\")\n await micropip.install(\"simplejson\")\n\n# Run the asynchronous package installation\nasyncio.get_event_loop().run_until_complete(install_packages())\n\n# Now, import the installed packages\nimport simplejson as json\nfrom bs4 import BeautifulSoup\n\n# Retrieve the HTML content from the first item in the input\n# Assuming n8n passes data as a list of items, each with a 'json' key\nhtml_content = items[0].get('json', {}).get('data', '')\n\n# Initialize BeautifulSoup with the HTML content\nsoup = BeautifulSoup(html_content, 'html.parser')\n\n# Initialize a list to store metadata of GitHub posts\ngithub_posts = []\n\n# Find all 'tr' elements with class 'athing submission'\nposts = soup.find_all('tr', class_='athing submission')\n\nfor post in posts:\n post_id = post.get('id')\n title_line = post.find('span', class_='titleline')\n if not title_line:\n continue # Skip if titleline is not found\n\n # Extract the title and URL\n title_tag = title_line.find('a')\n if not title_tag:\n continue # Skip if title tag is not found\n\n title = title_tag.get_text(strip=True)\n url = title_tag.get('href', '')\n\n # Check if the URL is a GitHub link\n if 'github.com' not in url.lower():\n continue # Skip if not a GitHub link\n\n # Extract the site domain (e.g., github.com/username/repo)\n site_bit = title_line.find('span', class_='sitebit comhead')\n site = site_bit.find('span', class_='sitestr').get_text(strip=True) if site_bit else ''\n\n # The subtext is in the next 'tr' element\n subtext_tr = post.find_next_sibling('tr')\n if not subtext_tr:\n continue # Skip if subtext row is not found\n\n subtext_td = subtext_tr.find('td', class_='subtext')\n if not subtext_td:\n continue # Skip if subtext td is not found\n\n # Extract score\n score_span = subtext_td.find('span', class_='score')\n score = score_span.get_text(strip=True) if score_span else '0 points'\n\n # Extract author\n author_a = subtext_td.find('a', class_='hnuser')\n author = author_a.get_text(strip=True) if author_a else 'unknown'\n\n # Extract age\n age_span = subtext_td.find('span', class_='age')\n age_a = age_span.find('a') if age_span else None\n age = age_a.get_text(strip=True) if age_a else 'unknown'\n\n # Extract comments\n comments_a = subtext_td.find_all('a')[-1] if subtext_td.find_all('a') else None\n comments_text = comments_a.get_text(strip=True) if comments_a else '0 comments'\n\n # Construct the Hacker News URL\n hn_url = f\"https://news.ycombinator.com/item?id={post_id}\"\n\n # Compile the metadata\n post_metadata = {\n 'Post': post_id,\n 'title': title,\n 'url': url,\n 'site': site,\n 'score': score,\n 'author': author,\n 'age': age,\n 'comments': comments_text,\n 'hn_url': hn_url\n }\n\n # Append to the list of GitHub posts\n github_posts.append(post_metadata)\n\n# Prepare the output for n8n\noutput = [{'json': post} for post in github_posts]\n\n# Return the output\nreturn output\n"}, "executeOnce": true, "typeVersion": 2, "alwaysOutputData": true}, {"id": "b54cf663-b823-4613-a812-764942b95b9d", "name": "Filter Unposted Items", "type": "n8n-nodes-base.code", "position": [-680, 1640], "parameters": {"jsCode": "const items = [];\n\n// Step 1: Collect all Post IDs from input1 items (those with 'id')\nconst processedPosts = new Set(\n $input.all()\n .filter(item => item.json.id)\n .map(item => item.json.Post)\n);\n\n// Step 2: Iterate over all items and filter out duplicates\nfor (const item of $input.all()) {\n \n // Only process items without 'id' (input2 items)\n if(!item.json.id){\n \n // Check if the Post ID is already processed\n if(!processedPosts.has(item.json.Post) && item.json.Post!=undefined){\n items.push(item);\n }\n }\n}\n\nreturn items;\n"}, "typeVersion": 2}, {"id": "d7ac7121-8da7-4e45-9b74-daf07fbf15fb", "name": "Visit GH Page", "type": "n8n-nodes-base.httpRequest", "position": [-420, 1420], "parameters": {"url": "={{ $json.url }}", "options": {}}, "typeVersion": 4.2}, {"id": "f156ca8e-7963-42b9-9612-9ab5efc53be4", "name": "Convert HTML To Markdown", "type": "n8n-nodes-base.markdown", "position": [-240, 1700], "parameters": {"html": "={{ $json.data }}", "options": {}}, "typeVersion": 1, "alwaysOutputData": true}, {"id": "86221ed0-29fa-4775-ba36-8ffdf614977c", "name": "Filter Errored", "type": "n8n-nodes-base.filter", "position": [380, 1440], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "7776cb97-e02d-418e-a168-612bf92d4160", "operator": {"type": "string", "operation": "empty", "singleValue": true}, "leftValue": "={{ $json.error }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "f08c4f61-17a5-4899-ab3d-4e3ff5d1b8b7", "name": "No Operation, do nothing", "type": "n8n-nodes-base.noOp", "position": [1760, 1540], "parameters": {}, "typeVersion": 1}, {"id": "48856b3b-a951-4e7f-a0b8-410a71e9b0a7", "name": "Update X Status", "type": "n8n-nodes-base.airtable", "position": [1500, 1400], "parameters": {"base": {"__rl": true, "mode": "list", "value": "app7fh2kmMzPKS4RZ", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ", "cachedResultName": "Twitter Agent"}, "table": {"__rl": true, "mode": "list", "value": "tblf0cODJFdvDj7vU", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ/tblf0cODJFdvDj7vU", "cachedResultName": "My Tweets"}, "columns": {"value": {"id": "={{ $('Create Item').item.json.id }}", "TDone": true}, "schema": [{"id": "id", "type": "string", "display": true, "removed": false, "readOnly": true, "required": false, "displayName": "id", "defaultMatch": true}, {"id": "Post", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Post", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Title", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Title", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Url", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Url", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Tweet", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Tweet", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "LinkedIn", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "LinkedIn", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Date", "type": "string", "display": true, "removed": true, "readOnly": true, "required": false, "displayName": "Date", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Last Modified", "type": "string", "display": true, "removed": true, "readOnly": true, "required": false, "displayName": "Last Modified", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "TDone", "type": "boolean", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "TDone", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "LDone", "type": "boolean", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "LDone", "defaultMatch": false, "canBeUsedToMatch": true}], "mappingMode": "defineBelow", "matchingColumns": ["id"]}, "options": {"typecast": true}, "operation": "update"}, "credentials": {"airtableTokenApi": {"id": "BxLldDZTAZvuWVbr", "name": "Airtable Personal Access Token account"}}, "typeVersion": 2.1}, {"id": "c31bb906-2a0d-406a-a7cd-6fc4adfcb67b", "name": "LinkedIn", "type": "n8n-nodes-base.linkedIn", "position": [1200, 1820], "parameters": {"text": "={{ $('Filter Errored').item.json.message.content.linkedin }}", "person": "afi4Hy9wlI", "additionalFields": {}}, "credentials": {"linkedInOAuth2Api": {"id": "S7G2oyLAmzhWuYFQ", "name": "LinkedIn account"}}, "typeVersion": 1}, {"id": "4aab4cc2-4a51-432a-aa21-ba469c027ac6", "name": "Update L Status", "type": "n8n-nodes-base.airtable", "position": [1520, 1680], "parameters": {"base": {"__rl": true, "mode": "list", "value": "app7fh2kmMzPKS4RZ", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ", "cachedResultName": "Twitter Agent"}, "table": {"__rl": true, "mode": "list", "value": "tblf0cODJFdvDj7vU", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ/tblf0cODJFdvDj7vU", "cachedResultName": "My Tweets"}, "columns": {"value": {"id": "={{ $('Create Item').item.json.id }}", "LDone": true}, "schema": [{"id": "id", "type": "string", "display": true, "removed": false, "readOnly": true, "required": false, "displayName": "id", "defaultMatch": true}, {"id": "Post", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Post", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Title", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Title", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Url", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Url", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Tweet", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "Tweet", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "LinkedIn", "type": "string", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "LinkedIn", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Date", "type": "string", "display": true, "removed": true, "readOnly": true, "required": false, "displayName": "Date", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Last Modified", "type": "string", "display": true, "removed": true, "readOnly": true, "required": false, "displayName": "Last Modified", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "TDone", "type": "boolean", "display": true, "removed": true, "readOnly": false, "required": false, "displayName": "TDone", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "LDone", "type": "boolean", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "LDone", "defaultMatch": false, "canBeUsedToMatch": true}], "mappingMode": "defineBelow", "matchingColumns": ["id"]}, "options": {"typecast": true}, "operation": "update"}, "credentials": {"airtableTokenApi": {"id": "BxLldDZTAZvuWVbr", "name": "Airtable Personal Access Token account"}}, "typeVersion": 2.1}, {"id": "72dd9714-c11d-4417-8710-89e416ac44c9", "name": "Search Item", "type": "n8n-nodes-base.airtable", "position": [-1100, 1240], "parameters": {"base": {"__rl": true, "mode": "list", "value": "app7fh2kmMzPKS4RZ", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ", "cachedResultName": "Twitter Agent"}, "table": {"__rl": true, "mode": "list", "value": "tblf0cODJFdvDj7vU", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ/tblf0cODJFdvDj7vU", "cachedResultName": "My Tweets"}, "options": {"fields": ["Title", "Url", "Tweet", "Date", "Post"]}, "operation": "search", "filterByFormula": "={Post}= {{ $json.Post }}"}, "credentials": {"airtableTokenApi": {"id": "BxLldDZTAZvuWVbr", "name": "Airtable Personal Access Token account"}}, "typeVersion": 2.1, "alwaysOutputData": true}, {"id": "f89fbada-0e53-44f0-a09b-119869fabd10", "name": "Create Item", "type": "n8n-nodes-base.airtable", "position": [580, 1660], "parameters": {"base": {"__rl": true, "mode": "list", "value": "app7fh2kmMzPKS4RZ", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ", "cachedResultName": "Twitter Agent"}, "table": {"__rl": true, "mode": "list", "value": "tblf0cODJFdvDj7vU", "cachedResultUrl": "https://airtable.com/app7fh2kmMzPKS4RZ/tblf0cODJFdvDj7vU", "cachedResultName": "My Tweets"}, "columns": {"value": {"Url": "={{ $('Filter Unposted Items').item.json.url }}", "Post": "={{ $('Filter Unposted Items').item.json.Post }}", "Title": "={{ $('Filter Unposted Items').item.json.title }}", "Tweet": "={{ $json.message.content.twitter }}", "LinkedIn": "={{ $json.message.content.linkedin }}"}, "schema": [{"id": "Post", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Post", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Title", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Title", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Url", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Url", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Tweet", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "Tweet", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "LinkedIn", "type": "string", "display": true, "removed": false, "readOnly": false, "required": false, "displayName": "LinkedIn", "defaultMatch": false, "canBeUsedToMatch": true}, {"id": "Date", "type": "string", "display": true, "removed": false, "readOnly": true, "required": false, "displayName": "Date", "defaultMatch": false, "canBeUsedToMatch": true}], "mappingMode": "defineBelow", "matchingColumns": []}, "options": {}, "operation": "create"}, "credentials": {"airtableTokenApi": {"id": "BxLldDZTAZvuWVbr", "name": "Airtable Personal Access Token account"}}, "typeVersion": 2.1}, {"id": "51a2c3d3-3e75-4375-b2b6-4bb86fa71855", "name": "X", "type": "n8n-nodes-base.twitter", "onError": "continueRegularOutput", "position": [1180, 1380], "parameters": {"text": "={{ $('Filter Errored').item.json.message.content.twitter }}", "additionalFields": {}}, "credentials": {"twitterOAuth2Api": {"id": "YQyS9lQTpZtZkefS", "name": "X account"}}, "executeOnce": false, "typeVersion": 2}, {"id": "58869c5b-9fb2-4f76-8788-68056cda45b0", "name": "Validate Generate Content", "type": "n8n-nodes-base.code", "onError": "continueRegularOutput", "position": [180, 1680], "parameters": {"mode": "runOnceForEachItem", "jsCode": "if ($json.message.content.twitter && $json.message.content.linkedin) {\n \n return $json;\n} else {\n\n const parsedContent = JSON.parse($json.message.content);\n if ($json.message.content.twitter && $json.message.content.linkedin) {\n return parsedContent;\n }\n\n console.log(\"Invalid formatting\")\n return {}\n}"}, "typeVersion": 2}, {"id": "527fd640-8bc8-4043-92a6-52fbea8de63f", "name": "Schedule Trigger", "type": "n8n-nodes-base.scheduleTrigger", "position": [-1780, 1640], "parameters": {"rule": {"interval": [{"field": "hours", "hoursInterval": 6}]}}, "typeVersion": 1.2}, {"id": "f00c1de5-d5bd-4d78-8717-d26dd739adc7", "name": "Merge", "type": "n8n-nodes-base.merge", "position": [-840, 1420], "parameters": {}, "typeVersion": 3, "alwaysOutputData": true}, {"id": "3529fba4-173c-4378-ae69-43a3bae0813f", "name": "Generate Content", "type": "@n8n/n8n-nodes-langchain.openAi", "position": [-120, 1440], "parameters": {"modelId": {"__rl": true, "mode": "list", "value": "gpt-4o-mini", "cachedResultName": "GPT-4O-MINI"}, "options": {}, "messages": {"values": [{"role": "system", "content": "You are an AI-powered social media assistant specialized in crafting short-form, engaging posts for Twitter and LinkedIn. Your tone should blend the enthusiasm of a Tech Evangelist with the narrative depth of a Storyteller. The goal is to highlight technological and open-source projects in a friendly, forward-thinking manner, connecting them to real-world use cases. \n\nGuidelines:\n1. Output must be in JSON with separate fields for “twitter” and “linkedin.”\n2. Do not include emojis or marketing buzzwords (“cutting-edge,” “disruptive,” etc.).\n3. Write naturally and concisely. Avoid overly formal or robotic language.\n4. Twitter posts must be under 280 characters (including spaces and URL).\n5. LinkedIn posts should be slightly longer, yet still succinct, and focus on storytelling and real-world applications.\n6. Provide a single call-to-action in each post.\n7. Do not imply ownership of the project unless explicitly stated.\n8. Maintain a professional yet approachable tone in both outputs.\n"}, {"content": "=Using the following details, generate two posts—one for Twitter and one for LinkedIn—incorporating an enthusiastic yet narrative-driven style:\n\nTitle: {{ $('Filter Unposted Items').item.json.title }}\nDetails in markdown: {{ $json.data }}\nRepository Link: {{ $('Filter Unposted Items').item.json.url }} (this is the actual link you want to be inserted)\n\nConstraints:\n- No emojis.\n- Keep the Twitter post under 280 characters (including the link).\n- Use a friendly, forward-thinking tone that weaves in a short narrative where possible.\n- Highlight how the project solves a real problem or benefits the user.\n- End each post with one clear CTA (e.g., “Check it out!” or “Learn more.”).\n- **Ensure the tone is neutral and does not imply personal involvement** (e.g., avoid phrases like \"my journey\" or \"I found it fascinating\").\n- **LinkedIn post should be more detailed**: Provide context, explain the key features, highlight how it can be useful to different audiences, and elaborate on the problem it solves or the impact it can have.\n- Output your response in JSON with the structure:\n```json\n{\n \"twitter\": \"Your Twitter post here\",\n \"linkedin\": \"Your LinkedIn post here\"\n}\n"}]}, "jsonOutput": true}, "credentials": {"openAiApi": {"id": "IfJo4dG8AUORk6f0", "name": "OpenAi account"}}, "typeVersion": 1.7, "alwaysOutputData": true}, {"id": "2dfd7849-877c-4bd3-b248-94140a1fe209", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [-320, 960], "parameters": {"width": 619.8433261701165, "height": 97.20332107671479, "content": "Automate the curation and sharing of trending GitHub discussions from Hacker News to Twitter and LinkedIn. This workflow leverages AI to generate engaging posts, streamlining your social media content creation and distribution.\n\n"}, "typeVersion": 1}, {"id": "20704a99-1234-46dc-b8c8-860b051b3b85", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [-1620, 1520], "parameters": {"color": 5, "width": 524.8824946275869, "height": 420.37647358435385, "content": "I crawl Hacker News and extract Github links."}, "typeVersion": 1}, {"id": "5cfa2c30-6c88-429a-8b5f-0034d2352cc2", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [-480, 1280], "parameters": {"color": 5, "width": 828.144505037599, "height": 670.031562962293, "content": "This is where the magic happens. I use the Github url extracted earlier and visit Github page to get more insights in the project being shared. Then I ask Chat GPT very nicely to help me get a Tweet and a LinkedIn post"}, "typeVersion": 1}, {"id": "caec3df6-ddcc-4959-94e1-18163cf3128f", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [1100, 1280], "parameters": {"color": 5, "width": 285.9487894560623, "height": 751.2077576680031, "content": "One last magic trick, Send the generated Tweet and the post to the respective platforms."}, "typeVersion": 1}, {"id": "89c8472d-3329-4f94-a656-2539e061eeb0", "name": "Ping Me", "type": "n8n-nodes-base.telegram", "position": [720, 1420], "parameters": {"text": "=Hi There, here is your readymade tweet - \n\n {{ $json.fields.Tweet }}\n\nAnd your readymade LinkedIn post -\n\n {{ $json.fields.LinkedIn }}\n\n", "chatId": "1297549992", "additionalFields": {}}, "credentials": {"telegramApi": {"id": "1RZApQ3BwJxFn9jp", "name": "Telegram account"}}, "typeVersion": 1.2}, {"id": "b1444e6d-0cab-4082-af42-a8decc97d9b4", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [640, 1300], "parameters": {"color": 5, "width": 264.5060210432334, "height": 307.03612625939974, "content": "Just pinging the owner that something is about to be posted and wait for 5 mins before final posting."}, "typeVersion": 1}, {"id": "01c2f7ff-ff6c-4a60-9581-f8c5f3985792", "name": "Wait for 5 mins before posting", "type": "n8n-nodes-base.wait", "position": [880, 1660], "webhookId": "0c7ee388-30cf-4a99-9bb0-0fd85171c794", "parameters": {"unit": "minutes"}, "typeVersion": 1.1}, {"id": "909c7e7d-ea84-4612-a322-b1fa889b2efb", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [-920, 1380], "parameters": {"width": 400.8207630962184, "height": 392.80719991071624, "content": "CHORE"}, "typeVersion": 1}, {"id": "04ab5b63-8def-4d49-9360-596261eb051c", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [-1140, 1140], "parameters": {"color": 5, "width": 195.58283685913963, "height": 285.5933578465706, "content": "Make sure we don't post the same content again."}, "typeVersion": 1}], "active": true, "settings": {"executionOrder": "v1"}, "versionId": "4c28d47d-811e-4b89-adeb-47da12abd378", "connections": {"X": {"main": [[{"node": "Update X Status", "type": "main", "index": 0}]]}, "Merge": {"main": [[{"node": "Filter Unposted Items", "type": "main", "index": 0}]]}, "Ping Me": {"main": [[{"node": "Wait for 5 mins before posting", "type": "main", "index": 0}]]}, "LinkedIn": {"main": [[{"node": "Update L Status", "type": "main", "index": 0}]]}, "Create Item": {"main": [[{"node": "Ping Me", "type": "main", "index": 0}]]}, "Search Item": {"main": [[{"node": "Merge", "type": "main", "index": 0}]]}, "Extract Meta": {"main": [[{"node": "Search Item", "type": "main", "index": 0}, {"node": "Merge", "type": "main", "index": 1}]]}, "Crawl HN Home": {"main": [[{"node": "Extract Meta", "type": "main", "index": 0}]]}, "Visit GH Page": {"main": [[{"node": "Convert HTML To Markdown", "type": "main", "index": 0}]]}, "Filter Errored": {"main": [[{"node": "Create Item", "type": "main", "index": 0}]]}, "Update L Status": {"main": [[{"node": "No Operation, do nothing", "type": "main", "index": 0}]]}, "Update X Status": {"main": [[{"node": "No Operation, do nothing", "type": "main", "index": 0}]]}, "Generate Content": {"main": [[{"node": "Validate Generate Content", "type": "main", "index": 0}]]}, "Schedule Trigger": {"main": [[{"node": "Crawl HN Home", "type": "main", "index": 0}]]}, "Filter Unposted Items": {"main": [[{"node": "Visit GH Page", "type": "main", "index": 0}]]}, "Convert HTML To Markdown": {"main": [[{"node": "Generate Content", "type": "main", "index": 0}]]}, "Validate Generate Content": {"main": [[{"node": "Filter Errored", "type": "main", "index": 0}]]}, "Wait for 5 mins before posting": {"main": [[{"node": "X", "type": "main", "index": 0}, {"node": "LinkedIn", "type": "main", "index": 0}]]}}}
|
You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and error-free n8n workflow JSONs based on the user's requirements. Always output ONLY the valid JSON workflow.
|
Transform simple queries into comprehensive, well-structured content with this n8n workflow that leverages Perplexity AI for research and GPT-4 for content transformation. Create professional blog posts and HTML content automatically while maintaining accuracy and depth.
Intelligent Research & Analysis
🚀 Automated Research Pipeline
Harnesses Perplexity AI's advanced research capabilities
Processes complex topics into structured insights
Delivers comprehensive analysis in minutes instead of hours
🧠 Smart Content Organization
Automatically structures content with clear hierarchies
Identifies and highlights key concepts
Maintains technical accuracy while improving readability
Creates SEO-friendly content structure
Content Transformation Features
📝 Dynamic Content Generation
Converts research into professional blog articles
Generates clean, responsive HTML output
Implements proper semantic structure
Includes metadata and categorization
🎨 Professional Formatting
Responsive Tailwind CSS styling
Clean, modern HTML structure
Proper heading hierarchy
Mobile-friendly layouts
Blockquote highlighting for key insights
Perfect For
📚 Content Researchers
Save hours of manual research by automating the information gathering and structuring process.
✍️ Content Writers
Focus on creativity while the workflow handles research and technical formatting.
🌐 Web Publishers
Generate publication-ready HTML content with modern styling and proper structure.
Technical Implementation
⚡ Workflow Components
Webhook endpoint for query submission
Perplexity AI integration for research
GPT-4 powered content structuring
HTML transformation engine
Telegram notification system (optional)
Transform your content creation process with an intelligent system that handles research, writing, and formatting while you focus on strategy and creativity.
|
{"id": "HnqGW0eq5asKfZxf", "meta": {"instanceId": "03907a25f048377a8789a4332f28148522ba31ee907fababf704f1d88130b1b6", "templateCredsSetupCompleted": true}, "name": "🔍🛠️Perplexity Researcher to HTML Web Page", "tags": [], "nodes": [{"id": "ad5d96c6-941a-4ab3-b349-10bae99e5988", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [320, 1360], "parameters": {"color": 3, "width": 625.851492623043, "height": 465.2493344282225, "content": "## Create Article from Perplexity Research"}, "typeVersion": 1}, {"id": "19b3ca66-5fd2-4d04-b25a-a17fb38642f8", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [1240, 1360], "parameters": {"color": 4, "width": 479.02028317328745, "height": 464.14912719677955, "content": "## Convert Article into HTML"}, "typeVersion": 1}, {"id": "7fad54e8-5a50-42da-b38d-08f6912615ab", "name": "gpt-4o-mini", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [1380, 1660], "parameters": {"model": "gpt-4o-mini-2024-07-18", "options": {"responseFormat": "text"}}, "credentials": {"openAiApi": {"id": "h597GY4ZJQD47RQd", "name": "OpenAi account"}}, "typeVersion": 1}, {"id": "5291869f-3ac6-4ce2-88f3-b572924b6082", "name": "gpt-4o-mini1", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [1560, 1040], "parameters": {"options": {"topP": 1, "timeout": 60000, "maxTokens": -1, "maxRetries": 2, "temperature": 0, "responseFormat": "text", "presencePenalty": 0, "frequencyPenalty": 0}}, "credentials": {"openAiApi": {"id": "h597GY4ZJQD47RQd", "name": "OpenAi account"}}, "typeVersion": 1}, {"id": "a232f6ca-ad4c-40fa-a641-f0dd83c8f18a", "name": "Structured Output Parser1", "type": "@n8n/n8n-nodes-langchain.outputParserStructured", "position": [640, 1660], "parameters": {"schemaType": "manual", "inputSchema": "{\n \"type\": \"object\",\n \"properties\": {\n \"article\": {\n \"type\": \"object\",\n \"required\": [\"category\", \"title\", \"metadata\", \"content\", \"hashtags\"],\n \"properties\": {\n \"category\": {\n \"type\": \"string\",\n \"description\": \"Article category\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Article title\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"properties\": {\n \"timePosted\": {\n \"type\": \"string\",\n \"description\": \"Time since article was posted\"\n },\n \"author\": {\n \"type\": \"string\",\n \"description\": \"Article author name\"\n },\n \"tag\": {\n \"type\": \"string\",\n \"description\": \"Article primary tag\"\n }\n },\n \"required\": [\"timePosted\", \"author\", \"tag\"]\n },\n \"content\": {\n \"type\": \"object\",\n \"properties\": {\n \"mainText\": {\n \"type\": \"string\",\n \"description\": \"Main article content\"\n },\n \"sections\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"description\": \"Section title\"\n },\n \"text\": {\n \"type\": \"string\",\n \"description\": \"Section content\"\n },\n \"quote\": {\n \"type\": \"string\",\n \"description\": \"Blockquote text\"\n }\n },\n \"required\": [\"title\", \"text\", \"quote\"]\n }\n }\n },\n \"required\": [\"mainText\", \"sections\"]\n },\n \"hashtags\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Article hashtags\"\n }\n }\n }\n }\n}"}, "typeVersion": 1.2}, {"id": "e7d1adac-88aa-4f76-92bf-bbac3aa6386a", "name": "gpt-4o-mini2", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [420, 1660], "parameters": {"options": {"topP": 1, "timeout": 60000, "maxTokens": -1, "maxRetries": 2, "temperature": 0, "responseFormat": "json_object", "presencePenalty": 0, "frequencyPenalty": 0}}, "credentials": {"openAiApi": {"id": "h597GY4ZJQD47RQd", "name": "OpenAi account"}}, "typeVersion": 1}, {"id": "156e51db-03f7-4099-afe8-6f0361c5b497", "name": "Webhook", "type": "n8n-nodes-base.webhook", "position": [160, 860], "webhookId": "6a8e3ae7-02ae-4663-a27a-07df448550ab", "parameters": {"path": "pblog", "options": {}, "responseMode": "responseNode"}, "typeVersion": 2}, {"id": "6dd3eba7-e779-4e4a-960e-c5a7b6b3a929", "name": "Respond to Webhook", "type": "n8n-nodes-base.respondToWebhook", "position": [2820, 1480], "parameters": {"options": {}, "respondWith": "text", "responseBody": "={{ $json.text }}"}, "typeVersion": 1.1}, {"id": "27ee681e-4259-4323-b4fe-629f99cb33d0", "name": "Telegram", "type": "n8n-nodes-base.telegram", "position": [2320, 880], "parameters": {"text": "={{ $('Perplexity Topic Agent').item.json.output.slice(0, 300) }}", "chatId": "={{ $json.telegram_chat_id }}", "additionalFields": {"parse_mode": "HTML", "appendAttribution": false}}, "credentials": {"telegramApi": {"id": "BIE64nzfpGeesXUn", "name": "Telegram account"}}, "typeVersion": 1.2}, {"id": "f437d40c-2bf6-43e2-b77b-e5c2cdc35055", "name": "gpt-4o-mini5", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [2480, 1660], "parameters": {"options": {"topP": 1, "timeout": 60000, "maxTokens": -1, "maxRetries": 2, "temperature": 0, "responseFormat": "text", "presencePenalty": 0, "frequencyPenalty": 0}}, "credentials": {"openAiApi": {"id": "h597GY4ZJQD47RQd", "name": "OpenAi account"}}, "typeVersion": 1}, {"id": "275bce4a-4252-41d4-bcba-174f0c51bf4a", "name": "Basic LLM Chain", "type": "@n8n/n8n-nodes-langchain.chainLlm", "position": [2340, 1480], "parameters": {"text": "=Create a modern, responsive single-line HTML document. Convert any markdown to Tailwind CSS classes. Replace markdown lists with proper HTML list elements. Remove all newline characters while preserving </br> tags in content. Enhance the layout with Tailwind CSS cards where appropriate. Use the following base structure, but improve the styling and responsiveness:\n\n<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1.0\">\n <title>Comprehensive Overview of DeepSeek V3</title>\n <link href=\"https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css\" rel=\"stylesheet\">\n</head>\n\n<body class=\"bg-gray-100 font-sans\">\n <div class=\"relative p-4\">\n <div class=\"max-w-3xl mx-auto text-sm\">\n <div class=\"mt-3 bg-white rounded-lg shadow-lg flex flex-col justify-between leading-normal\">\n <div class=\"p-6\">\n <h1 class=\"text-gray-900 font-bold text-4xl mb-4\">Comprehensive Overview of DeepSeek V3</h1>\n <div class=\"mb-4\">\n <p class=\"leading-8\"><strong>Time Posted:</strong> Just now</p>\n <p class=\"leading-8\"><strong>Author:</strong> AI Research Team</p>\n <p class=\"leading-8\"><strong>Tag:</strong> AI Models</p>\n </div>\n <p class=\"leading-8 my-4\"><strong>DeepSeek V3</strong> is a state-of-the-art AI model that leverages\n advanced architectures and techniques to deliver high performance across various applications.\n This overview covers its key concepts, practical applications, advantages, limitations, and best\n practices for implementation.</p>\n <section class=\"mb-6\">\n <h2 class=\"text-2xl font-bold my-3\">Key Concepts and Core Components</h2>\n <p class=\"leading-8 my-3\"><strong>1. Mixture-of-Experts (MoE) Architecture:</strong> DeepSeek V3\n employs a Mixture-of-Experts (MoE) architecture, which consists of multiple neural networks,\n each optimized for different tasks. This architecture allows for efficient processing by\n activating only a portion of the network for each task, reducing hardware costs.</p>\n <p class=\"leading-8 my-3\"><strong>2. Parameters:</strong> The model boasts a total of 671\n billion\n parameters, with 37 billion active parameters for each token during processing. The addition\n of\n the Multi-Token Prediction (MTP) module increases the total parameters to 685 billion,\n making it\n significantly larger than other models like Meta's Llama 3.1 (405B).</p>\n <p class=\"leading-8 my-3\"><strong>3. Multi-head Latent Attention (MLA):</strong> DeepSeek V3\n uses\n Multi-head Latent Attention (MLA) to extract key details from text multiple times, improving\n its\n accuracy.</p>\n <p class=\"leading-8 my-3\"><strong>4. Multi-Token Prediction (MTP):</strong> The model utilizes\n Multi-Token Prediction to generate several tokens at once, speeding up inference and\n enabling\n speculative decoding.</p>\n <blockquote\n class=\"italic leading-8 my-3 p-5 text-indigo-600 font-semibold bg-indigo-50 rounded-lg border-l-4 border-indigo-600\">\n DeepSeek V3 employs a Mixture-of-Experts architecture for efficient processing.</blockquote>\n </section>\n <section class=\"mb-6\">\n <h2 class=\"text-2xl font-bold my-3\">Practical Applications</h2>\n <ol class=\"list-decimal pl-5\">\n <li class=\"leading-8 my-3\"><strong>Translation, Coding, and Content Generation:</strong>\n DeepSeek V3 is designed for a wide range of tasks including translation, coding, content\n generation, and reasoning. It excels in English, Chinese, coding, and mathematics,\n rivaling leading commercial models like OpenAI's GPT-4.</li>\n <li class=\"leading-8 my-3\"><strong>Research and Development:</strong> The open-source nature\n of DeepSeek V3 fuels innovation, allowing researchers to experiment with and build upon\n its technology.</li>\n <li class=\"leading-8 my-3\"><strong>Commercial Applications:</strong> The licensing of\n DeepSeek V3 makes it permissible for commercial use, opening it up to numerous\n applications across different industries.</li>\n <li class=\"leading-8 my-3\"><strong>Democratization of AI:</strong> By making powerful AI\n accessible, DeepSeek V3 levels the playing field, allowing smaller organizations to\n compete with larger ones.</li>\n </ol>\n <blockquote\n class=\"italic leading-8 my-3 p-5 text-indigo-600 font-semibold bg-indigo-50 rounded-lg border-l-4 border-indigo-600\">\n DeepSeek V3 democratizes AI access for smaller organizations.</blockquote>\n </section>\n <section class=\"mb-6\">\n <h2 class=\"text-2xl font-bold my-3\">Advantages</h2>\n <ol class=\"list-decimal pl-5\">\n <li class=\"leading-8 my-3\"><strong>Speed and Efficiency:</strong> DeepSeek V3 processes\n information at a blistering 60 tokens per second, a threefold increase over its\n predecessor. It uses advanced inference capabilities, deploying 32 H800 GPUs for prefill\n and 320 H800 GPUs for decoding.</li>\n <li class=\"leading-8 my-3\"><strong>Cost-Effectiveness:</strong> The model was trained for a\n mere $5.5 million, a fraction of the estimated over $100 million invested by OpenAI in\n GPT-4. DeepSeek V3 offers significantly lower prices for its online services, with 1\n million tokens priced at just $1.1, currently offered at a promotional rate of $0.28.\n </li>\n <li class=\"leading-8 my-3\"><strong>Innovation in Inference:</strong> The model's advanced\n inference capabilities set the standard for future model deployment, making it a\n powerful tool in the digital realm.</li>\n </ol>\n <blockquote\n class=\"italic leading-8 my-3 p-5 text-indigo-600 font-semibold bg-indigo-50 rounded-lg border-l-4 border-indigo-600\">\n DeepSeek V3 processes information at 60 tokens per second.</blockquote>\n </section>\n <section class=\"mb-6\">\n <h2 class=\"text-2xl font-bold my-3\">Limitations</h2>\n <ol class=\"list-decimal pl-5\">\n <li class=\"leading-8 my-3\"><strong>Deployment Complexity:</strong> Deploying DeepSeek V3\n requires advanced hardware and a deployment strategy that separates the prefilling and\n decoding stages, which might be unachievable for small companies due to a lack of\n resources. The recommended deployment unit for DeepSeek V3 is relatively large, posing a\n burden for small-sized teams.</li>\n <li class=\"leading-8 my-3\"><strong>Potential for Further Enhancement:</strong> Although\n DeepSeek V3 has achieved an end-to-end generation speed of more than two times that of\n DeepSeek V2, there still remains potential for further enhancement with the development\n of more advanced hardware.</li>\n </ol>\n <blockquote\n class=\"italic leading-8 my-3 p-5 text-indigo-600 font-semibold bg-indigo-50 rounded-lg border-l-4 border-indigo-600\">\n Deployment of DeepSeek V3 may be complex for small companies.</blockquote>\n </section>\n <section class=\"mb-6\">\n <h2 class=\"text-2xl font-bold my-3\">Best Practices for Implementation</h2>\n <ol class=\"list-decimal pl-5\">\n <li class=\"leading-8 my-3\"><strong>Hardware Requirements:</strong> Ensure that the\n deployment environment has the necessary advanced hardware to handle the model's\n requirements, including multiple GPUs for prefill and decoding.</li>\n <li class=\"leading-8 my-3\"><strong>Deployment Strategy:</strong> Implement a deployment\n strategy that separates the prefilling and decoding stages to optimize performance and\n efficiency.</li>\n <li class=\"leading-8 my-3\"><strong>Monitoring and Optimization:</strong> Continuously\n monitor the model's performance and optimize it as needed to address any limitations and\n improve efficiency.</li>\n <li class=\"leading-8 my-3\"><strong>Community Engagement:</strong> Engage with the\n open-source community to leverage the collective knowledge and resources available,\n which can help in addressing any challenges and improving the model further.</li>\n </ol>\n <blockquote\n class=\"italic leading-8 my-3 p-5 text-indigo-600 font-semibold bg-indigo-50 rounded-lg border-l-4 border-indigo-600\">\n Engage with the open-source community for better implementation.</blockquote>\n </section>\n <p class=\"leading-8 my-6\"><strong>Hashtags:</strong> <span\n class=\"text-indigo-600\">#DeepSeekV3</span> <span class=\"text-indigo-600\">#AI</span> <span\n class=\"text-indigo-600\">#MachineLearning</span> <span\n class=\"text-indigo-600\">#OpenSource</span></p>\n </div>\n </div>\n </div>\n </div>\n</body>\n\n</html>\n\n-------\n\nRequirements:\n- Output must be a single line of HTML\n- Enhanced with modern Tailwind CSS styling\n- Proper HTML list structures\n- Responsive design\n- No newlines except </br> in content\n- No markdown formatting\n- Clean, readable layout\n- Properly formatted hashtags\n- No explanation or additional text in output\n- No code block markers or escape characters\n- Wnsure Metadata, Title and Content are included in HTML\n\nMetadata: {{ $('Article').item.json.article.metadata.toJsonString() }}\nTitle: {{ $json.title }}\nContent: {{ $json.html }}\n", "promptType": "define"}, "typeVersion": 1.4}, {"id": "cddd9324-8471-4dcb-a46b-836015db9833", "name": "Do Nothing1", "type": "n8n-nodes-base.noOp", "position": [560, 1080], "parameters": {}, "typeVersion": 1}, {"id": "432a0ae9-451a-4830-b065-8b0593de92ea", "name": "gpt-4o-mini3", "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi", "position": [1020, 1040], "parameters": {"options": {"topP": 1, "timeout": 60000, "maxTokens": -1, "maxRetries": 2, "temperature": 0, "responseFormat": "text", "presencePenalty": 0, "frequencyPenalty": 0}}, "credentials": {"openAiApi": {"id": "h597GY4ZJQD47RQd", "name": "OpenAi account"}}, "typeVersion": 1}, {"id": "55e00886-b6c1-4f7a-81ae-e8e0d4102cab", "name": "Sticky Note4", "type": "n8n-nodes-base.stickyNote", "position": [2200, 1360], "parameters": {"color": 6, "width": 531, "height": 465, "content": "## Create HTML Page with TailwindCSS Styling"}, "typeVersion": 1}, {"id": "1ed7f754-1279-4511-a085-6ed4e4c36de1", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [320, 760], "parameters": {"width": 450.54438902818094, "height": 489.5271576259337, "content": "## Parse Topic from Get Request"}, "typeVersion": 1}, {"id": "e9dcb568-7f8d-40c5-94cb-6f25386436cf", "name": "Sticky Note5", "type": "n8n-nodes-base.stickyNote", "position": [820, 760], "parameters": {"color": 5, "width": 380, "height": 488, "content": "## Improve the Users Topic"}, "typeVersion": 1}, {"id": "a7fdaddb-d6fc-4d45-85cc-a372cfb90327", "name": "If2", "type": "n8n-nodes-base.if", "position": [2120, 1140], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "8e35de0a-ac16-4555-94f4-24e97bdf4b33", "operator": {"type": "string", "operation": "notEmpty", "singleValue": true}, "leftValue": "{{ $json.output }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "57d056b8-7e91-41e4-8b74-dce15847a09b", "name": "Prompts", "type": "n8n-nodes-base.set", "position": [1300, 2080], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "efbe7563-8502-407e-bfa0-a4a26d8cddd4", "name": "user", "type": "string", "value": "={{ $('Execute Workflow Trigger').item.json.topic }}"}, {"id": "05e0b629-bb9f-4010-96a8-10872764705a", "name": "system", "type": "string", "value": "Assistant is a large language model. Assistant is designed to be able to assist with a wide range of tasks, from answering simple questions to providing in-depth explanations and discussions on a wide range of topics. As a language model, Assistant is able to generate human-like text based on the input it receives, allowing it to engage in natural-sounding conversations and provide responses that are coherent and relevant to the topic at hand. Assistant is constantly learning and improving, and its capabilities are constantly evolving. It is able to process and understand large amounts of text, and can use this knowledge to provide accurate and informative responses to a wide range of questions. Additionally, Assistant is able to generate its own text based on the input it receives, allowing it to engage in discussions and provide explanations and descriptions on a wide range of topics. Overall, Assistant is a powerful system that can help with a wide range of tasks and provide valuable insights and information on a wide range of topics. Whether you need help with a specific question or just want to have a conversation about a particular topic, Assistant is here to assist. "}]}}, "typeVersion": 3.4}, {"id": "8209cece-fde4-485f-81a1-2d24a6eac474", "name": "Execute Workflow Trigger", "type": "n8n-nodes-base.executeWorkflowTrigger", "position": [420, 2180], "parameters": {}, "typeVersion": 1}, {"id": "445e4d15-c2b0-4152-a0f8-d6b93ad5bae6", "name": "Telegram2", "type": "n8n-nodes-base.telegram", "position": [860, 2180], "parameters": {"text": "=<i>{{ $('Execute Workflow Trigger').item.json.topic }}</i>", "chatId": "={{ $json.telegram_chat_id }}", "additionalFields": {"parse_mode": "HTML", "appendAttribution": false}}, "credentials": {"telegramApi": {"id": "BIE64nzfpGeesXUn", "name": "Telegram account"}}, "typeVersion": 1.2}, {"id": "57a5b3ce-5490-4d50-91cc-c36e508eee4d", "name": "If", "type": "n8n-nodes-base.if", "position": [1080, 2180], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "7e2679dc-c898-415d-a693-c2c1e7259b6a", "operator": {"type": "string", "operation": "notContains"}, "leftValue": "={{ $('Execute Workflow Trigger').item.json.topic }}", "rightValue": "undefined"}]}}, "typeVersion": 2.2}, {"id": "fdf827dc-96b1-4ed3-895b-2a0f5f4c41a3", "name": "No Operation, do nothing", "type": "n8n-nodes-base.noOp", "position": [1300, 2300], "parameters": {}, "typeVersion": 1}, {"id": "944aa564-f449-47a6-9d9c-c20a48946ab6", "name": "Sticky Note6", "type": "n8n-nodes-base.stickyNote", "position": [320, 1940], "parameters": {"color": 5, "width": 1614, "height": 623, "content": "## 🛠️perplexity_research_tool\n\n"}, "typeVersion": 1}, {"id": "3806c079-8c08-48b7-a3ed-a26f6d86c67f", "name": "Perplexity Topic Agent", "type": "@n8n/n8n-nodes-langchain.agent", "position": [1580, 860], "parameters": {"text": "=Topic: {{ $json.text }}", "options": {"systemMessage": "Use the perplexity_research_tool to provide research on the users topic.\n\n"}, "promptType": "define", "hasOutputParser": true}, "typeVersion": 1.6}, {"id": "cfc55dbb-78e6-47ef-bf55-810311bd37e8", "name": "Call Perplexity Researcher", "type": "@n8n/n8n-nodes-langchain.toolWorkflow", "position": [1780, 1040], "parameters": {"name": "perplexity_research_tool", "fields": {"values": [{"name": "topic", "stringValue": "= {{ $json.text }}"}]}, "workflowId": {"__rl": true, "mode": "id", "value": "HnqGW0eq5asKfZxf"}, "description": "Call this tool to perform Perplexity research.", "jsonSchemaExample": "{\n \"topic\": \"\"\n}"}, "typeVersion": 1.2}, {"id": "5ca35a40-506d-4768-a65c-a331718040bc", "name": "Do Nothing", "type": "n8n-nodes-base.noOp", "position": [2320, 1140], "parameters": {}, "typeVersion": 1}, {"id": "17028837-4706-43f3-8291-f150860caa4c", "name": "Do Nothing2", "type": "n8n-nodes-base.noOp", "position": [1020, 1700], "parameters": {}, "typeVersion": 1}, {"id": "adebf1ad-62d9-4b79-b9a1-4a9395067803", "name": "Do Nothing3", "type": "n8n-nodes-base.noOp", "position": [2000, 1700], "parameters": {}, "typeVersion": 1}, {"id": "fe19e472-3b2b-4c07-b957-fb2afc426998", "name": "Do Nothing4", "type": "n8n-nodes-base.noOp", "position": [1260, 1080], "parameters": {}, "typeVersion": 1}, {"id": "41e23462-a7fa-42a8-adbc-83a662f63f0c", "name": "Sticky Note7", "type": "n8n-nodes-base.stickyNote", "position": [1460, 760], "parameters": {"color": 3, "width": 480, "height": 488, "content": "## 🤖Perform Perplexity Research"}, "typeVersion": 1}, {"id": "dcc3bd83-1f8c-4000-a832-c2c6e7c157ba", "name": "Get Topic", "type": "n8n-nodes-base.set", "position": [380, 860], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "57f0eab2-ef1b-408c-82d5-a8c54c4084a6", "name": "topic", "type": "string", "value": "={{ $json.query.topic }}"}]}}, "typeVersion": 3.4}, {"id": "5572e5b1-0b4c-4e6d-b413-5592aab59571", "name": "If Topic Exists", "type": "n8n-nodes-base.if", "position": [560, 860], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "2c565aa5-0d11-47fb-8621-6db592579fa8", "operator": {"type": "string", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ $json.topic }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "509ee61f-defb-41e8-84cf-70ac5a7448d0", "name": "Improve Users Topic", "type": "@n8n/n8n-nodes-langchain.chainLlm", "position": [880, 860], "parameters": {"text": "=How would you improve the following prompt as of {{ $now }}, focusing on:\n\n1. Key Concepts & Definitions\n - Main terminology and foundational concepts\n - Technical background and context\n\n2. Core Components\n - Essential elements and their relationships\n - Critical processes and workflows\n\n3. Practical Applications\n - Real-world use cases\n - Implementation considerations\n\n4. Analysis & Insights\n - Advantages and limitations\n - Best practices and recommendations\n\nThe final output should be a maximum 2 sentence pure text prompt without any preamble or further explanation. The final output will be providced to Perplexity as a research prompt.\n\nPrompt to analyze: {{ $json.topic }}", "promptType": "define"}, "typeVersion": 1.4}, {"id": "69ee4c6a-f6ef-47a2-bd5c-ccaf49ec7c94", "name": "If Topic", "type": "n8n-nodes-base.if", "position": [1260, 860], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "329653d4-330f-4b41-96e7-4652c1448902", "operator": {"type": "string", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ $json.text }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "daa3027b-774d-44b1-b0a5-27008768c65d", "name": "Chat Id", "type": "n8n-nodes-base.set", "position": [2120, 880], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "0aa8fcc9-26f4-485c-8fc1-a5c13d0dd279", "name": "telegram_chat_id", "type": "number", "value": 1234567890}]}}, "typeVersion": 3.4}, {"id": "97f32ad1-f91e-4ccc-8248-d10da823b26a", "name": "Article", "type": "n8n-nodes-base.set", "position": [780, 1480], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "0eb5952b-c133-4b63-8102-d4b8ec7b9b5a", "name": "article", "type": "object", "value": "={{ $json.output.article }}"}]}}, "typeVersion": 3.4}, {"id": "e223dee3-c79f-421d-b2b8-2f3551a45f71", "name": "Extract JSON", "type": "@n8n/n8n-nodes-langchain.agent", "position": [440, 1480], "parameters": {"text": "=Extract a JSON object from this content: {{ $json.output }}", "options": {}, "promptType": "define", "hasOutputParser": true}, "retryOnFail": true, "typeVersion": 1.6}, {"id": "de8aafb6-b05d-4278-8719-9b3c266fcf3a", "name": "If Article", "type": "n8n-nodes-base.if", "position": [1020, 1480], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "329653d4-330f-4b41-96e7-4652c1448902", "operator": {"type": "string", "operation": "notEmpty", "singleValue": true}, "leftValue": "{{ $json.article }}", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "f9450b58-3b81-4b61-8cbf-2cdf5a2f56a0", "name": "Create HTML Article", "type": "@n8n/n8n-nodes-langchain.agent", "position": [1360, 1480], "parameters": {"text": "=Convert this verbatim into HTML: {{ $json.article.toJsonString() }}\n\n## Formatting Guidelines\n- HTML document must be single line document without tabs or line breaks\n- Use proper HTML tags throughout\n- Do not use these tags: <html> <body> <style> <head>\n- Use <h1> tag for main title\n- Use <h2> tags for secondary titles\n- Structure with <p> tags for paragraphs\n- Include appropriate spacing\n- Use <blockquote> for direct quotes\n- Maintain consistent formatting\n- Write in clear, professional tone\n- Break up long paragraphs\n- Use engaging subheadings\n- Include transitional phrases\n\nThe final JSON response should contain only the title and content fields, with the content including all HTML formatting.\n{\n\t\"title\": \"the title\",\n\t\"content\": \"the HTML\"\n}", "agent": "conversationalAgent", "options": {}, "promptType": "define"}, "retryOnFail": true, "typeVersion": 1.6}, {"id": "53cbaa6e-6508-48e3-9a5a-58f5bc111c2d", "name": "If HTML", "type": "n8n-nodes-base.if", "position": [1780, 1480], "parameters": {"options": {}, "conditions": {"options": {"version": 2, "leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "329653d4-330f-4b41-96e7-4652c1448902", "operator": {"type": "string", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ $json.output.parseJson().title }}", "rightValue": ""}, {"id": "0a05f73a-2901-4157-8194-cb81d259ce71", "operator": {"type": "string", "operation": "notEmpty", "singleValue": true}, "leftValue": "={{ $json.output.parseJson().content }}", "rightValue": ""}, {"id": "b61c1d25-a010-42d3-9f9d-fa927c483bae", "operator": {"name": "filter.operator.equals", "type": "string", "operation": "equals"}, "leftValue": "", "rightValue": ""}]}}, "typeVersion": 2.2}, {"id": "33e4e2cd-be0c-4fc9-b705-b0e8aac496f9", "name": "Contents", "type": "n8n-nodes-base.set", "position": [2000, 1480], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "af335333-acb8-4c9e-8184-d20cd03e08f6", "name": "title", "type": "string", "value": "={{ $json.output.parseJson().title }}"}, {"id": "7fbd2264-c0e1-4bdc-b754-b0faa538879c", "name": "content", "type": "string", "value": "={{ $json.output.parseJson().content }}"}]}}, "typeVersion": 3.4}, {"id": "8bf36853-8a04-4a0b-8715-e03a8fc8359d", "name": "Chat Id1", "type": "n8n-nodes-base.set", "position": [660, 2180], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "0aa8fcc9-26f4-485c-8fc1-a5c13d0dd279", "name": "telegram_chat_id", "type": "number", "value": 1234567890}]}}, "typeVersion": 3.4}, {"id": "a3fe75d1-8db0-45cb-87f6-76fc27cb59f6", "name": "Sticky Note3", "type": "n8n-nodes-base.stickyNote", "position": [600, 2080], "parameters": {"width": 420, "height": 340, "content": "## Optional"}, "typeVersion": 1}, {"id": "22e9edbc-7aa6-4549-ae9f-2c31ad7d0542", "name": "Sticky Note8", "type": "n8n-nodes-base.stickyNote", "position": [2060, 760], "parameters": {"width": 420, "height": 340, "content": "## Optional"}, "typeVersion": 1}, {"id": "e62ff7d5-bd54-434c-b048-0dc7cd2c7f9b", "name": "Success Response", "type": "n8n-nodes-base.set", "position": [1700, 2080], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "eb89464a-5919-4962-880c-3f5903e267de", "name": "response", "type": "string", "value": "={{ $('Perplexity').item.json.choices[0].message.content }}"}]}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "c6ba0613-47c6-442f-99e8-0eaec8cacc20", "name": "Error Response", "type": "n8n-nodes-base.set", "position": [1700, 2300], "parameters": {"options": {}, "assignments": {"assignments": [{"id": "eb89464a-5919-4962-880c-3f5903e267de", "name": "response", "type": "string", "value": "=Error. No topic provided."}]}, "includeOtherFields": true}, "typeVersion": 3.4}, {"id": "30d8065c-55d8-4099-abb2-ddb01635129d", "name": "Perplexity", "type": "n8n-nodes-base.httpRequest", "position": [1500, 2080], "parameters": {"url": "https://api.perplexity.ai/chat/completions", "method": "POST", "options": {}, "jsonBody": "={\n \"model\": \"llama-3.1-sonar-small-128k-online\",\n \"messages\": [\n {\n \"role\": \"system\",\n \"content\": \"{{ $json.system }}\"\n },\n {\n \"role\": \"user\",\n \"content\": \"{{ $json.user }}\"\n }\n ],\n \"max_tokens\": \"4000\",\n \"temperature\": 0.2,\n \"top_p\": 0.9,\n \"return_citations\": true,\n \"search_domain_filter\": [\n \"perplexity.ai\"\n ],\n \"return_images\": false,\n \"return_related_questions\": false,\n \"search_recency_filter\": \"month\",\n \"top_k\": 0,\n \"stream\": false,\n \"presence_penalty\": 0,\n \"frequency_penalty\": 1\n}", "sendBody": true, "specifyBody": "json", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth"}, "credentials": {"httpCustomAuth": {"id": "vxjFugFpr4Od6gws", "name": "Confluence REST API"}, "httpHeaderAuth": {"id": "wokWVLDQUDi0DC7I", "name": "Perplexity"}}, "typeVersion": 4.2}], "active": false, "settings": {"executionOrder": "v1"}, "versionId": "9ebf0569-4d9d-4783-b797-e5df2a8e8415", "connections": {"If": {"main": [[{"node": "Prompts", "type": "main", "index": 0}], [{"node": "No Operation, do nothing", "type": "main", "index": 0}]]}, "If2": {"main": [[{"node": "Extract JSON", "type": "main", "index": 0}], [{"node": "Do Nothing", "type": "main", "index": 0}]]}, "Article": {"main": [[{"node": "If Article", "type": "main", "index": 0}]]}, "Chat Id": {"main": [[{"node": "Telegram", "type": "main", "index": 0}]]}, "If HTML": {"main": [[{"node": "Contents", "type": "main", "index": 0}], [{"node": "Do Nothing3", "type": "main", "index": 0}]]}, "Prompts": {"main": [[{"node": "Perplexity", "type": "main", "index": 0}]]}, "Webhook": {"main": [[{"node": "Get Topic", "type": "main", "index": 0}]]}, "Chat Id1": {"main": [[{"node": "Telegram2", "type": "main", "index": 0}]]}, "Contents": {"main": [[{"node": "Basic LLM Chain", "type": "main", "index": 0}]]}, "If Topic": {"main": [[{"node": "Perplexity Topic Agent", "type": "main", "index": 0}], [{"node": "Do Nothing4", "type": "main", "index": 0}]]}, "Get Topic": {"main": [[{"node": "If Topic Exists", "type": "main", "index": 0}]]}, "Telegram2": {"main": [[{"node": "If", "type": "main", "index": 0}]]}, "If Article": {"main": [[{"node": "Create HTML Article", "type": "main", "index": 0}], [{"node": "Do Nothing2", "type": "main", "index": 0}]]}, "Perplexity": {"main": [[{"node": "Success Response", "type": "main", "index": 0}]]}, "gpt-4o-mini": {"ai_languageModel": [[{"node": "Create HTML Article", "type": "ai_languageModel", "index": 0}]]}, "Extract JSON": {"main": [[{"node": "Article", "type": "main", "index": 0}]]}, "gpt-4o-mini1": {"ai_languageModel": [[{"node": "Perplexity Topic Agent", "type": "ai_languageModel", "index": 0}]]}, "gpt-4o-mini2": {"ai_languageModel": [[{"node": "Extract JSON", "type": "ai_languageModel", "index": 0}]]}, "gpt-4o-mini3": {"ai_languageModel": [[{"node": "Improve Users Topic", "type": "ai_languageModel", "index": 0}]]}, "gpt-4o-mini5": {"ai_languageModel": [[{"node": "Basic LLM Chain", "type": "ai_languageModel", "index": 0}]]}, "Basic LLM Chain": {"main": [[{"node": "Respond to Webhook", "type": "main", "index": 0}]]}, "If Topic Exists": {"main": [[{"node": "Improve Users Topic", "type": "main", "index": 0}], [{"node": "Do Nothing1", "type": "main", "index": 0}]]}, "Create HTML Article": {"main": [[{"node": "If HTML", "type": "main", "index": 0}]]}, "Improve Users Topic": {"main": [[{"node": "If Topic", "type": "main", "index": 0}]]}, "Perplexity Topic Agent": {"main": [[{"node": "If2", "type": "main", "index": 0}, {"node": "Chat Id", "type": "main", "index": 0}]]}, "Execute Workflow Trigger": {"main": [[{"node": "Chat Id1", "type": "main", "index": 0}]]}, "No Operation, do nothing": {"main": [[{"node": "Error Response", "type": "main", "index": 0}]]}, "Structured Output Parser1": {"ai_outputParser": [[{"node": "Extract JSON", "type": "ai_outputParser", "index": 0}]]}, "Call Perplexity Researcher": {"ai_tool": [[{"node": "Perplexity Topic Agent", "type": "ai_tool", "index": 0}]]}}}
|
"You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and e(...TRUNCATED)
| "Video Guide\n\nI prepared a comprehensive guide detailing how to create a Smart Agent that automate(...TRUNCATED)
| "{\"nodes\": [{\"id\": \"38972c5c-09f4-4120-a468-731e720914e1\", \"name\": \"AI Agent\", \"type\": \(...TRUNCATED)
|
"You are an expert n8n workflow generation assistant. Your goal is to create valid, efficient, and e(...TRUNCATED)
| "Introduction:\n\nThis workflow template helps you determine if a Twitch user's stream is currently (...TRUNCATED)
| "{\"nodes\": [{\"id\": \"fcd82fb8-4ba9-4379-96fd-4dca17a35fa3\", \"name\": \"Document\", \"type\": \(...TRUNCATED)
|
End of preview.