Workflow: Set Workflow
Integrations: clearbit, filter, gmail, googleCalendar, html, httpRequest, merge, openAi, scheduleTrigger, set, splitOut, stickyNote, switch

{"meta": {"instanceId": "workflow-0f635519", "versionId": "1.0.0", "createdAt": "2025-09-29T07:07:52.489349", "updatedAt": "2025-09-29T07:07:52.489390", "owner": "n8n-user", "license": "MIT", "category": "automation", "status": "active", "priority": "high", "environment": "production"}, "nodes": [{"id": "ed18a0ab-ac62-469e-9490-d9fcf75b4606", "name": "Setup", "type": "n8n-nodes-base.set", "position": [-700, 320], "parameters": {"fields": {"values": [{"name": "linkedInAPIKey"}, {"name": "twitterAPIKey"}, {"name": "emails"}]}, "options": {}}, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "d6624796-3f59-4077-8d41-4418c869ad27", "name": "Every morning @ 7", "type": "n8n-nodes-base.scheduleTrigger", "position": [-940, 320], "parameters": {"rule": {"interval": [{"triggerAtHour": 7}]}}, "typeVersion": 1.1, "notes": "This scheduleTrigger node performs automated tasks as part of the workflow."}, {"id": "1cb46dc8-c2b5-487c-a382-a5714686be50", "name": "Get meetings for today", "type": "n8n-nodes-base.googleCalendar", "position": [-300, 320], "parameters": {"options": {"timeMax": "={{ $today.plus({ days: 1 }) }}", "timeMin": "={{ $today.minus({ days: 3 }) }}", "singleEvents": true}, "calendar": {"__rl": true, "mode": "list", "value": "milorad.filipovic19@gmail.com", "cachedResultName": "milorad.filipovic19@gmail.com"}, "operation": "getAll"}, "credentials": {"googleCalendarOAuth2Api": {"id": "{{ $credentials.googleCalendarOAuth2Api.id }}", "name": "Google Calendar account"}}, "typeVersion": 1, "notes": "This googleCalendar node performs automated tasks as part of the workflow."}, {"id": "22167c9c-6dc2-41a8-a8b8-218643b943e5", "name": "Get attendees email domains", "type": "n8n-nodes-base.set", "position": [-80, 320], "parameters": {"fields": {"values": [{"name": "domain", "type": "arrayValue", "arrayValue": "={{ $json.attendees.filter(a => !a.organizer).map(a => a.email.split('@').pop()) }}"}, {"name": "attendeeEmails", "type": "arrayValue", "arrayValue": "={{ $json.attendees.filter(a => !a.organizer).map(a => a.email) }}"}]}, "options": {}}, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "271d0044-ceb1-4e3a-9a60-9c003cd4b198", "name": "Split Out", "type": "n8n-nodes-base.splitOut", "position": [140, 320], "parameters": {"include": "selectedOtherFields", "options": {}, "fieldToSplitOut": "domain", "fieldsToInclude": "attendeeEmails, start"}, "typeVersion": 1, "notes": "This splitOut node performs automated tasks as part of the workflow."}, {"id": "68041cd4-6dc3-4225-b39e-d227a3142e02", "name": "Get recent LinkedIn posts", "type": "n8n-nodes-base.httpRequest", "position": [-20, 540], "parameters": {"url": "{{ $env.API_BASE_URL }}", "options": {"batching": {"batch": {}}}, "sendQuery": true, "sendHeaders": true, "queryParameters": {"parameters": [{"name": "linkedin_url", "value": "={{ $env.WEBHOOK_URL }}{{ $json.linkedin.handle }}"}, {"name": "sort_by", "value": "recent"}]}, "headerParameters": {"parameters": [{"name": "X-RapidAPI-Key", "value": "={{ $('Setup').item.json.linkedInAPIKey }}"}, {"name": "X-RapidAPI-Host", "value": "fresh-linkedin-profile-data.p.rapidapi.com"}]}}, "typeVersion": 4.1, "notes": "This httpRequest node performs automated tasks as part of the workflow."}, {"id": "bcbc845c-dd69-491e-b18d-7e1cd73d94b4", "name": "Enrich attendee company", "type": "n8n-nodes-base.clearbit", "position": [580, 320], "parameters": {"domain": "={{ $json.domain }}", "additionalFields": {}}, "credentials": {"clearbitApi": {"id": "tuwO0i7CavIt5j8X", "name": "Clearbit account"}}, "typeVersion": 1, "notes": "This clearbit node performs automated tasks as part of the workflow."}, {"id": "a928a47a-c7be-4b08-ae78-05541963bf0e", "name": "Gmail", "type": "n8n-nodes-base.gmail", "position": [1360, 640], "parameters": {"sendTo": "={{ $('Setup').first().json.emails }}", "message": "={{ $json.html }}", "options": {}, "subject": "=Latest social activity for: {{ $('Wrap everything together').item.json.name }}"}, "credentials": {"gmailOAuth2": {"id": "{{ $credentials.gmailOAuth2.id }}", "name": "mrdosija@gmail.com"}}, "typeVersion": 2.1, "notes": "This gmail node performs automated tasks as part of the workflow."}, {"id": "cc82d1ef-5601-4844-b2c1-91cb7d16c080", "name": "Combine all activity for a company", "type": "n8n-nodes-base.merge", "position": [460, 620], "parameters": {"mode": "combine", "options": {"clashHandling": {"values": {"resolveClash": "preferInput2"}}}, "joinMode": "keepEverything", "mergeByFields": {"values": [{"field1": "name", "field2": "name"}]}}, "typeVersion": 2.1, "notes": "This merge node performs automated tasks as part of the workflow."}, {"id": "d0843f1d-173c-4c6a-8ef7-be122551ce03", "name": "Extract data for email", "type": "n8n-nodes-base.set", "position": [680, 800], "parameters": {"fields": {"values": [{"name": "attendeeEmail", "stringValue": "={{ $json.meeting.attendeeEmails.find(a => a.endsWith($json.meeting.domain)) }}"}, {"name": "startHour", "type": "numberValue", "numberValue": "={{ DateTime.fromISO($json.meeting.start.dateTime).hour }}"}, {"name": "startMinute", "type": "numberValue", "numberValue": "={{ DateTime.fromISO($json.meeting.start.dateTime).minute }}"}]}, "include": "selected", "options": {}, "includeFields": "name, html_twitter, html_linkedin"}, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "7bbb4100-7529-4b33-8301-6e312e15d0c3", "name": "Prepare email template", "type": "n8n-nodes-base.html", "position": [1140, 640], "parameters": {"html": "<!DOCTYPE html>\n\n<html>\n<head>\n  <meta charset=\"UTF-8\" />\n\n</head>\n<body>\n  <div class=\"container\">\n     <h2 style=\"font-size: 1.2em\">\n      \ud83d\uddd3\ufe0f Meeting with <span>{{ $json.attendeeEmail }}</span>\n       at {{ $json.startHour }}:{{ $json.startMinute < 10 ? `0${$json.startMinute}` : $json.startMinute }}h\n       <h3>Here's a quick summary of {{ $json.name }}'s recent social media activities</h3>\n       <p class=\"summary\">\n         {{ $json.message.content }}\n       </p>\n    </h2>\n\n  </div>\n</body>\n</html>\n\n<style>\n.container {\n  font-family: sans-serif;\n}\n\n.summary {\n  background-color: #f7f9fc; \n  font-family: sans-serif; \n  padding: 0.3em 1em\n}\n</style>"}, "typeVersion": 1.1, "notes": "This html node performs automated tasks as part of the workflow."}, {"id": "0ebfe036-0988-4775-bff4-1e52ba81fd12", "name": "Sticky Note", "type": "n8n-nodes-base.stickyNote", "position": [-773.5590877677955, 50.38078783690389], "parameters": {"color": 7, "width": 409.31582584657923, "height": 426.61520915049425, "content": "## Start here\n1\ufe0f\u20e3 Register on [RapidAPI]({{ $env.API_BASE_URL }} and subscribe to these two APIs:\n- [Fresh LinkedIn Profile Data]({{ $env.API_BASE_URL }}\n- [Twitter]({{ $env.API_BASE_URL }}\n\n\n2\ufe0f\u20e3 Set API keys for these two in `linkedInAPIKey` and `twitterAPIKey`fields of this node\n\n3\ufe0f\u20e3 Set email addresses that should receive the list in the `emails` field of this node"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "3fcc1786-757f-49fd-842c-9f77c2a869a4", "name": "Sticky Note1", "type": "n8n-nodes-base.stickyNote", "position": [-474, 620], "parameters": {"color": 7, "width": 334.90628250854803, "height": 282.9114150520537, "content": "\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u2139\ufe0f If you need to get activities from more social media accounts found by ClearBit, they can be added here, just make sure to process them properly in separate switch node branches"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "0eb689e9-f347-482c-b6f3-de9913696eec", "name": "Keep only ones with the domain", "type": "n8n-nodes-base.filter", "position": [360, 320], "parameters": {"options": {}, "conditions": {"options": {"leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "881d891e-ea17-4879-a5cf-72d08b281f56", "operator": {"type": "string", "operation": "exists", "singleValue": true}, "leftValue": "={{ $json.domain }}", "rightValue": ""}]}}, "typeVersion": 2, "notes": "This filter node performs automated tasks as part of the workflow."}, {"id": "9c479fe7-b0da-402a-bc4e-1c52b0bcb677", "name": "Extract important data", "type": "n8n-nodes-base.set", "position": [220, 540], "parameters": {"fields": {"values": [{"name": "linkedin_posts", "type": "arrayValue", "arrayValue": "={{ $input.item.json.data.slice(0, 10).map(d => { return { text: d.text, likes: d.num_likes, comments: d.num_comments, postedAt: d.posted } } ) }}"}, {"name": "name", "stringValue": "={{ $('Switch').item.json.name }}"}, {"name": "meeting", "type": "objectValue", "objectValue": "={{ $('Split Out').item.json }}"}]}, "include": "none", "options": {}}, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "4956210f-4797-4266-acb7-b80684f76052", "name": "Extract important data again", "type": "n8n-nodes-base.set", "position": [220, 740], "parameters": {"fields": {"values": [{"name": "twitter_posts", "type": "arrayValue", "arrayValue": "={{ $input.item.json.results.map(d => { return { text: d.text, favorites: d.favorite_count, retweets: d.retweet_count, replies: d.reply_count, postedAt: d.creationDate} }) }}"}, {"name": "name", "stringValue": "={{ $('Switch').item.json.name }}"}, {"name": "meeting", "type": "objectValue", "objectValue": "={{ $('Split Out').item.json }}"}]}, "include": "none", "options": {}}, "typeVersion": 3.2, "notes": "This set node performs automated tasks as part of the workflow."}, {"id": "fda56f50-ebc8-4259-9155-017f09a64f26", "name": "Ask AI to summerize", "type": "n8n-nodes-base.openAi", "position": [680, 620], "parameters": {"prompt": {"messages": [{"content": "=I am a sales representative in my company and I want to see social media activity for a company I am about to meet. I will give you a JSON object  containing company name, and lists of recent LinkedIn and X(Twitter) posts and your job is to give me a summary these posts. This summary needs to be in textual form suitable for email (just the content without the subject and should be impersonal) and should include details interested to a sales representative such as me. JSON data has the following properties: - 'name': Company name, - 'linkedin_posts': List of LinkedIn posts, - 'twitter_posts': List of Twitter posts, You can ignore all other properties in the JSON data. This is the data:\n{{ JSON.stringify($json) }}"}]}, "options": {}, "resource": "chat", "chatModel": "gpt-4"}, "credentials": {"openAiApi": {"id": "fN3KsfZMEf9qu6J6", "name": "OpenAi account 3"}}, "typeVersion": 1.1, "notes": "This openAi node performs automated tasks as part of the workflow."}, {"id": "0c082a02-72b3-47d8-9a62-ca5973eed8be", "name": "Switch", "type": "n8n-nodes-base.switch", "position": [-260, 640], "parameters": {"rules": {"values": [{"outputKey": "YOUR_CREDENTIAL_HERE", "conditions": {"options": {"leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"operator": {"type": "boolean", "operation": "true", "singleValue": true}, "leftValue": "={{ $json.linkedin.handle !== null }}", "rightValue": ""}]}, "renameOutput": true}, {"outputKey": "YOUR_CREDENTIAL_HERE", "conditions": {"options": {"leftValue": "", "caseSensitive": true, "typeValidation": "strict"}, "combinator": "and", "conditions": [{"id": "bbb0310e-8b20-4bc6-a540-a4cd17470e28", "operator": {"type": "boolean", "operation": "true", "singleValue": true}, "leftValue": "={{ $json.twitter.id !== null }}", "rightValue": ""}]}, "renameOutput": true}]}, "options": {"allMatchingOutputs": true, "looseTypeValidation": false}}, "typeVersion": 3, "notes": "This switch node performs automated tasks as part of the workflow."}, {"id": "e1cf0a2e-834b-4259-91e4-47e13c07c321", "name": "Wrap everything together", "type": "n8n-nodes-base.merge", "position": [940, 640], "parameters": {"mode": "combine", "options": {}, "combinationMode": "mergeByPosition"}, "typeVersion": 2.1, "notes": "This merge node performs automated tasks as part of the workflow."}, {"id": "e45f33ec-6d67-4ae9-a450-5c300c8748b1", "name": "Sticky Note2", "type": "n8n-nodes-base.stickyNote", "position": [780, 197.44186046511595], "parameters": {"color": 5, "width": 738.9631933644362, "height": 399.8417061497098, "content": "### \ud83d\udcec You will receive one email for every company in your calendar. These emails will look something like this:\n\n![Email example]({{ $env.WEBHOOK_URL }}"}, "typeVersion": 1, "notes": "This stickyNote node performs automated tasks as part of the workflow."}, {"id": "31d22fdc-aacf-4228-ac78-b8f05621c0e0", "name": "Get latest tweets", "type": "n8n-nodes-base.httpRequest", "position": [-20, 740], "parameters": {"url": "{{ $env.API_BASE_URL }}", "options": {"batching": {"batch": {"batchSize": 1, "batchInterval": 2000}}}, "sendQuery": true, "sendHeaders": true, "queryParameters": {"parameters": [{"name": "limit", "value": "10"}, {"name": "user_id", "value": "={{ $json.twitter.id }}"}, {"name": "include_replies", "value": "={{ false }}"}, {"name": "include_pinned", "value": "={{ false }}"}]}, "headerParameters": {"parameters": [{"name": "X-RapidAPI-Host", "value": "twitter154.p.rapidapi.com"}, {"name": "X-RapidAPI-Key", "value": "={{ $('Setup').first().json.twitterAPIKey }}"}]}}, "typeVersion": 4.1, "notes": "This httpRequest node performs automated tasks as part of the workflow."}], "pinData": {}, "connections": {"68041cd4-6dc3-4225-b39e-d227a3142e02": {"main": [[{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-b5cc7dae", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-dff661bc", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-cb46244a", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-9dcc94f2", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-09316eb5", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-c1bfa607", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-cd954ccc", "type": "main", "index": 0}], [{"node": "error-handler-68041cd4-6dc3-4225-b39e-d227a3142e02-419b67b8", "type": "main", "index": 0}]]}, "31d22fdc-aacf-4228-ac78-b8f05621c0e0": {"main": [[{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-68169725", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-12549318", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-3e185ca2", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-be2b3a5a", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-0abb388c", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-e9385452", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-37ccfc67", "type": "main", "index": 0}], [{"node": "error-handler-31d22fdc-aacf-4228-ac78-b8f05621c0e0-958bc12a", "type": "main", "index": 0}]]}, "1cb46dc8-c2b5-487c-a382-a5714686be50": {"main": [[{"node": "error-handler-1cb46dc8-c2b5-487c-a382-a5714686be50-daae261a", "type": "main", "index": 0}]]}, "fda56f50-ebc8-4259-9155-017f09a64f26": {"main": [[{"node": "error-handler-fda56f50-ebc8-4259-9155-017f09a64f26-46d5dcf7", "type": "main", "index": 0}]]}}, "name": "Set Workflow", "settings": {"executionOrder": "v1", "saveManualExecutions": true, "callerPolicy": "workflowsFromSameOwner", "errorWorkflow": null, "timezone": "UTC", "executionTimeout": 3600, "maxExecutions": 1000, "retryOnFail": true, "retryCount": 3, "retryDelay": 1000}, "description": "Automated workflow: Set Workflow. This workflow integrates 14 different services: stickyNote, httpRequest, filter, scheduleTrigger, clearbit. It contains 27 nodes and follows best practices for error handling and security.", "tags": ["automation", "n8n", "production-ready", "excellent", "optimized"], "notes": "Excellent quality workflow: Set Workflow. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}