# templates

name: LinkedIn Auto Message Router and Responder with Request Detection
author_name: Angel Menendez
author_username: djangelic
categories: []
created_at: 2025-06-12T00:34:35.995Z
updated_at: 2025-06-12T00:34:35.995Z
url: https://n8n.io/workflows/4889
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?

  Public-facing professionals (developer advocates, founders, marketers, content creators) who get bombarded with LinkedIn messages that aren't actually for them - support requests when you're in marketing, sales inquiries when you're a devrel, partnership pitches when you handle content, etc.

  What problem is this workflow solving?

  When you're visible online, people assume you handle everything at your company. You end up spending hours daily playing human router, forwarding messages like "How do I reset my password?" or "What's your enterprise pricing?" to the right teams. This LinkedIn automation workflow stops you from being your company's unofficial customer service representative.

  What this workflow does

  This AI-powered LinkedIn DM management workflow automatically assesses incoming LinkedIn messages and routes them intelligently:

  Automated Message Assessment: Receives inbound LinkedIn messages via UniPile and looks up sender details from both personal and company LinkedIn profiles.

  Smart Route Matching: Compares the message content against your message routing workflow table in Notion, which contains:
    Question: "How can I become an n8n ambassador?"
    Description: "Route here when a user is requesting to become an n8n ambassador. Also when they're asking how they could do more to evangelize n8n in their city, or to start organizing n8n meetups and events in their city."
    Action: "Tell the user to open the following notion page which has details on ambassador program including how to apply, as well as perks of the program: https://www.notion.so/n8n-Ambassador-Program-d883b2a130e5448faedbebe5139187ea?pvs=21"

  AI Response Generation: When a message matches an existing route, this AI assistant generates a personalized response draft based on the "Action" instructions from your routing table.

  Human-in-the-Loop Approval: Sends the draft response to Slack with approve/reject buttons, so you maintain control while saving time. Draft can be edited from within Slack on desktop and mobile.

  Automated LinkedIn Responses: Once approved, sends the reply back via LinkedIn and marks the original message as handled.

  The result: You stop being a human switchboard and can focus on your actual job while people still get helpful, timely responses through automated customer service. You can also add routes for things you do handle but get asked about daily (like 'How do I join your beta?' or 'What's your content strategy?') to standardize your responses.

  Setup

  Sign up for a UniPile account and create a webhook under the Messaging section
  Set the callback URL to this workflow's production URL
  Generate a UniPile API key with all required scopes and store it in your n8n credentials
  Create a Slack app and enable interactive message buttons and webhooks

  Here is a slack App manifest template for easy deployment in slack:

  {
      "display_information": {
          "name": "Request Router",
          "description": "A bot that alerts when a new linkedin question comes in.",
          "background_color": "#12575e"
      },
      "features": {
          "bot_user": {
              "display_name": "Request Router",
              "always_online": false
          }
      },
      "oauth_config": {
          "scopes": {
              "bot": [
                  "chat:write",
                  "chat:write.customize",
                  "chat:write.public",
                  "links:write",
                  "im:history",
                  "im:read",
                  "im:write"
              ]
          }
      },
      "settings": {
          "interactivity": {
              "is_enabled": true,
              "request_url": "Your webhook url here"
          },
          "org_deploy_enabled": false,
          "socket_mode_enabled": false,
          "token_rotation_enabled": false
      }
  }


  Set up your Notion database with the three-column structure (Question, Description, Action)
  Configure the AI node with your preferred provider (OpenAI, Gemini, Ollama etc)
  Replace placeholder LinkedIn user and organization IDs with your own

  How to customize this workflow to your needs

  Database Options**: Swap Notion with Google Sheets, Airtable, or another database
  Filtering Logic**: Add custom filters based on keywords, message length, follower count, or business logic
  AI Customization**: Adjust the system prompt to match your brand tone and response goals
  Approval Platform**: Replace Slack with email, Discord, or another review platform
  Team Routing**: Use Slack metadata to route approvals to specific team members based on message category
  Enrichment**: Add secondary data enrichment using tools like Clearbit or FullContact
  Response Rules**: Create conditional logic for different response types based on sender profile or message content

  Perfect for anyone who's tired of being their company's accidental customer service department while trying to do their real job.

  This LinkedIn automation template was inspired by a live build done by Max Tkacz and Angel Menendez for The Studio.

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.slack","n8n-nodes-base.notion","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.outputParserStructured"]

workflow_json:
  {"meta":{"instanceId":"cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7","templateCredsSetupCompleted":true},"nodes":[{"id":"5f71a0e6-d5ec-4712-9feb-2b10a1b0a3ea","name":"Webhook","type":"n8n-nodes-base.webhook","position":[0,0],"webhookId":"12a0b328-1d39-44b4-b29d-9ac465cf134b","parameters":{"path":"12a0b328-1d39-44b4-b29d-9ac465cf134b","options":{},"httpMethod":"POST"},"typeVersion":2},{"id":"bd66537c-6fe5-4877-9127-3b78af08c499","name":"Check if from me","type":"n8n-nodes-base.if","position":[440,0],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"711303bb-aef2-4cff-b4c7-c2a898e454ac","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.sender_id }}","rightValue":"OzJlgZHDXWi0PmxVdqnPOQ"},{"id":"d115500d-8e14-4b8e-b0ed-4e26a895bb37","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.sender_id }}","rightValue":"9va5ul-NUYejvzb7ADJzuw"}]}},"typeVersion":2.2},{"id":"e14aedab-47e9-4811-b991-ee0d00290c39","name":"Response, No action","type":"n8n-nodes-base.noOp","position":[700,120],"parameters":{},"typeVersion":1},{"id":"8adbb07e-4897-4421-b581-c963b754aa2b","name":"New Message","type":"n8n-nodes-base.noOp","position":[680,-140],"parameters":{},"typeVersion":1},{"id":"39865ae2-a266-47ba-a6fd-c9b1f5d5a931","name":"Global Variables","type":"n8n-nodes-base.set","position":[220,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"5483f235-49d0-404d-82dd-fd5688671044","name":"type","type":"string","value":"={{ $json.body.account_info.type }}"},{"id":"d737da4a-cc6f-4dc5-a8b7-0fd60f6a45b5","name":"message","type":"string","value":"={{ $json.body.message }}"},{"id":"924bd124-4ef1-4f41-8a3d-819d97f053e2","name":"message_id","type":"string","value":"={{ $json.body.message_id }}"},{"id":"c05786b0-b2af-4d87-a111-aae969ce50e9","name":"chat_id","type":"string","value":"={{ $json.body.chat_id }}"},{"id":"342fd20c-81be-42c7-aa85-a525fa9760fb","name":"sender","type":"string","value":"={{ $json.body.sender.attendee_name }}"},{"id":"b40f55d7-928e-436f-90b7-b4048cd80423","name":"sender_profile","type":"string","value":"={{ $json.body.sender.attendee_profile_url }}"},{"id":"efb12c87-42f5-4087-82b8-8dbda5aaf465","name":"sender_id","type":"string","value":"={{ $json.body.sender.attendee_id }}"}]}},"typeVersion":3.4},{"id":"3c58401c-cb83-4d71-9469-7563d6ce9c16","name":"Slack Button Press","type":"n8n-nodes-base.webhook","position":[0,800],"webhookId":"e3182811-630a-4959-b91c-71d8c8093e1c","parameters":{"path":"e3182811-630a-4959-b91c-71d8c8093e1c","options":{},"httpMethod":"POST","responseMode":"responseNode"},"typeVersion":2},{"id":"b87d4806-423b-4656-bbd6-9d0808242cc4","name":"Parse Webhook","type":"n8n-nodes-base.set","position":[480,800],"parameters":{"options":{},"assignments":{"assignments":[{"id":"94e30709-cf7a-4131-bc89-dbe56f8f3b16","name":"body.payload","type":"object","value":"={{ $json.body.payload }}"}]}},"typeVersion":3.4},{"id":"ee147347-1a88-4e96-9580-d08285e901c0","name":"Verify Webhook","type":"n8n-nodes-base.respondToWebhook","position":[240,800],"parameters":{"options":{"responseCode":200,"responseHeaders":{"entries":[{"name":"Content-type","value":"application/json"}]}},"respondWith":"json","responseBody":"={\"challenge\":\"{{ $json.body.challenge }}\"}"},"typeVersion":1},{"id":"ac2cb5e1-394a-4a5c-a999-a56d315bc3ff","name":"Check if approved","type":"n8n-nodes-base.if","position":[1140,580],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"cf275c3e-347d-4028-8209-682f52d540e3","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.payload.actions[0].value.action }}","rightValue":"approve"}]}},"typeVersion":2.2},{"id":"3812b521-2e15-4c24-9883-79ef04fc6cb3","name":"Send User Message","type":"n8n-nodes-base.slack","position":[4080,-100],"webhookId":"e3624af3-3604-4d6a-b776-e3860b51b24e","parameters":{"text":"=New LinkedIn Message from {{ $('Webhook').item.json.body.sender.attendee_name }}","user":{"__rl":true,"mode":"id","value":"U07G1JBR76W"},"select":"user","blocksUi":"={\n  \"blocks\": [\n    {\n      \"type\": \"section\",\n      \"block_id\": \"profile_card\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"👤*<{{ $('Webhook').item.json.body.sender.attendee_profile_url }}|{{ $('Webhook').item.json.body.sender.attendee_name }}>*\\n\\n💼 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].headline }}\\n\\n📍 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].location }}\\n👥 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].follower_count }} followers | 🔗 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].connections_count }} connections\"\n      },\n      \"accessory\": {\n        \"type\": \"image\",\n        \"image_url\": \"{{ $('Set all potential Inputs').item.json.linkedinprofile[0].profile_picture_url }}\",\n        \"alt_text\": \"LinkedIn Profile Picture\"\n      }\n    },\n    {\n      \"type\": \"section\",\n      \"block_id\": \"incoming_message\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"*📩 <https://www.linkedin.com/messaging/thread/{{ $('Webhook').item.json.body.provider_chat_id }}/|New LinkedIn Message>:*\\n> {{ $('Global Variables').item.json.message.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\"\n      }\n    },\n    {\n      \"type\": \"input\",\n      \"block_id\": \"ai_response\",\n      \"element\": {\n        \"type\": \"plain_text_input\",\n        \"action_id\": \"response_input\",\n        \"multiline\": true,\n        \"initial_value\": \"{{ $('AI Agent').item.json.output.output.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\",\n        \"placeholder\": {\n          \"type\": \"plain_text\",\n          \"text\": \"Edit the AI-generated response before approving...\"\n        }\n      },\n      \"label\": {\n        \"type\": \"plain_text\",\n        \"text\": \"🤖 Suggested Reply\"\n      }\n    },\n    {\n      \"type\": \"actions\",\n      \"block_id\": \"actions_block\",\n      \"elements\": [\n        {\n          \"type\": \"button\",\n          \"action_id\": \"approve_response\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"✅ Approve\"\n          },\n          \"style\": \"primary\",\n          \"value\": \"{\\\"action\\\":\\\"approve\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n        },\n        {\n          \"type\": \"button\",\n          \"action_id\": \"archive_message\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"🗃️ Archive\"\n          },\n          \"style\": \"danger\",\n          \"value\": \"{\\\"action\\\":\\\"archive\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n        }\n      ]\n    }\n  ]\n}\n","messageType":"block","otherOptions":{}},"credentials":{"slackApi":{"id":"6xKmxBfKWNPnre2E","name":"Request Router"}},"typeVersion":2.3},{"id":"7470b927-8a4d-4421-b6d3-cc55623d77dd","name":"Send Org Message","type":"n8n-nodes-base.slack","position":[4080,60],"webhookId":"9a621f5a-854e-4725-81c4-3ce075d87d96","parameters":{"text":"=New LinkedIn Message from {{ $('Webhook').item.json.body.sender.attendee_name }}","user":{"__rl":true,"mode":"id","value":"U07G1JBR76W"},"select":"user","blocksUi":"={\n  \"blocks\": [\n    {\n      \"type\": \"section\",\n      \"block_id\": \"profile_card_org\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"🏢*<{{ $('Webhook').item.json.body.sender.attendee_profile_url }}|{{ $('Webhook').item.json.body.sender.attendee_name }}>*\\n\\n💼 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].headline }}\\n\\n📍 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].location }}\\n👥 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].follower_count }} followers | 🧑‍💼 {{ $('Set all potential Inputs').item.json.linkedinprofile[0].employee_count }} employees\"\n      },\n      \"accessory\": {\n        \"type\": \"image\",\n        \"image_url\": \"{{ $('Set all potential Inputs').item.json.linkedinprofile[0].profile_picture_url }}\",\n        \"alt_text\": \"Organization Profile Picture\"\n      }\n    },\n    {\n      \"type\": \"section\",\n      \"block_id\": \"incoming_message\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"*📩 New LinkedIn Message:*\\n> {{ $('Global Variables').item.json.message.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\"\n      }\n    },\n    {\n      \"type\": \"input\",\n      \"block_id\": \"ai_response\",\n      \"element\": {\n        \"type\": \"plain_text_input\",\n        \"action_id\": \"response_input\",\n        \"multiline\": true,\n        \"initial_value\": \"{{ $('AI Agent').item.json.output.output.replace(/\\n/g, '\\\\n').replace(/\\\"/g, '\\\\\"') }}\",\n        \"placeholder\": {\n          \"type\": \"plain_text\",\n          \"text\": \"Edit the AI-generated response before approving...\"\n        }\n      },\n      \"label\": {\n        \"type\": \"plain_text\",\n        \"text\": \"🤖 Suggested Reply\"\n      }\n    },\n    {\n      \"type\": \"actions\",\n      \"block_id\": \"actions_block\",\n      \"elements\": [\n        {\n          \"type\": \"button\",\n          \"action_id\": \"approve_response\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"✅ Approve\"\n          },\n          \"style\": \"primary\",\n          \"value\": \"{\\\"action\\\":\\\"approve\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n        },\n        {\n          \"type\": \"button\",\n          \"action_id\": \"archive_message\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"🗃️ Archive\"\n          },\n          \"style\": \"danger\",\n          \"value\": \"{\\\"action\\\":\\\"archive\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n        }\n      ]\n    }\n  ]\n}\n","messageType":"block","otherOptions":{}},"credentials":{"slackApi":{"id":"6xKmxBfKWNPnre2E","name":"Request Router"}},"typeVersion":2.3},{"id":"0c63c0e7-752d-4bd7-ab78-23a1ff4d70ae","name":"Send Nothing Found Message","type":"n8n-nodes-base.slack","position":[4080,220],"webhookId":"64dddbb2-1bf6-4a5a-884b-057b82596ef1","parameters":{"user":{"__rl":true,"mode":"id","value":"U07G1JBR76W"},"select":"user","blocksUi":"={\n  \"blocks\": [\n    {\n      \"type\": \"section\",\n      \"block_id\": \"incoming_message\",\n      \"text\": {\n        \"type\": \"mrkdwn\",\n        \"text\": \"*New LinkedIn Message:*\\n> {{ $('Global Variables').item.json.message.replace(/\\n/g, '\\\\n').replace(/\"/g, '\\\\\"') }}\"\n      }\n    },\n    {\n      \"type\": \"input\",\n      \"block_id\": \"ai_response\",\n      \"element\": {\n        \"type\": \"plain_text_input\",\n        \"action_id\": \"response_input\",\n        \"multiline\": true,\n        \"initial_value\": \"{{ $json.output.output.replace(/\\n/g, '\\\\n').replace(/\"/g, '\\\\\"') }}\",\n        \"placeholder\": {\n          \"type\": \"plain_text\",\n          \"text\": \"Edit the AI-generated response before approving...\"\n        }\n      },\n      \"label\": {\n        \"type\": \"plain_text\",\n        \"text\": \"Suggested Reply\"\n      }\n    },\n    {\n      \"type\": \"actions\",\n      \"block_id\": \"actions_block\",\n      \"elements\": [\n        {\n          \"type\": \"button\",\n          \"action_id\": \"approve_response\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"✅ Approve\"\n          },\n          \"style\": \"primary\",\n          \"value\": \"{\\\"action\\\":\\\"approve\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n        },\n        {\n          \"type\": \"button\",\n          \"action_id\": \"archive_message\",\n          \"text\": {\n            \"type\": \"plain_text\",\n            \"text\": \"🗃️ Archive\"\n          },\n          \"style\": \"danger\",\n          \"value\": \"{\\\"action\\\":\\\"archive\\\",\\\"message_id\\\":\\\"{{ $('Global Variables').item.json.message_id }}\\\",\\\"channel_id\\\":\\\"{{ $('Global Variables').item.json.chat_id }}\\\"}\"\n        }\n      ]\n    }\n  ]\n}\n","messageType":"block","otherOptions":{}},"credentials":{"slackApi":{"id":"6xKmxBfKWNPnre2E","name":"Request Router"}},"typeVersion":2.3},{"id":"fb29432d-7603-4b42-902f-7784459dd40d","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-80,-420],"parameters":{"color":7,"width":980,"height":720,"content":"![unipile](https://uploads.n8n.io/templates/unipile.png)\n## LinkedIn Message Processing\nReceives the LinkedIn message via Unipile api webhook."},"typeVersion":1},{"id":"388d621c-7339-4d74-a2c4-4da9c41a441f","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[-80,320],"parameters":{"color":7,"width":2097,"height":693,"content":"![Slack](https://uploads.n8n.io/templates/slack.png)\n## Slack Bot Button Press\nThis workflow gets the button presses from the Slack interface and passes it along to Unipile for processing."},"typeVersion":1},{"id":"13ed0034-df98-46a8-931c-4e87667e624c","name":"Decide on Message Type","type":"n8n-nodes-base.switch","position":[3760,-80],"parameters":{"rules":{"values":[{"outputKey":"User","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"4670af46-5774-4fec-8b12-a608aefa3d89","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $('Set all potential Inputs').item.json.linkedinprofile[0].type }}","rightValue":"user"}]},"renameOutput":true},{"outputKey":"Organization","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0a484630-343d-4b9a-9bf0-6ef5bd9b1b4b","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Set all potential Inputs').item.json.linkedinprofile[0].type }}","rightValue":"organization"}]},"renameOutput":true}]},"options":{"fallbackOutput":"extra"}},"typeVersion":3.2},{"id":"e4c36cc2-9ad1-4ceb-8698-05079c9c6509","name":"User Switcher","type":"n8n-nodes-base.switch","position":[680,800],"parameters":{"rules":{"values":[{"outputKey":"angel","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"27c0a3cc-b768-4aba-bab0-19971fb2d38d","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.body.payload.user.id }}","rightValue":"U07G1JBR76W"}]},"renameOutput":true},{"outputKey":"max","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b16b07b2-c77b-439f-9acb-e7799dceaa6b","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.body.payload.user.id }}","rightValue":"U035CE97JGM"}]},"renameOutput":true}]},"options":{}},"typeVersion":3.2},{"id":"f84186be-8ded-47c5-8bdb-9366c8be59fa","name":"Isolate Message and Payload","type":"n8n-nodes-base.set","position":[920,580],"parameters":{"options":{},"assignments":{"assignments":[{"id":"2a9278cb-3f2a-4f90-852a-3ca16b404c58","name":"message","type":"string","value":"={{ $json.body.payload.state.values.ai_response.response_input.value }}"},{"id":"3c16c98d-a7db-42e9-aacd-9ede379b1f49","name":"body.payload.actions[0].value","type":"object","value":"={{ $json.body.payload.actions[0].value }}"}]}},"typeVersion":3.4},{"id":"7dc03482-8c14-4494-a475-3f958a1fd445","name":"Isolate Payload","type":"n8n-nodes-base.set","position":[920,820],"parameters":{"options":{},"assignments":{"assignments":[{"id":"f334a7f4-4c85-466c-8278-3da5dd5a2486","name":"body","type":"object","value":"={{ $('Slack Button Press').item.json.body.payload }}"}]}},"typeVersion":3.4},{"id":"425b2b79-447d-4736-9edf-0033969d64b4","name":"Send webhook to Coworker Workflow","type":"n8n-nodes-base.httpRequest","position":[1140,820],"parameters":{"url":"https://n8n.cloud/webhook/89659f10-574e-s42c-530d-e7dd9158d177","method":"POST","options":{}},"typeVersion":4.2},{"id":"4c36fc5c-75a5-4279-9555-13fdfa033510","name":"Send Message to LinkedIn via Unipile","type":"n8n-nodes-base.httpRequest","position":[1380,520],"parameters":{"url":"=https://api9.unipile.com:13976/api/v1/chats/{{ $json.body.payload.actions[0].value.channel_id }}/messages","method":"POST","options":{},"sendBody":true,"contentType":"form-urlencoded","sendHeaders":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"text","value":"={{ $('Isolate Message and Payload').item.json.message }}"}]},"genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"accept","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"VfYHlcsosNuUS2YD","name":"unipile angel"}},"typeVersion":4.2},{"id":"bed8608b-b474-4472-87ad-1e3454799a81","name":"Delete Approved Message from Slack","type":"n8n-nodes-base.slack","position":[1680,520],"webhookId":"08e7c073-569a-4400-aa60-80c7cddf8b03","parameters":{"select":"channel","channelId":{"__rl":true,"mode":"id","value":"={{ $('User Switcher').item.json.body.payload.channel.id }}"},"operation":"delete","timestamp":"={{ $('User Switcher').item.json.body.payload.container.message_ts }}"},"credentials":{"slackApi":{"id":"6xKmxBfKWNPnre2E","name":"Request Router"}},"typeVersion":2.3},{"id":"b79429a6-3b46-4898-a933-3b6ec77a1f97","name":"Delete Denied Message from Slack","type":"n8n-nodes-base.slack","position":[1680,720],"webhookId":"70630dad-c2a5-4c40-aef3-070994ce4b83","parameters":{"select":"channel","channelId":{"__rl":true,"mode":"id","value":"={{ $('User Switcher').item.json.body.payload.channel.id }}"},"operation":"delete","timestamp":"={{ $('User Switcher').item.json.body.payload.container.message_ts }}"},"credentials":{"slackApi":{"id":"6xKmxBfKWNPnre2E","name":"Request Router"}},"typeVersion":2.3},{"id":"9a475e01-a250-44f2-8cc6-4ef60aedaa36","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[3220,-80],"parameters":{"text":"=Sender Name: {{ $('Isolate parent workflow data for AI').item.json.sender }}\nSender Message: {{ $('Isolate parent workflow data for AI').item.json.message }}\nMy Name: Your Name\n\nIf found, the linkedin profile will be below, pay close attention to the number of followers and connections: \n{{ $('Set all potential Inputs').item.json.linkedinprofile.toJsonString() }}","options":{"systemMessage":"=You are an expert professional assistant designed to help generate smart, personalized responses to LinkedIn messages.\n\nYou will be provided with:\n1. The **incoming message** and name from a LinkedIn user.\n2. A **database of past requests and responses**. These are known message types and the preferred replies.\n3. Context about the assistant's voice and tone.\n\n### Your Objective:\n- First, scan the database for any message that closely matches the incoming LinkedIn message. If a match is found, use the **corresponding response** as a base — you may slightly tailor it if needed (e.g., change names or dates).\n- If no close match is found, generate a **new, thoughtful reply** based on the message content, tone guidelines, and best practices in business networking. If you do not have a direct link or URL to provide from the Request Database, do not reference a website or URL. Instead say a variation of let me get back to you on that and see what I can find. \n\n### Tone Guidelines:\n- Friendly, confident, and professional — but never robotic.\n- Lightly personalized. Use the sender’s name if available.\n- Avoid sounding like a sales pitch.\n- Keep replies concise and natural, like something you'd actually send on LinkedIn.\n\n### When generating a new message:\n- Acknowledge the sender’s message.\n- Add a relevant, helpful comment or question to continue the conversation.\n- Keep the tone warm and open-ended.\n\n### Output format:\nOnly output the message text that should be sent to the user. Do not explain your reasoning. If you do not have a direct link to provide, do not reference a website or URL. Instead say let me get back to you on that and see what I can find. \n\nLet’s begin.\nRequest Database:\n\n{{ $json.dbObject.join('\\n\\n----\\n\\n') }}\n\nWhen responding, use the following format:\n{\n\t\"output\": \"message response\",\n\t\"found\": true\n}\nFor output output the message response, for found output a boolean, true if an example is found in the Request Database, false if a response is not found. The output is going to slack so ensure you escape your outputs like new lines. "},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"53011c4c-b9aa-4b47-84c8-060e4b7a2db9","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[3340,160],"parameters":{"sessionKey":"={{ $('Isolate parent workflow data for AI').item.json.chatid }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"b5eb7520-c887-4a72-89d0-d616c24fdfca","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[3120,180],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"QpFZ2EiM3WGl6Zr3","name":"Marketing OpenAI"}},"typeVersion":1.2},{"id":"b405f410-4d76-43f9-b21c-b6cb363daa43","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[3500,160],"parameters":{"jsonSchemaExample":"{\n\t\"output\": \"message response\",\n\t\"found\": true\n}"},"typeVersion":1.2},{"id":"8ad9d20b-07a4-46f2-9dbb-5d3d8d502641","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[3020,-400],"parameters":{"color":7,"width":668,"height":718,"content":"![hctiapi](https://uploads.n8n.io/templates/openai.png)\n## Generate Automated response\nThe AI bot receives not only the message from LinkedIn, but also LinkedIn user context, such as the number of followers and connections, allowing for tailored responses. For example if a user asks to meet, but they don't meet a certain number of followers threshold, they are politely declined. However if an influencer reaches out, they are automatically given a booking link to ensure that high priority requests are immediately followed up on. "},"typeVersion":1},{"id":"8d593035-111a-45dc-93ea-950aad7b0ebb","name":"Isolate parent workflow data for AI","type":"n8n-nodes-base.set","position":[2260,20],"parameters":{"options":{},"assignments":{"assignments":[{"id":"91a1191e-bac0-4b8b-b263-a03c63435470","name":"sender","type":"string","value":"={{ $('Global Variables').item.json.sender }}"},{"id":"0f8c17c8-d598-4840-8b89-8dbdcd529231","name":"message","type":"string","value":"={{ $('Global Variables').item.json.message }}"},{"id":"c9132b69-5e0e-4ccf-86bb-0e4cfa734860","name":"chatid","type":"string","value":"={{ $('Global Variables').item.json.chat_id }}"}]}},"typeVersion":3.4},{"id":"d267a541-a739-49b8-a2f6-b8afbb6cc837","name":"Get Request Router Directory Database","type":"n8n-nodes-base.notion","position":[2460,20],"parameters":{"options":{},"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"mode":"list","value":"1da5b6e0-c94f-8086-80b6-eab8e340d60e","cachedResultUrl":"https://www.notion.so/1da5b6e0c94f808680b6eab8e340d60e","cachedResultName":"RequestRouterDB"}},"credentials":{"notionApi":{"id":"2B3YIiD4FMsF9Rjn","name":"Angelbot Notion"}},"typeVersion":2.2},{"id":"af762a13-5774-4608-a221-7860dce3f27c","name":"Format DB data for AI Context","type":"n8n-nodes-base.set","position":[2660,20],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c4ac8c33-a220-4c07-bc0d-dc7ba7cc068e","name":"dbObject","type":"string","value":"=Request Example: {{ $json.name }}\n--\nRequest Description: {{ $json.property_request_description }}\n--\nRequest Action: {{ $json.property_request_action }}"}]}},"typeVersion":3.4},{"id":"88da9528-2a4c-426a-bd27-8caa47bed3f5","name":"Aggregate DB objects into one item","type":"n8n-nodes-base.aggregate","position":[2860,20],"parameters":{"options":{},"fieldsToAggregate":{"fieldToAggregate":[{"fieldToAggregate":"dbObject"}]}},"typeVersion":1},{"id":"204ce89b-9443-4ece-8385-cb3b59bd5a0b","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[2180,-400],"parameters":{"color":7,"width":826,"height":700,"content":"![notion](https://uploads.n8n.io/templates/notionlogo.png)\n## Get routing Database data\nAn AI bot that does not get smarter over time is not a useful bot. That is why this bot references a shared internal database where requests routing can be updated without having to touch the n8n workflows. When a request comes in that does not have a standardized process, the AI will generate a response based on its model training. You can use this as a starting point, but when this becomes a pattern, simply updating the notion database instantly upgrades the AI bot. Not only that, but others can update the database, not only giving the AI context, but also creating a centralized location for standardized processes for handling different request types. This can be adapted for any platform, not just linkedIn, such as shared email inboxes, shared social media pages, and even for support requests. "},"typeVersion":1},{"id":"d4a894d6-334b-4abe-9d1a-0e449da46b6f","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[920,-540],"parameters":{"color":7,"width":1246,"height":840,"content":"![Linkedin](https://uploads.n8n.io/templates/linkedinlogo.png))\n## Enrich LinkedIn Data with User or Org Data from Unipile\nLinkedIn messages arrive from one of two object types, users or organizations. This workflow extracts the user data and passes it along. If the user is not found, then the Organization endpoint is searched instead. If it's found, it send that, otherwise it sends a not found object. "},"typeVersion":1},{"id":"ec186db1-e7e8-480e-a94a-d4c1de5ee420","name":"Get Linkedin User Data from Unipile","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[980,-140],"parameters":{"url":"=https://api9.unipile.com:13976/api/v1/users/{{ $('Webhook').item.json.body.sender.attendee_provider_id }}","options":{},"sendQuery":true,"sendHeaders":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"account_id","value":"-oWmWRkASjKGUZadYcjcyg"}]},"headerParameters":{"parameters":[{"name":"accept","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"VfYHlcsosNuUS2YD","name":"unipile angel"}},"typeVersion":4.2},{"id":"d3fb953a-f3cf-4005-934c-b091bb784d84","name":"Set User Data from Unipile","type":"n8n-nodes-base.set","position":[1240,-280],"parameters":{"options":{},"assignments":{"assignments":[{"id":"aee91408-b68d-472e-8c3e-89260dd38c1c","name":"first_name","type":"string","value":"={{ $json.first_name }}"},{"id":"57b3be6f-ba76-48c3-8f2e-1d9bb03d0dd5","name":"last_name","type":"string","value":"={{ $json.last_name }}"},{"id":"75167f30-96d6-4442-9542-9d1b8e17fcb6","name":"headline","type":"string","value":"={{ $json.headline }}"},{"id":"3e8bccc1-04a9-49f6-8053-eba22fe8d2f4","name":"websites","type":"array","value":"={{ $json.websites }}"},{"id":"2e3dd2fe-5f71-4d19-bee8-085dd9bfc18c","name":"follower_count","type":"number","value":"={{ $json.follower_count }}"},{"id":"ac5cc567-3c4f-481c-b229-9dc1e48d39fb","name":"connections_count","type":"number","value":"={{ $json.connections_count }}"},{"id":"6bad07a6-4641-48cb-b436-fb735319865f","name":"location","type":"string","value":"={{ $json.location }}"},{"id":"029fa351-f49f-4388-a59e-5719fcf8a506","name":"profile_picture_url","type":"string","value":"={{ $json.profile_picture_url }}"},{"id":"2f96dca6-acee-41c0-83b5-00cd406d3301","name":"is_influencer","type":"boolean","value":"={{ $json.is_influencer }}"},{"id":"4278e070-ce56-4993-b637-57ac60e83a49","name":"is_premium","type":"boolean","value":"={{ $json.is_premium }}"},{"id":"b92c38f1-1423-4b7e-a807-320d13e0a944","name":"shared_connections_count","type":"number","value":"={{ $json.shared_connections_count }}"},{"id":"96b24500-e6a4-444a-806c-0b61a1f00407","name":"type","type":"string","value":"user"}]}},"typeVersion":3.4},{"id":"c6077ddb-362d-45f4-a497-2529348148ab","name":"Group in one object - User","type":"n8n-nodes-base.aggregate","position":[1420,-280],"parameters":{"options":{},"aggregate":"aggregateAllItemData","destinationFieldName":"linkedinprofile"},"typeVersion":1},{"id":"1eb09bf7-fb93-4c19-bc41-86330c7b33e6","name":"Get Linkedin Org Data from Unipile","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[1240,80],"parameters":{"url":"=https://api9.unipile.com:13976/api/v1/linkedin/company/{{ $('Webhook').item.json.body.sender.attendee_provider_id }}","options":{},"sendQuery":true,"sendHeaders":true,"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","queryParameters":{"parameters":[{"name":"account_id","value":"-oWmWRkASjKGUZadYcjcyg"}]},"headerParameters":{"parameters":[{"name":"accept","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"VfYHlcsosNuUS2YD","name":"unipile angel"}},"typeVersion":4.2},{"id":"38f5ed6f-9302-4979-b964-c1d231a344b6","name":"Set Linkedin Org Data from Unipile","type":"n8n-nodes-base.set","position":[1520,-80],"parameters":{"options":{},"assignments":{"assignments":[{"id":"aee91408-b68d-472e-8c3e-89260dd38c1c","name":"first_name","type":"string","value":"={{ $json.name }}"},{"id":"57b3be6f-ba76-48c3-8f2e-1d9bb03d0dd5","name":"last_name","type":"string","value":"="},{"id":"75167f30-96d6-4442-9542-9d1b8e17fcb6","name":"headline","type":"string","value":"={{ $json.description }}"},{"id":"3e8bccc1-04a9-49f6-8053-eba22fe8d2f4","name":"websites","type":"string","value":"={{ $json.website }}"},{"id":"2e3dd2fe-5f71-4d19-bee8-085dd9bfc18c","name":"follower_count","type":"number","value":"={{ $json.followers_count }}"},{"id":"ac5cc567-3c4f-481c-b229-9dc1e48d39fb","name":"employee_count","type":"number","value":"={{ $json.employee_count_range.from }}"},{"id":"6bad07a6-4641-48cb-b436-fb735319865f","name":"location","type":"string","value":"={{ $json.locations[0].street.join(' ') }}, {{ $json.locations[0].city }} {{ $json.locations[0].area }}, {{ $json.locations[0].postalCode }} {{ $json.locations[0].country }}."},{"id":"89035aa7-e7bb-46eb-9f4b-633e2c17478a","name":"hashtags","type":"array","value":"={{ $json.hashtags }}"},{"id":"25b0abe6-aef7-4d6f-88ea-5fcbd3472089","name":"profile_picture_url","type":"string","value":"={{ $json.logo }}"},{"id":"decf44b7-520e-4977-9df5-276c5117d8e4","name":"type","type":"string","value":"organization"}]}},"typeVersion":3.4},{"id":"45bd4b50-01e6-468b-815a-58073c137693","name":"Group in one object - Org","type":"n8n-nodes-base.aggregate","position":[1720,-80],"parameters":{"options":{},"aggregate":"aggregateAllItemData","destinationFieldName":"linkedinprofile"},"typeVersion":1},{"id":"c97c50b6-b491-43cd-8eb6-e48b368c862e","name":"Set unable to find data object","type":"n8n-nodes-base.set","position":[1640,120],"parameters":{"options":{},"assignments":{"assignments":[{"id":"438518ca-d55a-45d5-9210-0c53de7ae108","name":"linkedinprofile","type":"string","value":"Unable to find LinkedIn Data"},{"id":"2d0595aa-bdd4-46e3-9f4d-e13e69c5a7a9","name":"type","type":"string","value":"none"}]}},"typeVersion":3.4},{"id":"b42b967a-b127-458c-94b6-7a81052e6ba1","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[3700,-400],"parameters":{"color":7,"width":857,"height":813,"content":"![Slack](https://uploads.n8n.io/templates/slack.png)\n## Slack Bot Button Press\nThis workflow gets the button presses from the Slack interface and passes it along to Unipile for processing."},"typeVersion":1},{"id":"48da88b3-beac-4c52-bf0c-460bc4d525fb","name":"Set all potential Inputs","type":"n8n-nodes-base.set","position":[2020,-80],"parameters":{"options":{},"includeOtherFields":true},"typeVersion":3.4},{"id":"7e091689-7905-4101-8dc9-0609b4f80233","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-60,-180],"parameters":{"color":3,"height":360,"content":"#### Add me to Unipile Webhook Dashboard\nEnsure that you have created a webhook in the Unipile dashboard that links to this node. [Link to Webhook Dashboard](https://dashboard.unipile.com/webhooks)"},"typeVersion":1},{"id":"97da9488-0e37-42c0-8dbf-912731fc5091","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-60,540],"parameters":{"color":3,"height":420,"content":"#### Add me to your Slack App Interactivity and Shortcuts\nTo receive button presses in this webhook, ensure that you've created a slack app and then set the webhook URL in the Interactivity & Shortcuts tab to this production URL. Use our App Manifest template to quickly deploy the app with the correct scopes. [Link to template with App Manifest](https://dashboard.unipile.com/webhooks)"},"typeVersion":1},{"id":"c9be1dca-da24-4f18-b2a4-36f89b7520a1","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[940,-300],"parameters":{"width":180,"height":320,"content":"#### Update Credentials\nEnsure to use generic header auth. The name for the header is X-API-KEY. [Link to access token page on Unipile Site](https://dashboard.unipile.com/access-tokens)"},"typeVersion":1},{"id":"6e81a9bf-1c50-4366-9bae-be6241fc7875","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[1200,-80],"parameters":{"width":180,"height":320,"content":"#### Update Credentials\nEnsure to use generic header auth. The name for the header is X-API-KEY. [Link to access token page on Unipile Site](https://dashboard.unipile.com/access-tokens)"},"typeVersion":1},{"id":"d8d5d5d1-6fe4-4f03-95cb-4d3cb6182f59","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[2400,-80],"parameters":{"width":220,"height":280,"content":"#### Update Credentials\nDoes not have to be notion, can be any database type node like Google sheets. "},"typeVersion":1},{"id":"6a8202e9-e3c0-48db-b894-a009d801bddd","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[380,-180],"parameters":{"width":220,"height":340,"content":"#### Update with your Unipile UserID\nEasiest way to do this is to send a message to someone so it triggers this workflow and then copy the senderID that shows in this node"},"typeVersion":1},{"id":"36b271d3-53f6-4548-bf3f-8dea39e05b05","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[3060,60],"parameters":{"width":220,"height":240,"content":"#### Update Credentials"},"typeVersion":1},{"id":"2391f630-e071-4720-81c8-7937452e0523","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[4020,-160],"parameters":{"width":220,"height":560,"content":"#### Update Credentials"},"typeVersion":1},{"id":"c533f8ea-1391-4b2f-81ba-2caa8a919e3b","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[1320,360],"parameters":{"width":220,"height":340,"content":"#### Update Credentials\nEnsure to use generic header auth. The name for the header is X-API-KEY. [Link to access token page on Unipile Site](https://dashboard.unipile.com/access-tokens)"},"typeVersion":1},{"id":"6f0ef5cc-ef53-4a02-bdd9-5931c9ba8a0e","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[1620,460],"parameters":{"width":220,"height":460,"content":"#### Update Credentials"},"typeVersion":1}],"pinData":{},"connections":{"Webhook":{"main":[[{"node":"Global Variables","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Decide on Message Type","type":"main","index":0}]]},"New Message":{"main":[[{"node":"Get Linkedin User Data from Unipile","type":"main","index":0}]]},"Parse Webhook":{"main":[[{"node":"User Switcher","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"User Switcher":{"main":[[{"node":"Isolate Message and Payload","type":"main","index":0}],[{"node":"Isolate Payload","type":"main","index":0}]]},"Verify Webhook":{"main":[[{"node":"Parse Webhook","type":"main","index":0}]]},"Isolate Payload":{"main":[[{"node":"Send webhook to Coworker Workflow","type":"main","index":0}]]},"Check if from me":{"main":[[{"node":"New Message","type":"main","index":0}],[{"node":"Response, No action","type":"main","index":0}]]},"Global Variables":{"main":[[{"node":"Check if from me","type":"main","index":0}]]},"Check if approved":{"main":[[{"node":"Send Message to LinkedIn via Unipile","type":"main","index":0}],[{"node":"Delete Denied Message from Slack","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Slack Button Press":{"main":[[{"node":"Verify Webhook","type":"main","index":0}]]},"Decide on Message Type":{"main":[[{"node":"Send User Message","type":"main","index":0}],[{"node":"Send Org Message","type":"main","index":0}],[{"node":"Send Nothing Found Message","type":"main","index":0}]]},"Set all potential Inputs":{"main":[[{"node":"Isolate parent workflow data for AI","type":"main","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"AI Agent","type":"ai_outputParser","index":0}]]},"Group in one object - Org":{"main":[[{"node":"Set all potential Inputs","type":"main","index":0}]]},"Group in one object - User":{"main":[[{"node":"Set all potential Inputs","type":"main","index":0}]]},"Set User Data from Unipile":{"main":[[{"node":"Group in one object - User","type":"main","index":0}]]},"Isolate Message and Payload":{"main":[[{"node":"Check if approved","type":"main","index":0}]]},"Format DB data for AI Context":{"main":[[{"node":"Aggregate DB objects into one item","type":"main","index":0}]]},"Set unable to find data object":{"main":[[{"node":"Set all potential Inputs","type":"main","index":0}]]},"Aggregate DB objects into one item":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Get Linkedin Org Data from Unipile":{"main":[[{"node":"Set Linkedin Org Data from Unipile","type":"main","index":0}],[{"node":"Set unable to find data object","type":"main","index":0}]]},"Set Linkedin Org Data from Unipile":{"main":[[{"node":"Group in one object - Org","type":"main","index":0}]]},"Get Linkedin User Data from Unipile":{"main":[[{"node":"Set User Data from Unipile","type":"main","index":0}],[{"node":"Get Linkedin Org Data from Unipile","type":"main","index":0}]]},"Isolate parent workflow data for AI":{"main":[[{"node":"Get Request Router Directory Database","type":"main","index":0}]]},"Send Message to LinkedIn via Unipile":{"main":[[{"node":"Delete Approved Message from Slack","type":"main","index":0}]]},"Get Request Router Directory Database":{"main":[[{"node":"Format DB data for AI Context","type":"main","index":0}]]}}}


name: Personalized LinkedIn Responses with OpenAI GPT & Notion-based Routing
author_name: Angel Menendez
author_username: djangelic
categories: []
created_at: 2025-06-12T00:44:08.589Z
updated_at: 2025-06-12T00:44:08.589Z
url: https://n8n.io/workflows/4891
scraped_at: 2025-07-06 21:16:30
description:
  Who is this for?

  This workflow is for professionals and teams who want to automate LinkedIn message replies with intelligent, human-like responses — without losing control over tone or accuracy. Ideal for founders, sales teams, DevRel, or community managers handling high-volume inbound messages.

  What problem is this workflow solving?

  Responding to every LinkedIn message manually is slow and inconsistent. Basic AI bots generate replies without context or nuance. This subworkflow solves both problems by using structured message routing from Notion and profile insights from UniPile to craft smart, context-aware responses.

  What this workflow does

  This workflow takes the sender’s message and profile (from LinkedIn Auto Message Router with Request Detection) and references your centralized Notion database of message types. It uses that to either match the message to a known response or generate a new one using OpenAI's GPT model — all while following professional tone guidelines.

  This is the third workflow in a 3-part automation system:

  Receives data from LinkedIn Auto Message Router with Request Detection
  Uses UniPile LinkedIn Profile Lookup Subworkflow to enrich responses based on follower count or org data

  Example Use Case

  If a message comes from someone with low reach (e.g., under 1,000 followers), the AI politely deflects a meeting request. If an influencer reaches out, the AI immediately offers a booking link. Your team controls this logic by updating the Notion database — no edits to the workflow required.

  Setup

  Connect this workflow as a subworkflow in your router or Slack approval flow
  Store your Notion API key and database ID in n8n
  Provide the following parent inputs:
     message – The LinkedIn message text
     sender – Name of the sender
     chatid – Session ID (optional for memory)
     linkedinprofile – Enriched array with LinkedIn context (follower count, connection info, etc.)

  Add your preferred AI model credentials (supports OpenAI, Gemini, or Ollama)
  Optional: Customize system prompt to better match your brand voice

  How to customize this workflow to your needs

  Update the Notion schema to include industry-specific categories or actions
  Change the AI tone (e.g., humorous, more corporate, etc.)
  Add conditional logic for auto-sending messages without Slack approval
  Extend to support multiple platforms (e.g., email, X/Twitter, Instagram DMs)

nodes_used:
  ["n8n-nodes-base.notion","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.outputParserStructured"]

workflow_json:
  {"meta":{"instanceId":"cb484ba7b742928a2048bf8829668bed5b5ad9787579adea888f05980292a4a7"},"nodes":[{"id":"ae3cbbb0-1987-4457-b91f-d1a766e09fb7","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-180,-60],"parameters":{"workflowInputs":{"values":[{"name":"message"},{"name":"sender"},{"name":"chatid"},{"name":"linkedinprofile","type":"array"}]}},"typeVersion":1.1},{"id":"0c10e97f-1de0-493e-9eda-a36507f40429","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[980,-60],"parameters":{"text":"=Sender Name: {{ $('Isolate parent workflow data for AI').item.json.sender }}\nSender Message: {{ $('Isolate parent workflow data for AI').item.json.message }}\nMy Name: Your Name\n\nIf found, the linkedin profile will be below, pay close attention to the number of followers and connections: \n{{ $('When Executed by Another Workflow').item.json.linkedinprofile.toJsonString() }}","options":{"systemMessage":"=You are an expert professional assistant designed to help generate smart, personalized responses to LinkedIn messages.\n\nYou will be provided with:\n1. The **incoming message** and name from a LinkedIn user.\n2. A **database of past requests and responses**. These are known message types and the preferred replies.\n3. Context about the assistant's voice and tone.\n\n### Your Objective:\n- First, scan the database for any message that closely matches the incoming LinkedIn message. If a match is found, use the **corresponding response** as a base — you may slightly tailor it if needed (e.g., change names or dates).\n- If no close match is found, generate a **new, thoughtful reply** based on the message content, tone guidelines, and best practices in business networking. If you do not have a direct link or URL to provide from the Request Database, do not reference a website or URL. Instead say a variation of let me get back to you on that and see what I can find. \n\n### Tone Guidelines:\n- Friendly, confident, and professional — but never robotic.\n- Lightly personalized. Use the sender’s name if available.\n- Avoid sounding like a sales pitch.\n- Keep replies concise and natural, like something you'd actually send on LinkedIn.\n\n### When generating a new message:\n- Acknowledge the sender’s message.\n- Add a relevant, helpful comment or question to continue the conversation.\n- Keep the tone warm and open-ended.\n\n### Output format:\nOnly output the message text that should be sent to the user. Do not explain your reasoning. If you do not have a direct link to provide, do not reference a website or URL. Instead say let me get back to you on that and see what I can find. \n\nLet’s begin.\nRequest Database:\n\n{{ $json.dbObject.join('\\n\\n----\\n\\n') }}\n\nWhen responding, use the following format:\n{\n\t\"output\": \"message response\",\n\t\"found\": true\n}\nFor output output the message response, for found output a boolean, true if an example is found in the Request Database, false if a response is not found. The output is going to slack so ensure you escape your outputs like new lines. "},"promptType":"define","hasOutputParser":true},"typeVersion":1.9},{"id":"46cefba2-2107-4d41-b270-8442d2aae09b","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1100,180],"parameters":{"sessionKey":"={{ $('Isolate parent workflow data for AI').item.json.chatid }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"3a1e8f2d-5ea9-4f31-b489-93fca3c8442e","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[920,180],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o","cachedResultName":"gpt-4o"},"options":{}},"credentials":{"openAiApi":{"id":"QpFZ2EiM3WGl6Zr3","name":"Marketing OpenAI"}},"typeVersion":1.2},{"id":"2a69d1d4-5c30-4cc1-930b-7b72cd1c0ed1","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[1260,180],"parameters":{"jsonSchemaExample":"{\n\t\"output\": \"message response\",\n\t\"found\": true\n}"},"typeVersion":1.2},{"id":"bb9a7e05-d641-4caa-9fcc-7b1d39dd62d7","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[780,-380],"parameters":{"color":7,"width":668,"height":718,"content":"![hctiapi](https://uploads.n8n.io/templates/openai.png)\n## Generate Automated response\nThe AI bot receives not only the message from LinkedIn, but also LinkedIn user context, such as the number of followers and connections, allowing for tailored responses. For example if a user asks to meet, but they don't meet a certain number of followers threshold, they are politely declined. However if an influencer reaches out, they are automatically given a booking link to ensure that high priority requests are immediately followed up on. "},"typeVersion":1},{"id":"a7f5f2b3-bc0c-450e-bbd8-60a01dc4b202","name":"Isolate parent workflow data for AI","type":"n8n-nodes-base.set","position":[20,-60],"parameters":{"options":{},"assignments":{"assignments":[{"id":"91a1191e-bac0-4b8b-b263-a03c63435470","name":"sender","type":"string","value":"={{ $json.sender }}"},{"id":"0f8c17c8-d598-4840-8b89-8dbdcd529231","name":"message","type":"string","value":"={{ $json.message }}"},{"id":"c9132b69-5e0e-4ccf-86bb-0e4cfa734860","name":"chatid","type":"string","value":"={{ $json.chatid }}"}]}},"typeVersion":3.4},{"id":"ca7625b3-2c2a-48c5-82b5-61a00ac95c81","name":"Get Request Router Directory Database","type":"n8n-nodes-base.notion","position":[220,-60],"parameters":{"options":{},"resource":"databasePage","operation":"getAll","databaseId":{"__rl":true,"mode":"list","value":"1da5b6e0-c94f-8086-80b6-eab8e340d60e","cachedResultUrl":"https://www.notion.so/1da5b6e0c94f808680b6eab8e340d60e","cachedResultName":"RequestRouterDB"}},"credentials":{"notionApi":{"id":"2B3YIiD4FMsF9Rjn","name":"Angelbot Notion"}},"typeVersion":2.2},{"id":"ffa17cbf-a9ae-4427-8aa4-a07ab97bf60b","name":"Format DB data for AI Context","type":"n8n-nodes-base.set","position":[420,-60],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c4ac8c33-a220-4c07-bc0d-dc7ba7cc068e","name":"dbObject","type":"string","value":"=Request Example: {{ $json.name }}\n--\nRequest Description: {{ $json.property_request_description }}\n--\nRequest Action: {{ $json.property_request_action }}"}]}},"typeVersion":3.4},{"id":"96980e0e-632a-49dc-9cbb-a487d117e2af","name":"Aggregate DB objects into one item","type":"n8n-nodes-base.aggregate","position":[620,-60],"parameters":{"options":{},"fieldsToAggregate":{"fieldToAggregate":[{"fieldToAggregate":"dbObject"}]}},"typeVersion":1},{"id":"d66e6cc9-2955-4d45-a65b-ffc734f9a4cf","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[-240,-380],"parameters":{"color":7,"width":1006,"height":640,"content":"![notion](https://uploads.n8n.io/templates/notionlogo.png)\n## Get routing Database data\nAn AI bot that does not get smarter over time is not a useful bot. That is why this bot references a shared internal database where requests routing can be updated without having to touch the n8n workflows. When a request comes in that does not have a standardized process, the AI will generate a response based on its model training. You can use this as a starting point, but when this becomes a pattern, simply updating the notion database instantly upgrades the AI bot. Not only that, but others can update the database, not only giving the AI context, but also creating a centralized location for standardized processes for handling different request types. This can be adapted for any platform, not just linkedIn, such as shared email inboxes, shared social media pages, and even for support requests. "},"typeVersion":1}],"pinData":{},"connections":{"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"AI Agent","type":"ai_outputParser","index":0}]]},"Format DB data for AI Context":{"main":[[{"node":"Aggregate DB objects into one item","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Isolate parent workflow data for AI","type":"main","index":0}]]},"Aggregate DB objects into one item":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Isolate parent workflow data for AI":{"main":[[{"node":"Get Request Router Directory Database","type":"main","index":0}]]},"Get Request Router Directory Database":{"main":[[{"node":"Format DB data for AI Context","type":"main","index":0}]]}}}


name: Analyze Stock Charts with GPT-4 Vision and Send Results via Telegram
author_name: Fenngbrotalk
author_username: yihaohuang
categories: []
created_at: 2025-06-12T01:53:49.406Z
updated_at: 2025-06-12T01:53:49.406Z
url: https://n8n.io/workflows/4892
scraped_at: 2025-07-06 21:16:30
description:
  n8n Workflow: AI-Powered Stock Chart Analysis Bot for Telegram

  This is a powerful n8n automation workflow that integrates a Telegram bot with OpenAI's multimodal large language model (GPT-4 Vision) to provide users with real-time stock chart analysis.

  Workflow Breakdown

  Receive Image:** The workflow is initiated by a Telegram Trigger. It activates whenever a user sends an image (e.g., a stock's candlestick chart) to a designated Telegram chat, automatically downloading the file.
  Image Pre-processing:** To optimize the AI's performance and efficiency, the Edit Image node resizes the incoming image to a standard 512x512 pixel format.
  AI Vision Analysis:** The processed image is then passed to a LangChain Chain, which utilizes the OpenAI GPT-4 Vision model. A sophisticated system prompt instructs the AI to act as a professional stock analyst.
  Intelligent Interpretation:** The AI analyzes the image to identify the stock's name, price trend (uptrend, downtrend, or sideways), key support/resistance levels, and volume changes. It then generates a comprehensive analysis report combining technical indicators and market sentiment.
  Structured Output:** To ensure reliability and consistency, the AI's output is parsed into a specific JSON format. This structure includes a search_word (for the industry/sector) and the main content (the analysis text).
  Send Response:** Finally, the workflow extracts the content field from the JSON output and uses the Telegram node to send this professional analysis back to the user as a text message in the same chat.

  Key Features

  User-Friendly:** Users simply send an image to get an analysis, requiring no complex commands.
  Instant & Efficient:** The entire analysis and response process is fully automated and completed within moments.
  Professional-Grade Analysis:** Leverages the advanced image recognition and reasoning capabilities of GPT-4 Vision to deliver insights comparable to those of a human analyst.
  Reliable & Consistent:** The use of structured output ensures that the format of the response is always consistent and easy to read or process further.

nodes_used:
  ["n8n-nodes-base.editImage","n8n-nodes-base.telegram","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured"]

workflow_json:
  {"id":"yBjR5afdjZNtPifv","meta":{"instanceId":"5f9764ce8ade9ce9b31164c3b692a0c825a999b46f96de953f9cdad63881e1ab","templateCredsSetupCompleted":true},"name":"Image_anlysis","tags":[],"nodes":[{"id":"fb1046cf-d558-4874-a749-8f03b9f7ad3e","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-720,-200],"webhookId":"69c98bf3-aed0-4b73-ba6f-15879fb2378b","parameters":{"updates":["message"],"additionalFields":{"download":true}},"credentials":{"telegramApi":{"id":"jqN4zt7cRMB5sO0P","name":"image_anlsis"}},"typeVersion":1.2},{"id":"381f813f-1d16-4e31-a12f-0ad36155bc05","name":"Basic LLM Chain","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[140,-360],"parameters":{"text":"这只股票怎么样","batching":{},"messages":{"messageValues":[{"message":"# 股票图表分析提示词\n\n## 角色定义\n您的角色是分析股票价格图表。\n\n## 分析要求\n对于每个股票图表，请提供：\n- 股票名称和当前价格趋势（上涨/下跌/横盘）\n- 关键价位或百分比变化\n- 简要趋势分析\n\n\n## 输出格式（JSON）\n{\n  \"search_word\": \"与股票所属行业或公司业务相关的核心检索词\",\n  \"content\": \"股票名称 + 趋势分析 + 关键价格信息 + 技术面解读\"\n}\n\n## 注意事项\n- **search_word**: 匹配股票所属行业关键词，同时也能是一些细分行业关键词\n- **content**: 趋势分析要富含逻辑，因为你的决策决定了用户能否赚钱，包含技术面和市场情绪信息\n- 价格信息要准确，包括具体数值和百分比变化，同时可以提醒用户可能的止损或者止盈的价格\n- search_word要能准确反映该股票的核心业务领域或行业属性"},{"type":"HumanMessagePromptTemplate","messageType":"imageBinary"}]},"promptType":"define","hasOutputParser":true},"typeVersion":1.7},{"id":"453589be-36f3-4022-8306-ba54b2d6bbcf","name":"Edit Image","type":"n8n-nodes-base.editImage","position":[-220,-360],"parameters":{"width":512,"height":512,"options":{},"operation":"resize","dataPropertyName":"=data"},"typeVersion":1},{"id":"28b88eeb-da05-4a17-ac2c-4fdf846296fb","name":"Telegram","type":"n8n-nodes-base.telegram","position":[740,-440],"webhookId":"41cfac39-0bd2-474b-a1a2-83fc4115e257","parameters":{"text":"={{ $json.output.content }}","chatId":"={{ $('Telegram Trigger').item.json.message.chat.id }}","additionalFields":{}},"credentials":{"telegramApi":{"id":"jqN4zt7cRMB5sO0P","name":"image_anlsis"}},"typeVersion":1.2},{"id":"0f7f2636-d90e-4ea1-8f4f-ad528ef8db50","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[100,-160],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4-vision-preview","cachedResultName":"gpt-4-vision-preview"},"options":{}},"credentials":{"openAiApi":{"id":"rRrVLkLnJIVGp3tN","name":"geminiapi"}},"typeVersion":1.2},{"id":"c88d1439-c1fb-4411-9996-6cd5f22d980a","name":"Structured Output Parser","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[460,-140],"parameters":{"jsonSchemaExample":"{\n  \"search_word\": \"与股票所属行业或公司业务相关的核心检索词\",\n  \"content\": \"股票名称 + 趋势分析 + 关键价格信息 + 技术面解读\"\n}"},"typeVersion":1.2}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"6c6c21e5-3ee4-48b9-9330-4c42367722c5","connections":{"Edit Image":{"main":[[{"node":"Basic LLM Chain","type":"main","index":0}]]},"Basic LLM Chain":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Edit Image","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Basic LLM Chain","type":"ai_languageModel","index":0}]]},"Structured Output Parser":{"ai_outputParser":[[{"node":"Basic LLM Chain","type":"ai_outputParser","index":0}]]}}}


name: Automated Daily Email Analysis & Summary with GPT-4o and Gmail
author_name: Zach @Ajenta
author_username: ajenta
categories: []
created_at: 2025-06-12T04:19:38.502Z
updated_at: 2025-06-12T04:19:38.502Z
url: https://n8n.io/workflows/4893
scraped_at: 2025-07-06 21:16:30
description:
  Daily Email Pulse Summary:

  This agent summarizes a user's daily emails into a clean, actionable summary. It uses OpenAI to analyze content and sends a formatted "Daily Pulse" email at the end of each day.

  Main use cases:
  Keep track of open loops and next steps across all email conversations

  Identify high-potential leads and flag conversations going nowhere

  Eliminate the need to manually review your inbox at day’s end

  Build a smart summary layer using AI without hallucination or noise

  How it works
  This workflow can be divided into eight core nodes, each serving a distinct purpose in helping a user stay on top of their day. The result is a curated, AI-generated summary delivered to your inbox — crafted from real message content, not guesswork.

  Schedule Trigger (Trigger Node – Runs Daily at Set Time)

  Kicks off the workflow at a specific time each day (e.g. 6:00 PM).
  Ensures you receive your Daily Pulse consistently, without needing to run it manually.

  Date Transformer (Function Node – Define Today & Tomorrow Range)
  Uses JavaScript to calculate the current day’s date range:
  	 today: Start of day (00:00:00)
  	 tomorrow: Start of next day (used as a cutoff)
  This ensures only emails from today are analyzed, keeping the summary focused and current.

  Get All Messages (Gmail Node – Fetch Filtered Emails)
  Pulls in all Gmail messages with internalDate between today and tomorrow.
  Outputs structured data: from, subject, and body text of each email.
  This forms the raw data for the daily business pulse.

  Aggregator (Function or Item Lists Node – Combine Message Fields)
  Aggregates each message into a readable format:

  From: John@example.com  
  Subject: Demo Follow-up  
  Body: Let’s schedule a time this week...

  All messages are stitched together into a single combinedText string for analysis.
  This gives the AI model full context for the day in one unified document.

  Email Cleanup (Function Node – Remove Noise & Normalize Text)
  Cleans the combinedText blob to remove:
  	HTML tags
  	Marketing footers (e.g., unsubscribe links)
  	Redundant whitespace or formatting artifacts
  Ensures GPT gets clean, relevant message content with no distractions.

  Agent (OpenAI Node – Generate Structured Summary)
  Uses a System Prompt to define its role as an AI Chief of Staff.
  Uses a User Prompt that instructs it to categorize messages into sections:

  	📝 Open Loops / Pending Follow-Up
  	🚀 Next Steps You’ve Committed To
  	🧲 Leads Worth Following Up On
  	🛑 Conversations That Aren’t Leading Anywhere
  	🧠 Strategy Notes
  	✅ Top 3 Tasks for Tomorrow

  Built-in guardrails ensure the model only uses real content (no hallucination).
  Sections with no relevant data are omitted to keep it concise.

  HTML Formatter (Function Node – Wrap Markdown in Email-Ready HTML)
  Wraps the GPT-generated markdown summary in a simple &lt;html&gt;&lt;body&gt; structure.
  Applies white-space: pre-wrap to preserve formatting and spacing.
  The result is a clean, readable email that renders well across all inboxes (especially Gmail).

  Email Send (Email Node – Deliver the Final Pulse)
  Sends the formatted summary to your email inbox.
  Subject: Your Daily Business Pulse – {{today}}
  HTML body: Uses the formatted output from the previous step.
  Final output: a well-organized, scannable summary of the day’s communication — focused on what matters.

  Why It Works
  Automates the end-of-day review ritual without effort
  Prioritizes follow-ups, action items, and time-sensitive leads
  Filters out noise and low-value conversations
  Leverages GPT without risk of hallucination or irrelevant output
  Delivers clarity, helping you focus on tomorrow’s most important tasks

nodes_used:
  ["n8n-nodes-base.gmail","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi"]

workflow_json:
  {"id":"Ucu10DYuMwYdLLVk","meta":{"instanceId":"159ec2e1d690fe685084d28de8ca73848642bf563457a19b94cfc00f23a0d9a9","templateCredsSetupCompleted":true},"name":"Scheduled Daily Email Pulse","tags":[],"nodes":[{"id":"908a85db-7b15-4ece-8dab-19398e0c1871","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-80,-80],"parameters":{"rule":{"interval":[{"triggerAtHour":18}]}},"typeVersion":1.2},{"id":"8cadc5e6-193e-42e9-b2fc-54a2025191c2","name":"Gmail","type":"n8n-nodes-base.gmail","position":[360,-80],"webhookId":"6fbdcf54-7d41-4fb0-aa17-07edb33cd5d0","parameters":{"simple":false,"filters":{"receivedAfter":"={{ $json.today}}","receivedBefore":"={{ $json.tomorrow }}"},"options":{},"operation":"getAll"},"credentials":{"gmailOAuth2":{"id":"gUrhTlOlNSEw7OKA","name":"Gmail account"}},"typeVersion":2.1,"alwaysOutputData":true},{"id":"62ab4e36-b42f-4aff-8ec5-4456f4827ca3","name":"Date Transformer","type":"n8n-nodes-base.code","position":[140,-80],"parameters":{"jsCode":"const now = new Date();\nconst today = new Date(now.getFullYear(), now.getMonth(), now.getDate());\nconst tomorrow = new Date(today);\ntomorrow.setDate(today.getDate() + 1);\n\nconst isoDate = (d) => d.toISOString().split('.')[0] + 'Z';\n\nreturn [\n  {\n    json: {\n      today: isoDate(today),\n      tomorrow: isoDate(tomorrow),\n    },\n  },\n];\n"},"typeVersion":2},{"id":"c25a964f-6d41-4c97-b90f-f5ce15cadaa7","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1020,160],"parameters":{"text":"You are an AI Chief of Staff for a small business owner. Your job is to review a day’s worth of emails, texts, and calls and produce a concise, structured summary that helps them stay focused and effective.\n\nYou must only surface tasks, people, and opportunities that appear in the message content. Do not invent next steps, leads, or strategy notes.\n\nIf a section has no relevant content, leave it out entirely. It’s better to report nothing than to guess.","options":{"systemMessage":"=Below is a transcript of today’s messages — including email, text, and call summaries.\n\nAnalyze the content and generate a markdown-formatted **Daily Business Pulse**, using only what appears in the messages. Do not assume, extrapolate, or fabricate any details.\n\nMessages:\n{{ $json.combinedText }}\n\nUse the structure below. Omit any section that has no relevant content.\n\n---\n\n👋 **Here’s what matters from your day**\n\n---\n\n📝 **Open Loops / Pending Follow-Ups**  \n_List any conversations that require a response or action._\n\n---\n\n🚀 **Next Steps You've Committed To**  \n_List anything the user said they would do._\n\n---\n\n🧲 **Leads or Conversations Worth Following Up On**  \n_Only include if the person expressed interest or asked for help._\n\n---\n\n🛑 **Conversations That Aren’t Leading Anywhere**  \n_Include if there are back-and-forths with no progress, spam, or promotional threads._\n\n---\n\n🧠 **Strategy Notes**  \n_Only add notes if there are clear, recurring themes or opportunities based on the content._\n\n---\n\n✅ **Top 3 Tasks for Tomorrow**  \n_If tasks were mentioned and clearly matter, list the top 3. Otherwise, leave this out._"},"promptType":"define"},"typeVersion":2},{"id":"fe2552ce-48be-44bd-b975-cde379b46b51","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1020,360],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"qiPWoGhtEMQi7AWs","name":"OpenAi account"}},"typeVersion":1.2},{"id":"d2410164-fde8-46f1-8df1-6cbf3874d397","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[580,60],"parameters":{"options":{},"fieldsToAggregate":{"fieldToAggregate":[{"fieldToAggregate":"headers.from"},{"fieldToAggregate":"headers.subject"},{"fieldToAggregate":"text"}]}},"typeVersion":1},{"id":"9c3c28f5-35d5-4164-a694-8a9bc26354d5","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-120,-120],"parameters":{"color":4,"width":620,"height":200,"content":""},"typeVersion":1},{"id":"476d2f5a-c0da-4683-89a2-9cbe9d93c638","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[520,40],"parameters":{"color":6,"width":420,"content":""},"typeVersion":1},{"id":"f9301bfa-2cd7-4eaf-9798-729604a6b49a","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[980,140],"parameters":{"width":540,"content":""},"typeVersion":1},{"id":"5cdda71c-ba41-41ba-aae1-66d39caf75c9","name":"Email Cleanup","type":"n8n-nodes-base.code","position":[780,60],"parameters":{"jsCode":"const cleanMessages = items.map(item => {\n  const from = item.json.header?.from || \"Unknown sender\";\n  const subject = item.json.header?.subject || \"No subject\";\n  const rawBody = item.json.text || \"\"; // fall back to empty string\n  const body = String(rawBody); // ensure it's a string\n\n  const cleaned = body\n    .replace(/<\\/?[^>]+(>|$)/g, \"\")             // Remove HTML\n    .replace(/(Unsubscribe|View in browser)/gi, \"\") // Strip only promo triggers\n    .replace(/\\n{3,}/g, \"\\n\\n\")                 // Collapse excess breaks\n    .trim();                                    // Clean up\n\n  return `📩 **From:** ${from}\\n**Subject:** ${subject}\\n**Preview:**\\n${cleaned}\\n\\n---\\n`;\n});\n\nreturn [{\n  json: {\n    combinedText: cleanMessages.join('\\n')\n  }\n}];"},"typeVersion":2},{"id":"0807cef5-876f-433d-a94a-2db7f86d844d","name":"Format HTML","type":"n8n-nodes-base.code","position":[1380,160],"parameters":{"jsCode":"const markdown = $input.all().map((item) => item.json.output);\nlet html = markdown.map((md) =>\n  md\n    .replace(/(\\*\\*|__)(.*?)\\1/g, \"<b>$2</b>\")\n    .replace(/(\\*|_)(.*?)\\1/g, \"<i>$2</i>\")\n    .replace(/~~(.*?)~~/g, \"<del>$1</del>\")\n    .replace(/`([^`\\n]+)`/g, \"<code>$1</code>\")\n    .replace(/!\\[([^\\]]+)\\]\\(([^\\)]+)\\)/g, '<img src=\"$2\" alt=\"$1\">')\n    .replace(/\\[([^\\]]+)\\]\\(([^\\)]+)\\)/g, '<a href=\"$2\">$1</a>')\n    .replace(/(\\r\\n|\\n|\\r)/gm, \"<br>\"),\n);\n\nreturn { html };\n"},"typeVersion":2},{"id":"bfc39659-9e36-4dde-9536-558d491f965c","name":"Send Message","type":"n8n-nodes-base.gmail","position":[1580,320],"webhookId":"39d8fc4a-0fa4-4a13-a123-2f1373787a79","parameters":{"sendTo":"youremail@gmail.com","message":"={{ $json.html[0] }}","options":{},"subject":"Here's Your Daily Pulse"},"credentials":{"gmailOAuth2":{"id":"gUrhTlOlNSEw7OKA","name":"Gmail account"}},"typeVersion":2.1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"fa9af357-4a58-4540-94d4-7228678ea75b","connections":{"Gmail":{"main":[[{"node":"Aggregate","type":"main","index":0}]]},"AI Agent":{"main":[[{"node":"Format HTML","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Email Cleanup","type":"main","index":0}]]},"Format HTML":{"main":[[{"node":"Send Message","type":"main","index":0}]]},"Email Cleanup":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Date Transformer":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Date Transformer","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


name: Scheduled YouTube Video Uploads with Google Sheets & Drive Integration
author_name: Rahul Joshi
author_username: rahul08
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.googleDrive","n8n-nodes-base.youTube"]
categories: []
created_at: 2025-06-12T08:34:05.302Z
updated_at: 2025-06-12T08:34:05.302Z
url: https://n8n.io/workflows/4900
scraped_at: 2025-07-06 21:16:30
description:
  Description:

  Effortlessly automate YouTube video uploads with this ready-to-use n8n workflow. Integrated with Google Sheets, Google Drive, and YouTube API, this template streamlines your video publishing process based on scheduled metadata entries.

  Key Features:

  🗓️ Scheduled Uploads (Mon–Fri at 9 AM, 12 PM, 3 PM)
  📋 Reads video metadata (title, description, filename) from Google Sheets
  🔍 Locates video files in Google Drive by filename
  ⬇️ Downloads and uploads videos to YouTube with the correct metadata
  ✅ Updates the status in the sheet to avoid duplicates
  📂 Moves uploaded files to a specified archive folder for organization

  Requirements:

  Google Sheets with metadata (Title, Description, File Name, Status)
  Google Drive with video files
  YouTube API access and OAuth credentials
  A pre-set folder structure for organization

  Perfect For:

  Content creators, YouTube channel managers, marketers, and editors who want to automate repetitive upload tasks, maintain consistent publishing schedules, and organize video assets—without manual effort.

workflow_json:
  {"id":"06o12GkCUGklKpVj","meta":{"instanceId":"18c9b77a7db94bab09d77f4a9c44dd94853695bba1618cb7bc3c4bc412c07c1e"},"name":"YouTube Upload Automation","tags":[],"nodes":[{"id":"3f79bd90-93f0-4a86-ac1e-d770167b9cc2","name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[60,-20],"parameters":{},"typeVersion":4.5},{"id":"017f682c-3ffd-440a-bb86-c250f996d65b","name":"Get Video File Id","type":"n8n-nodes-base.googleDrive","position":[280,-20],"parameters":{},"typeVersion":3},{"id":"2fc17cbe-3df4-4f8f-b1d4-7d461d56ed95","name":"Download Video Data","type":"n8n-nodes-base.googleDrive","position":[-160,200],"parameters":{},"typeVersion":3},{"id":"6ba6bb57-dbe4-4cda-9d72-e20f17f46bf4","name":"Upload to YouTube","type":"n8n-nodes-base.youTube","position":[60,200],"parameters":{},"typeVersion":1},{"id":"a442d21f-9d29-4434-bbf7-0b4959da2a74","name":"Update Status","type":"n8n-nodes-base.googleSheets","position":[280,200],"parameters":{},"typeVersion":4.5},{"id":"55c915d6-6096-4cf3-89b1-93720a2ee615","name":"Get Folder Name","type":"n8n-nodes-base.googleDrive","position":[-160,420],"parameters":{},"typeVersion":3},{"id":"b7ca1715-b0e7-429c-b112-f858c83f4b78","name":"Move Video File to Folder","type":"n8n-nodes-base.googleDrive","position":[60,420],"parameters":{},"typeVersion":3},{"id":"7b91cb20-b006-4e60-9e4d-97be63566942","name":"M-F 9am,12pm,3pm","type":"n8n-nodes-base.scheduleTrigger","position":[-160,-20],"parameters":{},"typeVersion":1.2},{"id":"d2b07579-7240-4992-b4dd-432cde8b5cfa","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-860,-20],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"18782e6c-c7db-4968-8d06-b9fdc8398b20","connections":{"Google Sheets":{"main":[[{"node":"Get Video File Id","type":"main","index":0}]]},"Update Status":{"main":[[{"node":"Get Folder Name","type":"main","index":0}]]},"Get Folder Name":{"main":[[{"node":"Move Video File to Folder","type":"main","index":0}]]},"M-F 9am,12pm,3pm":{"main":[[{"node":"Google Sheets","type":"main","index":0}]]},"Get Video File Id":{"main":[[{"node":"Download Video Data","type":"main","index":0}]]},"Upload to YouTube":{"main":[[{"node":"Update Status","type":"main","index":0}]]},"Download Video Data":{"main":[[{"node":"Upload to YouTube","type":"main","index":0}]]}}}


name: Daily Business Idea Insights Aggregator from IdeaBrowser to Google Docs
author_name: mahavishnu
author_username: mahavishnu
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.googleDocs","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-12T08:54:41.448Z
updated_at: 2025-06-12T08:54:41.448Z
url: https://n8n.io/workflows/4901
scraped_at: 2025-07-06 21:16:30
description:
  This automation runs daily at 8:00 AM to automatically collect and organize business idea insights from IdeaBrowser.com into a structured Google Docs document.
  The workflow performs the following actions:
  Data Collection: Fetches the "idea of the day" content from ideabrowser.com/idea-of-the-day using authenticated HTTP requests.
  Content Processing: Extracts the base idea path and generates links to all related insight pages including value ladder, market analysis, proof signals, execution plans, and community insights. The workflow also cleans the HTML content to extract readable text.
  Document Creation: Creates a new Google Docs document in a specified folder with a timestamp and idea name in the title format.
  Content Aggregation: Systematically visits each insight page (main idea page, value ladder, why now, proof signals, market gap, execution plan, value equation, value matrix, ACP, community signals, and keywords) and collects their content.
  Document Population: Processes the collected content through markdown formatting and appends it to the Google Docs document, creating a comprehensive report of the daily business idea with all its associated insights.
  Automated Scheduling: Runs automatically every day at 8 AM, ensuring you have fresh business idea analysis delivered to your Google Drive without manual intervention.
  This automation is perfect for entrepreneurs, business analysts, or anyone who wants to stay updated with curated business ideas and their detailed market analysis in an organized, searchable format.

workflow_json:
  {"id":"eGHpM6RNrSQcTJRt","meta":{"instanceId":"40392649eb66ba0250ac182a67ce909ef092ff6b0050f4035d702b8166f4f79a","templateCredsSetupCompleted":true},"name":"ideabrowser-scraper","tags":[],"nodes":[{"id":"a19357ec-0bff-4f07-b403-fa18f82abf86","name":"Markdown1","type":"n8n-nodes-base.markdown","position":[2040,800],"parameters":{"html":"={{ $json.data }}","options":{}},"typeVersion":1},{"id":"7fbca587-d982-4800-b559-6e01008af711","name":"Get the links","type":"n8n-nodes-base.code","position":[580,800],"parameters":{"jsCode":"for (const item of $input.all()) {\n    const rawData = item.json.data;\n\n    // Step 1: Extract base path for idea\n    const basePathRegex = /\\/idea\\/[^\"\\/]+/;\n    const basePathMatch = rawData.match(basePathRegex);\n\n    if (!basePathMatch) {\n        item.json.error = \"No valid idea path found in rawData\";\n        continue;\n    }\n\n    const basePath = basePathMatch[0]; // e.g., /idea/ai-powered-historical-ad-style-generator\n\n    // Step 2: Generate insight links\n    const insightPages = [\n        \"\",\n        \"/value-ladder\",\n        \"/why-now\",\n        \"/proof-signals\",\n        \"/market-gap\",\n        \"/execution-plan\",\n        \"/value-equation\",\n        \"/value-matrix\",\n        \"/acp\",\n        \"/community-signals\",\n        \"/keywords\"\n    ];\n\n    const insightLinks = insightPages.map(page => {\n        return `https://www.ideabrowser.com${basePath}${page}`; \n    });\n\n    // Step 3: Extract only readable text by removing HTML tags\n    const cleanText = rawData.replace(/<[^>]+>/g, '').trim();\n\n    // Step 4: Update item with results\n    item.json.insightLinks = insightLinks;\n    item.json.ideaPath = basePath;\n    item.json.cleanText = cleanText; // 👈 This is the new key with only readable text\n}\n\nreturn $input.all();"},"typeVersion":2},{"id":"10bfccb0-c5d3-4002-ad31-9e6d00d710a3","name":"Get URL data of idea","type":"n8n-nodes-base.httpRequest","position":[380,800],"parameters":{"url":"https://ideabrowser.com/idea-of-the-day ","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"1CfzTn6kYUUoa3Im","name":"cookie-for-idea-browser"}},"typeVersion":4.2},{"id":"2ac9f703-006b-494d-b53f-372c8dbd8233","name":"Create google doc","type":"n8n-nodes-base.googleDocs","position":[780,580],"parameters":{"title":"={{ $today.toLocaleString().concat(\"-\",$json.ideaPath.split(\"/\")[2] )}}","folderId":"10Lxy7-UbLzEGcTnDk12n8pOiWyyu1EE4"},"credentials":{"googleDocsOAuth2Api":{"id":"mtchxt5piVMUOdin","name":"mvasi"}},"typeVersion":2},{"id":"bf9d318c-310e-4c49-bbb0-3cfbc1e16f7d","name":"Merge the data","type":"n8n-nodes-base.merge","position":[1000,800],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.2},{"id":"286f31e3-d9e5-4a3a-8590-7c11e82c6e78","name":"Split the url","type":"n8n-nodes-base.splitOut","position":[1260,800],"parameters":{"options":{},"fieldToSplitOut":"insightLinks"},"typeVersion":1},{"id":"7ac224d8-4eb9-429a-bae3-607e49f2d498","name":"Loop over URL","type":"n8n-nodes-base.splitInBatches","position":[1580,780],"parameters":{"options":{}},"typeVersion":3},{"id":"82e59148-8aa9-4eb7-a65b-37c375d63ef0","name":"Get URL content of each page","type":"n8n-nodes-base.httpRequest","position":[1820,800],"parameters":{"url":"={{ $json.insightLinks }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"1CfzTn6kYUUoa3Im","name":"cookie-for-idea-browser"}},"typeVersion":4.2},{"id":"c5902af1-187e-4471-8833-8c3b68732d36","name":"Update the google docs with the data","type":"n8n-nodes-base.googleDocs","position":[2240,800],"parameters":{"actionsUi":{"actionFields":[{"text":"={{ $json.data }}","action":"insert"}]},"operation":"update","documentURL":"={{ $('Create google doc').item.json.id }}"},"credentials":{"googleDocsOAuth2Api":{"id":"mtchxt5piVMUOdin","name":"mvasi"}},"typeVersion":2},{"id":"0cd82b9e-1b64-4853-aaab-3036fe33aa5d","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[200,800],"parameters":{"rule":{"interval":[{"triggerAtHour":8}]}},"typeVersion":1.2}],"active":false,"pinData":{},"settings":{"timezone":"Asia/Kolkata","callerPolicy":"workflowsFromSameOwner","executionOrder":"v1","executionTimeout":-1},"versionId":"a1e9d613-2210-4565-a36c-c483d51130fb","connections":{"Markdown1":{"main":[[{"node":"Update the google docs with the data","type":"main","index":0}]]},"Get the links":{"main":[[{"node":"Create google doc","type":"main","index":0},{"node":"Merge the data","type":"main","index":1}]]},"Loop over URL":{"main":[[],[{"node":"Get URL content of each page","type":"main","index":0}]]},"Split the url":{"main":[[{"node":"Loop over URL","type":"main","index":0}]]},"Merge the data":{"main":[[{"node":"Split the url","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Get URL data of idea","type":"main","index":0}]]},"Create google doc":{"main":[[{"node":"Merge the data","type":"main","index":0}]]},"Get URL data of idea":{"main":[[{"node":"Get the links","type":"main","index":0}]]},"Get URL content of each page":{"main":[[{"node":"Markdown1","type":"main","index":0}]]},"Update the google docs with the data":{"main":[[{"node":"Loop over URL","type":"main","index":0}]]}}}


name: Telegram AI Assistant with Gmail, Google Calendar, Google Sheets & MCP Tools
author_name: David Olusola
author_username: dae221
categories: []
created_at: 2025-06-12T14:17:02.535Z
updated_at: 2025-06-12T14:17:02.535Z
url: https://n8n.io/workflows/4902
scraped_at: 2025-07-06 21:16:30
description:
  ✨ What It Is
  Automate your professional communication directly from Telegram using this powerful AI assistant built with n8n.

  This no-code agent understands natural language and integrates seamlessly with:

  Gmail (send, receive, draft emails)
  Google Calendar (create, delete, get events)
  Google Sheets (contact database)
  MCP Tools (agent framework for dynamic tool routing)
  Perfect for:

  Virtual Assistants
  Freelancers & Teams
  Sales & Outreach Professionals
  Calendar Managers
  Customer Support Teams
  🔧 What It Can Do
  Just send a message like:

  “Send email to Jane at Acme about pricing”
  “Create a Zoom meeting with Victor next Friday at 3pm”
  “Cancel meeting with Alex”
  “Follow up with Sarah tomorrow”
  ✅ Features:

  🔄 Understands natural language Telegram messages
  📧 Sends or drafts emails using Gmail
  📅 Creates/deletes/syncs calendar events with Google Calendar
  📊 Fetches contact info from Google Sheets
  🤖 Powered by a lightweight LLM (Gemini 2.0)
  💼 Smart memory & session context via MCP tools
  📥 Telegram replies with formatted confirmation (e.g., ✅, 📧, 📅)
  🛠️ Setup Guide (Step-by-Step)

  Prerequisites
  An n8n.cloud or self-hosted n8n instance
  Telegram Bot (create one via @BotFather)
  Gmail, Google Calendar, and Google Sheets accounts
  Access to MCP tools (optional: Daex AI Cloud or equivalent)
  Authorize Accounts
  Connect Gmail, Google Calendar, and Google Sheets credentials in n8n under "Credentials".
  Authorize your Telegram bot via n8n's Telegram Trigger node.
  Configure Your Google Sheet
  Create a Google Sheet titled Contact Data with these columns:

  Name
  Email
  Company
  Role
  Make sure the Google Sheets node points to the correct documentId and gid.

  Connect MCP Tools (Optional)
  If you're using Daex MCP, input the SSE path and trigger ID in the MCP Client Tool and MCP Server Trigger.

  Enable Telegram Bot
  Deploy your workflow in n8n
  Send any command to your Telegram bot like:
  “Send email to Lisa about invoice update”
  The AI agent will understand the command, fetch the contact, and either send/draft an email or update the calendar accordingly.

  Customize Prompts or Actions (Optional)
  Edit the system prompt in the AI Agent node to:

  Add company branding
  Adjust supported commands
  Modify language or tone
  💬 Example Prompts

  “Send email to Sam about project delay”
  “Schedule call with Mabel next Monday at 10am”
  “Delete event with Kevin”
  “Follow up with Clara at noon tomorrow”
  📦 What’s Included

  🧠 Preconfigured n8n Workflow
  🔗 Connected nodes: Telegram, Gmail, Google Calendar, Google Sheets, MCP Tools
  🗂️ AI Memory Context (via MCP memory buffer)
  ✍️ Ready-to-use prompt template
  🎯 Tested commands and use cases
  🛍️ License

  ✅ Commercial use included
  🚫 Do not resell the template without modifications

nodes_used:
  ["n8n-nodes-base.telegram","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.lmChatGoogleGemini","@n8n/n8n-nodes-langchain.mcpClientTool"]

workflow_json:
  {"id":"huYO1F7i4gBmKLV6","meta":{"instanceId":"2000c64071c20843606b95c63795bb0797c41036047055a6586498e855b96efc","templateCredsSetupCompleted":true},"name":"Telegram AI  Assistant with Gmail, Google Calendar, Google Sheets","tags":[],"nodes":[{"id":"ae2d7249-fd1c-434e-8a84-8d3cdb88b2b9","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[220,0],"parameters":{},"typeVersion":1.8},{"id":"1ee01ee2-9940-48a6-a3af-4550bbd95021","name":"MCP Client","type":"@n8n/n8n-nodes-langchain.mcpClientTool","position":[440,240],"parameters":{},"typeVersion":1},{"id":"827ee703-f4d0-4c42-bc3a-47dc292866bf","name":"MCP Server Trigger","type":"@n8n/n8n-nodes-langchain.mcpTrigger","position":[660,140],"webhookId":"17e4eb47-0a40-46bd-a013-9bd844c79491","parameters":{},"typeVersion":1},{"id":"3deadc24-76d0-4ddf-954e-4dd811f0ef3c","name":"Gmail","type":"n8n-nodes-base.gmailTool","position":[520,460],"webhookId":"8fdcbcce-8b08-484f-8198-d9f197e6beec","parameters":{},"typeVersion":2.1},{"id":"0f1178e2-f7bb-4127-a3c3-5c1f00c0c95e","name":"Gmail1","type":"n8n-nodes-base.gmailTool","position":[620,460],"webhookId":"ad715b5e-52c7-405a-a756-621a39ad1015","parameters":{},"typeVersion":2.1},{"id":"ca9d6ff3-e082-4583-ba2a-9c78ff6dee0a","name":"Gmail2","type":"n8n-nodes-base.gmailTool","position":[720,460],"webhookId":"ca587842-8a75-4f9a-a00a-40e4233e1da4","parameters":{},"typeVersion":2.1},{"id":"f416af64-036e-4d5b-addf-159f763bd1e3","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[500,400],"parameters":{"content":""},"typeVersion":1},{"id":"cf9ed6e3-a644-46fb-9fc2-a684595c48d5","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[880,400],"parameters":{"content":""},"typeVersion":1},{"id":"aafc628e-577a-4478-bc2d-56676788f937","name":"Google Calendar","type":"n8n-nodes-base.googleCalendarTool","position":[900,460],"parameters":{},"typeVersion":1.3},{"id":"1cdf4f20-3348-4635-992d-0ad64f7697e9","name":"Google Calendar1","type":"n8n-nodes-base.googleCalendarTool","position":[1020,460],"parameters":{},"typeVersion":1.3},{"id":"e3b9f739-d768-4a8b-8028-5d5f01be8c4b","name":"Google Calendar2","type":"n8n-nodes-base.googleCalendarTool","position":[1120,440],"parameters":{},"typeVersion":1.3},{"id":"67a5a7eb-f690-4c59-bccd-023bc3262899","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[100,220],"parameters":{},"typeVersion":1},{"id":"a02893db-bb2b-412a-b66a-700cfa846d1c","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[320,220],"parameters":{},"typeVersion":1.3},{"id":"61c3bce9-fcd2-4711-a31e-d2e1d5fbc4c6","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[1040,120],"parameters":{"content":""},"typeVersion":1},{"id":"a4395531-c404-4ea4-a0df-dc919a54cf17","name":"contact data","type":"n8n-nodes-base.googleSheetsTool","position":[1100,180],"parameters":{},"typeVersion":4.6},{"id":"a2059e87-e39f-4dab-a19a-4030ed04e269","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[-20,0],"webhookId":"e9d9dcb0-c0b8-47a5-b034-f6c63e73507f","parameters":{},"typeVersion":1.2},{"id":"eba9deef-2dd0-4662-9b50-3c35c42fa549","name":"Telegram","type":"n8n-nodes-base.telegram","position":[580,0],"webhookId":"06cc6fce-2eb7-4eb2-bab4-a7ed13e81854","parameters":{},"typeVersion":1.2}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"ae83d16a-d907-482e-8793-e519f1228e14","connections":{"Gmail":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"Gmail1":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"Gmail2":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"AI Agent":{"main":[[{"node":"Telegram","type":"main","index":0}]]},"MCP Client":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"contact data":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Google Calendar":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"Google Calendar1":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"Google Calendar2":{"ai_tool":[[{"node":"MCP Server Trigger","type":"ai_tool","index":0}]]},"Telegram Trigger":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]}}}


name: Pyragogy AI-Driven Handbook Generator with Multi-Agent Orchestration
author_name: Fabrizio Terzi
author_username: org
categories: []
created_at: 2025-06-12T15:46:54.341Z
updated_at: 2025-06-12T15:46:54.341Z
url: https://n8n.io/workflows/4904
scraped_at: 2025-07-06 21:16:30
description:
  AI-Driven Handbook Generator with Multi-Agent Orchestration (Pyragogy AI Village)

  This n8n workflow is a modular, multi-agent AI orchestration system designed for the collaborative generation of Markdown-based handbooks. Inspired by peer learning and open publishing workflows, it simulates a content pipeline where specialized AI agents act in defined roles, enabling true AI–human co-creation and iterative refinement.

  This project is a core component of Pyragogy, an open framework dedicated to ethical cognitive co-creation, peer AI–human learning, and human-in-the-loop automation for open knowledge systems. It implements the master orchestration architecture for the Pyragogy AI Village, managing a complex sequence of AI agents to process input, perform review, synthesis, and archiving, with a crucial human oversight step for final approval.

  How It Works: A Deep Dive into the Workflow's Architecture

  The workflow orchestrates a sophisticated content generation and review process, ideal for creating AI-driven knowledge bases or handbooks with human oversight.

  Webhook Trigger & Input:* The process begins when the workflow receives a JSON input via a *Webhook** (specifically at /webhook/pyragogy/process). This input typically includes details like the handbook's title, initial text, and relevant tags.

  Database Verification:* It first verifies the connection to a *PostgreSQL database** to ensure data persistence.

  Meta-Orchestrator:* A powerful *Meta-Orchestrator** (powered by gpt-4o from OpenAI) analyzes the initial request. Its role is to dynamically determine and activate the optimal sequence of specialized AI agents required to fulfill the input, ensuring tasks are dynamically routed and assigned based on each agent’s responsibility.

  Agent Execution & Iteration:** Each activated agent executes its step using OpenAI or custom endpoints. This involves:

      Content Generation: Agents like the Summarizer and the Synthesizer generate new content or refine existing text.

      Peer Review Board: A crucial aspect is the Peer Review Board, comprised of AI agents like the Peer Reviewer, the Sensemaking Agent, and the Prompt Engineer. This board evaluates the output for quality, coherence, and accuracy.

      Reprocessing & Redrafting: If the review agents flag a major_issue, they trigger redrafting loops by generating specific feedback for the Synthesizer. This mechanism ensures iterative refinement until the content meets the required standards.

  Human-in-the-Loop (HITL) Review:* For final approval, particularly for the Archivist agent's output, a *human review process* is initiated. An email is sent to a human reviewer, prompting them to approve, reject, or comment via a "Wait for Webhook" node. This ensures *human oversight** and quality control.

  Content Persistence & Versioning:** If the content is approved by the human reviewer:

      It's saved to a PostgreSQL database (specifically to the handbook_entries and agent_contributions tables).

      Optionally, the content can be committed to a GitHub repository for version control, provided the necessary environment variables are configured.

  Notifications:* The final output and the sequence of executed agents can be sent as a notification to *Slack**, if configured.

  Observe the dynamic loop: orchestrate → assign → generate → review (AI/human) → store

  Included AI Agents

  This workflow leverages a suite of specialized AI agents, each with a distinct role in the content pipeline:

  Meta-Orchestrator:** Determines the optimal sequence of agents to execute based on the input.

  Summarizer Agent:** Summarizes text into key points (e.g., 3 key points).

  Synthesizer Agent:** Synthesizes new text and effectively incorporates reprocessing feedback from review agents.

  Peer Reviewer Agent:** Reviews generated text, highlighting strengths, weaknesses, and suggestions, and indicates major_issue flags.

  Sensemaking Agent:** Analyzes input within existing context, identifying patterns, gaps, and areas for improvement.

  Prompt Engineer Agent:** Refines or generates prompts for subsequent agents, optimizing their output.

  Onboarding/Explainer Agent:** Provides explanations of the process or offers guidance to users.

  Archivist Agent:** Prepares content for the handbook, manages the human review process, and handles archiving to the database and GitHub.

  Setup Steps & Prerequisites

  To get this powerful workflow up and running, follow these steps:

  Import the Workflow: Import the pyragogy_master_workflow.json (or generate-collaborative-handbooks-with-gpt4o-multi-agent-orchestration-human-review.json) into your n8n instance.

  Connect Credentials:

      Postgres: Set up a Postgres Pyragogy DB credential (ID: pyragogy-postgres).

      OpenAI: Configure an OpenAI Pyragogy credential (ID: pyragogy-openai) for all OpenAI agents. GPT-4o is highly suggested for optimal performance.

      Email Send: Set up a configured email credential (e.g., for sending human review requests).

  Define Environment Variables: Define essential environment variables (an .env.template is included in the repository). These include:

      API base for OpenAI.

      Database connection details.

      (Optional) GitHub: For content persistence and versioning, configure GITHUB_ACCESS_TOKEN, GITHUB_REPOSITORY_OWNER, and GITHUB_REPOSITORY_NAME.

      (Optional) Slack: For notifications, configure SLACK_WEBHOOK_URL.

  Send a sample payload to your webhook URL (/webhook/pyragogy/process):

  {
  "title": "History of Peer Learning",
  "text": "Peer learning is an educational approach where students learn from and with each other...",
  "tags": ["education", "pedagogy"],
  "requireHitl": true
  }

  Ideal For

  This workflow is perfectly suited for:

  Educators and researchers exploring AI-assisted publishing and co-authoring with AI.

  Knowledge teams looking to automate content pipelines for internal or external documentation.

  Anyone building collaborative Markdown-driven tools or AI-powered knowledge bases.

  Documentation & Contributions: An Open Source and Collaborative Project

  This workflow is an open-source project and community-driven. Its development is transparent and open to everyone.

  We warmly invite you to:

  Review it:** Contribute your analysis, identify potential improvements, or report issues.

  Remix it:** Adapt it to your specific needs, integrate new features, or modify it for a different use case.

  Improve it:** Propose and implement changes that enhance its efficiency, robustness, or capabilities.

  Share it back:** Return your contributions to the community, either through pull requests or by sharing your implementations.

  Every contribution is welcome and valued! All relevant information for verification, improvement, and collaboration can be found in the official repository:

  🔗 GitHub – pyragogy-handbook-n8n-workflow

nodes_used:
  ["n8n-nodes-base.emailSend","n8n-nodes-base.github","n8n-nodes-base.postgres","n8n-nodes-base.slack","n8n-nodes-base.openAi"]

workflow_json:
  {"id":"eTfM9cjV0i7PQtsZ","meta":{"instanceId":"59d894873e0437e59dde7eeb7a4a896fa57f47f2baf669a3f0fabefee671c695"},"name":"AI-Driven Handbook Generator with Multi-Agent Orchestration (Pyragogy AI Village)","tags":[{"id":"cPTJEblSALLWTPH5","name":"Pyragogy","createdAt":"2025-06-12T12:35:25.060Z","updatedAt":"2025-06-12T12:35:25.060Z"},{"id":"6QE2GMT2wg7PfNjo","name":"Multi-Agent","createdAt":"2025-06-12T12:35:25.071Z","updatedAt":"2025-06-12T12:35:25.071Z"},{"id":"NRBaVI2WatxRn6jb","name":"Orchestration","createdAt":"2025-06-12T12:35:25.064Z","updatedAt":"2025-06-12T12:35:25.064Z"},{"id":"Fz7qIHTqqiYux3E1","name":"Human-in-Loop","createdAt":"2025-06-12T12:35:25.065Z","updatedAt":"2025-06-12T12:35:25.065Z"}],"nodes":[{"id":"907e30c8-87e4-46f8-8863-9e3abf429415","name":"Start","type":"n8n-nodes-base.start","position":[-1600,300],"parameters":{},"typeVersion":1},{"id":"ae6910fd-9244-4bab-a0f7-c91a4ad84f28","name":"Webhook Trigger","type":"n8n-nodes-base.webhook","position":[-1400,300],"webhookId":"pyragogy-master-trigger","parameters":{"path":"pyragogy/process","options":{},"httpMethod":"POST"},"typeVersion":1},{"id":"a782c52f-b296-4477-8cf4-454a7df0c8a5","name":"Check DB Connection","type":"n8n-nodes-base.postgres","position":[-1200,300],"parameters":{"query":"SELECT 1; -- Verifica connessione DB","operation":"executeQuery","additionalFields":{}},"typeVersion":1},{"id":"3df503dd-db5e-4bd1-8925-e715b8bbe03c","name":"Meta-Orchestrator","type":"n8n-nodes-base.openAi","position":[-1000,300],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"a4c7eb13-bd36-4c9d-8927-2e6fe54c32a3","name":"Parse Orchestration Plan","type":"n8n-nodes-base.function","position":[-800,300],"parameters":{"functionCode":"// Analizza il piano di orchestrazione e imposta per il looping\nlet rawPlan = $json.choices[0].message.content;\nlet plan;\n\ntry {\n  plan = JSON.parse(rawPlan);\n} catch (e) {\n  // Se il parsing fallisce, assumi che sia una stringa di array grezza\n  plan = rawPlan;\n}\n\n// Estrai in modo sicuro la sequenza degli agenti:\n// Se 'plan' è un oggetto e ha una chiave 'agents', usala.\n// Altrimenti, se 'plan' è un array, usalo direttamente.\n// Altrimenti, predefinisci un array vuoto.\nconst agentSequence = Array.isArray(plan) ? plan : (plan && plan.agents && Array.isArray(plan.agents) ? plan.agents : []);\n\n// Memorizza la sequenza e l'indice corrente per il loop\n$workflow.agentSequence = agentSequence;\n$workflow.currentAgentIndex = 0;\n$workflow.redraftLoopCount = 0; // Inizializza il contatore dei cicli di rielaborazione\n\n// Passa i dati di input al primo agente, assicurandosi che $items[0].json.body esista\nconst initialInput = $items[0] && $items[0].json && $items[0].json.body ? $items[0].json.body : {};\n\nreturn [{ json: { ...initialInput, agentToRun: agentSequence[0] || null } }];"},"typeVersion":1},{"id":"915e18ea-1540-4059-883f-739f77f41cc2","name":"More Agents to Run?","type":"n8n-nodes-base.if","position":[-600,300],"parameters":{"conditions":{"boolean":[{"value1":"={{ $workflow.currentAgentIndex < $workflow.agentSequence.length }}","value2":true}]}},"typeVersion":1},{"id":"6f478d71-791e-4f6b-b5e3-5b7b842181b0","name":"Prepare Agent Input","type":"n8n-nodes-base.function","position":[-400,200],"parameters":{"functionCode":"// Ottieni il nome dell'agente corrente\nconst agentName = $workflow.agentSequence[$workflow.currentAgentIndex];\n\n// Prepara i dati per l'esecuzione dell'agente\n// Passa l'output del passo precedente (o l'input iniziale).\n// Se stiamo rielaborando, l'input dell'agente dovrebbe includere il feedback di rielaborazione.\nconst previousOutput = $json.output || $json.body.input; // Assumendo che l'output dell'agente sia memorizzato nella chiave 'output'\nconst agentInput = $json.redraftInput || previousOutput; // Usa redraftInput se presente, altrimenti previousOutput\n\nreturn [{ json: { ...$json, agentToRun: agentName, agentInput: agentInput } }];"},"typeVersion":1},{"id":"d575e9c9-2d58-4061-944b-61b32d15eefb","name":"Route Agents with Switch","type":"n8n-nodes-base.switch","position":[-200,200],"parameters":{"mode":"json"},"typeVersion":1},{"id":"3711824c-5a58-4e3d-95dd-3ca16cc551ca","name":"Summarizer Agent","type":"n8n-nodes-base.openAi","position":[0,0],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"67b23742-e3bd-4437-99eb-957e6bc0912e","name":"Synthesizer Agent","type":"n8n-nodes-base.openAi","position":[0,100],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"8bfe179e-ed05-43df-b9c6-862f86c1189c","name":"Peer Reviewer Agent","type":"n8n-nodes-base.openAi","position":[0,200],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"2dc73ca6-f17f-4214-acbb-3ea3ed470f13","name":"Sensemaking Agent","type":"n8n-nodes-base.openAi","position":[0,300],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"ec3b9cc0-a039-4cac-90ca-7de54f41f5d4","name":"Prompt Engineer Agent","type":"n8n-nodes-base.openAi","position":[0,400],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"bc382e04-9c5d-4ab9-b874-2da213499614","name":"Onboarding/Explainer Agent","type":"n8n-nodes-base.openAi","position":[0,500],"parameters":{"model":"gpt-4o","options":{},"resource":"chat","requestOptions":{}},"typeVersion":1},{"id":"03017738-b11e-4016-8c05-65204ef7e8c3","name":"Add Handbook Metadata","type":"n8n-nodes-base.function","position":[0,600],"parameters":{"functionCode":"// Prepara i metadati per il contenuto dell'Handbook.\n// Assicurati che l'input originale contenga 'title' e 'tags' o imposta dei valori predefiniti.\nconst title = $json.body.title || 'Untitled Handbook Entry';\nconst tags = $json.body.tags || [];\nconst phase = $json.body.phase || 'draft'; // Fase iniziale, può essere 'final' dopo l'approvazione\nconst rhythm = $json.body.rhythm || 'on-demand'; // Ritmo cognitivo\n\nreturn [{ json: { ...$json, handbookTitle: title, handbookTags: tags, handbookPhase: phase, handbookRhythm: rhythm } }];"},"typeVersion":1},{"id":"d183d513-00a3-4a38-9ef8-37a646d2ad15","name":"Generate Content for Review","type":"n8n-nodes-base.function","position":[200,600],"parameters":{"functionCode":"// Prepara il contenuto proposto dall'Archivista per la revisione umana, inclusa la formattazione YAML.\n// Assicurati che l'input dell'agente (il contenuto generato) sia disponibile.\nconst proposedContent = $json.agentInput;\nconst title = $json.handbookTitle;\nconst tags = $json.handbookTags;\nconst phase = $json.handbookPhase;\nconst rhythm = $json.handbookRhythm;\n\n// Costruisci il front-matter YAML\nconst yamlFrontMatter = `---\ntitle: \"${title.replace(/\"/g, '\\\"')}\"\ntags: [${tags.map(t => `\"${t.replace(/\"/g, '\\\"')}\"`).join(', ')}]\nphase: \"${phase}\"\nrhythm: \"${rhythm}\"\n---\n\n`;\n\nconst finalMarkdownContent = yamlFrontMatter + proposedContent;\n\nreturn [{ json: { ...$json, proposedContent: proposedContent, reviewTitle: title, reviewTags: tags, finalMarkdownContent: finalMarkdownContent } }];"},"typeVersion":1},{"id":"41919337-0762-47d0-9c7c-d51fa966caae","name":"Generate Review ID","type":"n8n-nodes-base.function","position":[400,600],"parameters":{"functionCode":"// Genera un ID univoco per questa richiesta di revisione.\n// Questo ID verrà usato per correlare la risposta del revisore con questa istanza del workflow.\nconst reviewId = crypto.randomUUID();\n\nreturn [{ json: { ...$json, reviewId: reviewId } }];"},"typeVersion":1},{"id":"6fb5b6d5-4ea8-49c9-9ebc-3c37eb2897b8","name":"Send Review Request Email","type":"n8n-nodes-base.emailSend","position":[600,600],"parameters":{"html":"<h3>Revisione Contenuto Pyragogy Handbook: {{ $json.reviewTitle }}</h3>\n<p>Ciao revisore,</p>\n<p>È stato proposto un nuovo contenuto per l'Handbook:</p>\n<hr>\n<pre>{{ $json.proposedContent }}</pre>\n<hr>\n<p><strong>Titolo:</strong> {{ $json.reviewTitle }}</p>\n<p><strong>Tags:</strong> {{ $json.reviewTags.join(', ') }}</p>\n<p>Per favore, clicca su uno dei seguenti link per approvare o rifiutare:</p>\n<p><a href=\"your_n8n_url/webhook/pyragogy/review-feedback?reviewId={{ $json.reviewId }}&status=approved\">Approva</a></p>\n<p><a href=\"your_n8n_url/webhook/pyragogy/review-feedback?reviewId={{ $json.reviewId }}&status=rejected\">Rifiuta</a></p>\n<p>Grazie!</p>","text":"Ciao revisore,\n\nÈ stato proposto un nuovo contenuto per l'Handbook:\n\n---\n{{ $json.proposedContent }}\n---\n\nTitolo: {{ $json.reviewTitle }}\nTags: {{ $json.reviewTags.join(', ') }}\n\nPer favore, clicca su uno dei seguenti link per approvare o rifiutare:\n\nApprova: your_n8n_url/webhook/pyragogy/review-feedback?reviewId={{ $json.reviewId }}&status=approved\nRifiuta: your_n8n_url/webhook/pyragogy/review-feedback?reviewId={{ $json.reviewId }}&status=rejected\n\nGrazie!","options":{},"subject":"Revisione Contenuto Pyragogy Handbook: {{ $json.reviewTitle }}","toEmail":"human-reviewer@example.com","fromEmail":"your-email@example.com"},"typeVersion":1},{"id":"e69480df-aab3-4b05-8c2b-5ec369966084","name":"Wait for Human Approval","type":"n8n-nodes-base.wait","position":[800,600],"webhookId":"7eeea69b-5e91-469e-b874-1a8eb5bb49e2","parameters":{},"typeVersion":1},{"id":"80fca66e-fdc6-49b1-9873-b10c03409926","name":"Human Decision Split","type":"n8n-nodes-base.if","position":[1000,600],"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.query.status === 'approved' }}","value2":true}]}},"typeVersion":1},{"id":"ed575c60-32e2-411e-9619-ac40ac647e3b","name":"Save to handbook_entries","type":"n8n-nodes-base.postgres","position":[1200,500],"parameters":{"table":"handbook_entries","columns":"title, content, version, created_by, tags, phase, rhythm","additionalFields":{}},"typeVersion":1},{"id":"a43a61ae-0062-4705-8ef2-a65d8bd65fb7","name":"Prepare Approved Contribution Data","type":"n8n-nodes-base.function","position":[1400,500],"parameters":{"functionCode":"// Registra il contributo dell'agente dopo l'approvazione umana\nconst entryId = $json.id; // ID dall'inserimento in handbook_entries\nconst agentName = 'Archivist';\nconst contributionType = 'Archiving (Approved)';\nconst details = { input: $json.proposedContent, metadata: { title: $json.reviewTitle, version: $json.version, tags: $json.reviewTags, phase: $json.handbookPhase, rhythm: $json.handbookRhythm }, reviewStatus: 'approved' };\n\n$items[0].json.contribution = { entryId, agentName, contributionType, details };\nreturn $items;"},"typeVersion":1},{"id":"4a03b029-e65f-4844-a605-f668c39f05f7","name":"Save Agent Contribution (Approved)","type":"n8n-nodes-base.postgres","position":[1600,500],"parameters":{"table":"agent_contributions","columns":"entry_id, agent_name, contribution_type, details","additionalFields":{}},"typeVersion":1},{"id":"9a3b2bdc-b894-4b5d-a783-003c1d0cbac5","name":"Generate GitHub File Path","type":"n8n-nodes-base.function","position":[1800,500],"parameters":{"functionCode":"// Genera il percorso del file GitHub con slug e timestamp per il versioning.\nconst chapterSlug = ($json.reviewTitle || 'untitled').replace(/[^a-zA-Z0-9]/g, '-').toLowerCase();\nconst timestamp = new Date().toISOString().replace(/[:.-]/g, ''); // Rimuove caratteri non validi per i nomi di file\nconst filePathWithVersion = `content/${chapterSlug}_v${timestamp}.md`;\n\nreturn [{ json: { ...$json, githubFilePath: filePathWithVersion } }];"},"typeVersion":1},{"id":"42831df9-f694-43fa-8612-b9aee95bef6c","name":"GitHub Enabled?","type":"n8n-nodes-base.if","position":[2000,500],"parameters":{"conditions":{"boolean":[{"value1":"={{ $env.GITHUB_ACCESS_TOKEN }}","value2":true}]}},"typeVersion":1},{"id":"2049ac7d-bf01-4d9b-a222-ca988892d1e6","name":"Commit to GitHub (Approved)","type":"n8n-nodes-base.github","position":[2200,500],"webhookId":"409bfa11-5bef-4207-a181-1a736120f698","parameters":{"owner":"={{ $env.GITHUB_REPOSITORY_OWNER }}","filePath":"={{ $json.githubFilePath }}","resource":"file","operation":"createUpdate","repository":"={{ $env.GITHUB_REPOSITORY_NAME }}"},"typeVersion":1},{"id":"352599e9-8b68-412c-bd28-f92844e9c712","name":"Log Human Rejection","type":"n8n-nodes-base.function","position":[1200,700],"parameters":{"functionCode":"// Registra il rifiuto umano del contenuto\nconst agentName = 'Archivist';\nconst reviewId = $json.reviewId;\nconst reviewStatus = 'rejected';\nconst reviewComments = $json.query.comments || 'Nessun commento fornito.';\nconst proposedContent = $json.proposedContent;\nconst title = $json.reviewTitle;\n\nconsole.log(`Contenuto proposto dall'Archivista (ID: ${reviewId}, Titolo: ${title}) rifiutato dall'umano. Commenti: ${reviewComments}`);\n\n// Prepara l'output per indicare il rifiuto e consentire al flusso di continuare.\nreturn [{ json: { ...$json, reviewStatus: reviewStatus, reviewComments: reviewComments, output: { message: `Archivista: Contenuto rifiutato dall'umano.`, status: 'rejected', comments: reviewComments } } }];"},"typeVersion":1},{"id":"6f0ea479-d689-40fc-a72f-d1ad161f8743","name":"Merge Archivist Paths","type":"n8n-nodes-base.merge","position":[2400,600],"parameters":{"mode":"mergeByPropertyName"},"typeVersion":1},{"id":"ffd0ab23-cb9d-4ac1-ad3d-6fe856ca1fad","name":"Evaluate Board Consensus","type":"n8n-nodes-base.function","position":[200,300],"parameters":{"functionCode":"// Valuta i flag 'major_issue' dagli agenti di revisione per determinare se è necessaria una rielaborazione.\nlet majorIssueCount = 0;\nlet redraftFeedback = '';\n\n// Assumi che gli output degli agenti di revisione siano accessibili tramite $node\n// (Ad esempio, se Peer Reviewer -> Sensemaking -> Prompt Engineer sono sequenziali prima di questo nodo)\n\nif ($node[\"Peer Reviewer Agent\"] && $node[\"Peer Reviewer Agent\"].json && $node[\"Peer Reviewer Agent\"].json.choices && $node[\"Peer Reviewer Agent\"].json.choices[0] && $node[\"Peer Reviewer Agent\"].json.choices[0].message && $node[\"Peer Reviewer Agent\"].json.choices[0].message.content) {\n    const peerReviewOutput = JSON.parse($node[\"Peer Reviewer Agent\"].json.choices[0].message.content);\n    if (peerReviewOutput.major_issue) majorIssueCount++;\n    redraftFeedback += `Peer Reviewer: ${peerReviewOutput.suggestions || ''}\\n`;\n}\n\nif ($node[\"Sensemaking Agent\"] && $node[\"Sensemaking Agent\"].json && $node[\"Sensemaking Agent\"].json.choices && $node[\"Sensemaking Agent\"].json.choices[0] && $node[\"Sensemaking Agent\"].json.choices[0].message && $node[\"Sensemaking Agent\"].json.choices[0].message.content) {\n    const sensemakingOutput = JSON.parse($node[\"Sensemaking Agent\"].json.choices[0].message.content);\n    if (sensemakingOutput.major_issue) majorIssueCount++;\n    redraftFeedback += `Sensemaking Agent: ${sensemakingOutput.suggestions || ''}\\n`;\n}\n\nif ($node[\"Prompt Engineer Agent\"] && $node[\"Prompt Engineer Agent\"].json && $node[\"Prompt Engineer Agent\"].json.choices && $node[\"Prompt Engineer Agent\"].json.choices[0] && $node[\"Prompt Engineer Agent\"].json.choices[0].message && $node[\"Prompt Engineer Agent\"].json.choices[0].message.content) {\n    const promptEngineerOutput = JSON.parse($node[\"Prompt Engineer Agent\"].json.choices[0].message.content);\n    if (promptEngineerOutput.major_issue) majorIssueCount++;\n    redraftFeedback += `Prompt Engineer: ${promptEngineerOutput.suggestions || ''}\\n`;\n}\n\nconst redraftNeeded = majorIssueCount >= 2; // Voto a maggioranza\n\nreturn [{ json: { ...$json, redraftNeeded: redraftNeeded, redraftFeedback: redraftFeedback } }];"},"typeVersion":1},{"id":"f2ec87e5-0a06-4d8f-896b-a3d203fcea41","name":"Check Redraft Needed","type":"n8n-nodes-base.if","position":[400,300],"parameters":{"conditions":{"boolean":[{"value1":"={{ $json.redraftNeeded && $workflow.redraftLoopCount < 2 }}","value2":true}]}},"typeVersion":1},{"id":"413074bb-38ad-42d6-8d63-402e33528a5b","name":"Handle Redraft","type":"n8n-nodes-base.function","position":[600,200],"parameters":{"functionCode":"// Gestisce la logica di rielaborazione: incrementa il contatore e reindirizza al Synthesizer.\n\n$workflow.redraftLoopCount += 1; // Incrementa il contatore del ciclo di rielaborazione\n\n// Trova l'indice del Synthesizer nella sequenza degli agenti\nconst synthesizerIndex = $workflow.agentSequence.indexOf(\"Synthesizer\");\n\n// Se il Synthesizer non è il prossimo agente, imposta l'indice corrente per farlo ripartire dal Synthesizer.\n// Questo garantisce che il Synthesizer venga eseguito successivamente per la rielaborazione.\nif ($workflow.currentAgentIndex !== synthesizerIndex) {\n    $workflow.currentAgentIndex = synthesizerIndex;\n} else {\n    // Se siamo già sul Synthesizer (es. dopo il primo passaggio del loop), assicurati che l'indice vada avanti normalmente nel prossimo ciclo.\n    // Questo è un caso limite, di solito il Prepare Agent Input lo gestirà.\n}\n\n// Passa il feedback di rielaborazione come input per il Synthesizer.\n// Il nodo 'Prepare Agent Input' utilizzerà questo campo per aggiornare 'agentInput'.\nreturn [{ json: { ...$json, redraftInput: $json.output + \"\\n\\nFeedback per la rielaborazione dal Peer Review Board:\\n\" + $json.redraftFeedback } }];"},"typeVersion":1},{"id":"6508f0f9-09c2-4fe6-8cae-eb90ea58d875","name":"Process Agent Output","type":"n8n-nodes-base.function","position":[400,200],"parameters":{"functionCode":"// Ottieni il nome dell'agente appena eseguito\nconst agentName = $json.agentToRun;\nlet agentOutput = '';\n\n// Costruisci dinamicamente il nome del nodo per il recupero dell'output\nlet actualNodeName;\n\n// Gestione speciale per l'Archivista dopo la revisione umana\nif (agentName === 'Archivist') {\n    if ($json.query && $json.query.status === 'approved') {\n        agentOutput = { message: 'Contenuto archiviato con successo dopo l'approvazione umana.', entryId: $json.id || 'N/A', handbookMetadata: { title: $json.reviewTitle, tags: $json.reviewTags, phase: $json.handbookPhase, rhythm: $json.handbookRhythm } };\n    } else if ($json.query && $json.query.status === 'rejected') {\n        agentOutput = { message: 'Archiviazione rifiutata dall'umano.', reviewComments: $json.query.comments || 'Nessun commento' };\n    } else if ($json.reviewStatus === 'rejected') {\n        // Caso in cui la revisione umana è stata rifiutata e si proviene dal ramo di rifiuto\n        agentOutput = { message: 'Archiviazione rifiutata dall'umano (tramite ramo di rifiuto).', reviewComments: $json.reviewComments || 'Nessun commento' };\n    } else {\n        agentOutput = { message: 'Processo Archivista: Attesa revisione umana o stato inatteso.', status: 'pending_review' };\n    }\n} else {\n    // Logica originale per gli altri agenti OpenAI\n    if (agentName === 'Onboarding/Explainer') {\n        actualNodeName = 'Onboarding/Explainer Agent';\n    } else {\n        actualNodeName = agentName + ' Agent';\n    }\n\n    // Tenta in modo sicuro di recuperare l'output dal nodo determinato dinamicamente\n    // Tenta anche di analizzare il JSON se l'output dell'agente è un oggetto JSON (come per gli agenti di revisione)\n    let rawContent = '';\n    if ($node[actualNodeName] && $node[actualNodeName].json && $node[actualNodeName].json.choices && $node[actualNodeName].json.choices[0] && $node[actualNodeName].json.choices[0].message && $node[actualNodeName].json.choices[0].message.content) {\n        rawContent = $node[actualNodeName].json.choices[0].message.content;\n    } else {\n        console.warn(`Impossibile trovare l'output chat OpenAI standard per il nodo: ${actualNodeName}. Ritorno al JSON grezzo.`);\n        agentOutput = $node[actualNodeName] ? $node[actualNodeName].json : `Nessun output specifico trovato per ${agentName}`;\n    }\n\n    // Tenta di analizzare il contenuto come JSON se l'agente è un agente di revisione\n    if (agentName === 'Peer Reviewer' || agentName === 'Sensemaking Agent' || agentName === 'Prompt Engineer') {\n        try {\n            agentOutput = JSON.parse(rawContent);\n        } catch (e) {\n            console.warn(`Impossibile analizzare l'output di ${agentName} come JSON. Trattato come stringa.`);\n            agentOutput = rawContent;\n        }\n    } else {\n        agentOutput = rawContent;\n    }\n}\n\n// Registra il contributo\nconst contribution = {\n    agent: agentName,\n    output: agentOutput,\n    timestamp: new Date().toISOString()\n};\n\n// Assicurati che l'array dei contributi esista e aggiungi il nuovo contributo\nconst existingContributions = Array.isArray($json.contributions) ? $json.contributions : [];\n\n// Incrementa l'indice dell'agente per il loop (solo se non siamo in rielaborazione e questo non è un agente di revisione che porta a rielaborazione)\n// Questo è gestito dalla logica di 'Handle Redraft' che forza l'indice per il riavvio.\nif (!($json.redraftNeeded && $workflow.redraftLoopCount < 2 && agentName !== 'Synthesizer')) { // Evita doppio incremento se riavvia il Synthesizer\n    $workflow.currentAgentIndex += 1;\n}\n\n// Restituisce l'elemento aggiornato, preservando l'input originale, aggiungendo l'output corrente e tutti i contributi\nreturn [{ json: { ...$items[0].json, output: agentOutput, contributions: [...existingContributions, contribution] } }];"},"typeVersion":1},{"id":"2fd3c340-a2d0-489c-a098-42530fdb4c61","name":"Slack Enabled?","type":"n8n-nodes-base.if","position":[-400,500],"parameters":{"conditions":{"boolean":[{"value1":"={{ $env.SLACK_WEBHOOK_URL }}","value2":true}]}},"typeVersion":1},{"id":"314c7a11-493a-4550-9cd0-f1fc5e5b2994","name":"Notify Slack","type":"n8n-nodes-base.slack","position":[-200,500],"parameters":{"text":"Pyragogy AI Village Workflow Completato!\nInput: {{ $json.body.input }}\nOutput Finale: {{ JSON.stringify($json.output) }}\nAgenti Eseguiti: {{ $workflow.agentSequence.join(', ') }}","attachments":[],"otherOptions":{}},"typeVersion":1},{"id":"564a52df-8f4f-4be6-a219-b8c965eccd3b","name":"Final Response","type":"n8n-nodes-base.respondToWebhook","position":[-400,400],"parameters":{"options":{},"respondWith":"json","responseBody":"={{ { finalOutput: $json.output, contributions: $json.contributions, agentSequence: $workflow.agentSequence } }}"},"typeVersion":1},{"id":"generated-ce444b1c-b361-43c8-a0b6-29a1324993c5","name":"Workflow Overview","type":"n8n-nodes-base.stickyNote","position":[-1600,-140],"parameters":{"width":1100,"height":400,"content":"## Pyragogy AI Village Workflow\n\nThis workflow orchestrates an AI Village process for generating, reviewing, and publishing content to a handbook.\n\n**Key Stages:**\n1.  **Trigger & DB Check:** Initiates the workflow via webhook and verifies database connection.\n2.  **Orchestration:** Meta-Orchestrator plans agent execution.\n3.  **Agent Execution Loop:** Dynamically runs various AI agents (Summarizer, Synthesizer, Peer Reviewer, Sensemaking, Prompt Engineer, Onboarding/Explainer) based on the orchestration plan. Includes a redraft mechanism for iterative improvements.\n4.  **Human Review:** Content generated by agents (specifically Archivist) undergoes human approval.\n5.  **Publishing:** Approved content is saved to a PostgreSQL database and committed to GitHub.\n6.  **Notifications:** Sends final response and Slack notifications.\n\n**Note:** Several nodes have credential issues (Postgres, OpenAI, SMTP, GitHub, Slack) and require configuration to function correctly."}}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"a46219cb-1681-4236-bc4b-9c0c4f58389f","connections":{"Notify Slack":{"main":[[{"node":"Final Response","type":"main","index":0}]]},"Handle Redraft":{"main":[[{"node":"More Agents to Run?","type":"main","index":0}]]},"Slack Enabled?":{"main":[[{"node":"Notify Slack","type":"main","index":0}],[{"node":"Final Response","type":"main","index":0}]]},"GitHub Enabled?":{"main":[[{"node":"Commit to GitHub (Approved)","type":"main","index":0}],[{"node":"Merge Archivist Paths","type":"main","index":0}]]},"Webhook Trigger":{"main":[[{"node":"Check DB Connection","type":"main","index":0}]]},"Summarizer Agent":{"main":[[{"node":"Process Agent Output","type":"main","index":0}]]},"Meta-Orchestrator":{"main":[[{"node":"Parse Orchestration Plan","type":"main","index":0}]]},"Sensemaking Agent":{"main":[[{"node":"Prompt Engineer Agent","type":"main","index":0}]]},"Synthesizer Agent":{"main":[[{"node":"Process Agent Output","type":"main","index":0}]]},"Generate Review ID":{"main":[[{"node":"Send Review Request Email","type":"main","index":0}]]},"Check DB Connection":{"main":[[{"node":"Meta-Orchestrator","type":"main","index":0}]]},"Log Human Rejection":{"main":[[{"node":"Merge Archivist Paths","type":"main","index":0}]]},"More Agents to Run?":{"main":[[{"node":"Prepare Agent Input","type":"main","index":0}],[{"node":"Slack Enabled?","type":"main","index":0}]]},"Peer Reviewer Agent":{"main":[[{"node":"Sensemaking Agent","type":"main","index":0}]]},"Prepare Agent Input":{"main":[[{"node":"Route Agents with Switch","type":"main","index":0}]]},"Check Redraft Needed":{"main":[[{"node":"Handle Redraft","type":"main","index":0}],[{"node":"Process Agent Output","type":"main","index":0}]]},"Human Decision Split":{"main":[[{"node":"Save to handbook_entries","type":"main","index":0}],[{"node":"Log Human Rejection","type":"main","index":0}]]},"Process Agent Output":{"main":[[{"node":"More Agents to Run?","type":"main","index":0}]]},"Add Handbook Metadata":{"main":[[{"node":"Generate Content for Review","type":"main","index":0}]]},"Merge Archivist Paths":{"main":[[{"node":"Process Agent Output","type":"main","index":0}]]},"Prompt Engineer Agent":{"main":[[{"node":"Evaluate Board Consensus","type":"main","index":0}]]},"Wait for Human Approval":{"main":[[{"node":"Human Decision Split","type":"main","index":0}]]},"Evaluate Board Consensus":{"main":[[{"node":"Check Redraft Needed","type":"main","index":0}]]},"Parse Orchestration Plan":{"main":[[{"node":"More Agents to Run?","type":"main","index":0}]]},"Route Agents with Switch":{"main":[[{"node":"Summarizer Agent","type":"main","index":0}]]},"Save to handbook_entries":{"main":[[{"node":"Prepare Approved Contribution Data","type":"main","index":0}]]},"Generate GitHub File Path":{"main":[[{"node":"GitHub Enabled?","type":"main","index":0}]]},"Send Review Request Email":{"main":[[{"node":"Wait for Human Approval","type":"main","index":0}]]},"Onboarding/Explainer Agent":{"main":[[{"node":"Process Agent Output","type":"main","index":0}]]},"Commit to GitHub (Approved)":{"main":[[{"node":"Merge Archivist Paths","type":"main","index":0}]]},"Generate Content for Review":{"main":[[{"node":"Generate Review ID","type":"main","index":0}]]},"Prepare Approved Contribution Data":{"main":[[{"node":"Save Agent Contribution (Approved)","type":"main","index":0}]]},"Save Agent Contribution (Approved)":{"main":[[{"node":"Generate GitHub File Path","type":"main","index":0}]]}}}


name: Generate and Publish SEO-Optimized Blog Posts to Blogger with OpenAI & DALL-E
author_name: Khairul Muhtadin
author_username: khmuhtadin
categories: []
created_at: 2025-06-12T16:01:16.042Z
updated_at: 2025-06-12T16:01:16.042Z
url: https://n8n.io/workflows/4905
scraped_at: 2025-07-06 21:16:30
description:
  This n8n workflow, BlogBlizt: Blogger Edition, automates the complete creation and publishing of long-form blog posts to Blogger, saving you hours of content creation time. Simply send a blog title via Telegram, and it generates comprehensive 10,000+ word articles with custom conceptual images and publishes everything to your Blogger site with proper SEO structure and custom URLs.

  Who is this for?
  Blogger users, content creators, and digital marketers who want to automate high-quality, SEO-optimized blog content creation without manual writing or formatting. Perfect for those using Google's Blogger platform instead of WordPress.

  What problem is this workflow solving?
  Creating engaging, long-form content with proper SEO optimization is extremely time-consuming and requires expertise. Most automation tools focus on WordPress, leaving Blogger users behind. BlogBlizt: Blogger Edition solves this by automating the entire Blogger publishing process—from generating SEO metadata and writing comprehensive articles to creating custom images and publishing with proper URL structure.

  What this workflow does
  Triggers**: Receives blog title input via Telegram message
  AI-Powered Content**: Uses OpenAI GPT-4.1-mini to generate SEO metadata (title, slug, labels) and comprehensive articles
  Advanced Image Generation**: Creates custom conceptual images using DALL-E that visually represent your article's theme
  SEO Features**: Generates custom URLs with date structure, meta descriptions, and proper HTML formatting
  Reference Features**: Utilizing GPT 4.1 could reference valid and credible resource into great citation
  Blogger Integration**: Rare automated publishing directly to Blogger (not WordPress) with full API integration
  Image Hosting**: Automatically uploads generated images to Imgur and embeds them properly
  Instant Notifications**: Sends published blog link back via Telegram with mobile-optimized URLs

  Setup
  n8n Instance: Ensure you have a cloud or self-hosted n8n instance
  Credentials:
    Google OAuth2: For Blogger API access with https://www.googleapis.com/auth/blogger scope
    OpenAI API: For GPT-4.1-mini text generation and DALL-E image creation
    Telegram Bot: For receiving titles and sending notifications
    Imgur Client-ID: For image hosting and embedding
  Google Cloud Configuration:
    Enable Blogger API in Google Cloud Console
    Configure OAuth consent screen and create OAuth client ID
  Telegram Bot Setup:
    Create bot via @BotFather and get API token
    Test workflow to capture chat_id for notifications
  Test: Send any blog title via Telegram to generate your first automated post

  How to customize this workflow to your needs
  Change Writing Style**: Modify prompts for formal, casual, technical, or any specific tone
  Adjust Article Length**: Change minimum word count (currently 10,000+ words) to fit your needs
  SEO Optimization**: Customize keyword density and focus phrases in the writing prompts
  Image Aesthetics**: Modify DALL-E prompts for different visual styles (minimalist, corporate, artistic)
  URL Structure**: Edit JavaScript code to change custom URL formatting patterns
  Multi-Language**: Adapt prompts for any language or regional dialect
  Content Categories**: Add automatic categorization and tagging based on topics

  Pre-Requirements
  n8n Instance**: Cloud or self-hosted with LangChain nodes available
  API Access**:
   OpenAI API key for GPT-4.1-mini and DALL-E access
   Google OAuth2 credentials with Blogger API enabled
   Telegram Bot API token
   Imgur Client-ID for anonymous image uploads
  Blogger Setup**: Active Blogger blog with proper permissions
  Network**: Stable internet connection for AI generation and publishing

  Category: Marketing, Content Creation  
  Nodes Used: Telegram Trigger, LangChain LLM Chain, OpenAI (GPT-4.1-mini), OpenAI (DALL-E), HTTP Request, Google OAuth2, Blogger API, JavaScript Code

  Made by: Khaisa Studio  
  Tag: youtube, summarizer, telegram, openai  
  Category: AI Automation, Video Tools
  Need a custom? Contact Me 

nodes_used:
  ["n8n-nodes-base.httpRequest","n8n-nodes-base.telegram","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.outputParserStructured","@n8n/n8n-nodes-langchain.openAi"]

workflow_json:
  {"id":"eXhBHiSdeLyGHFzS","meta":{"instanceId":"c2650793f644091dc80fb900fe63448ad1f4b774008de9608064d67294f8307c","templateCredsSetupCompleted":true},"name":"Blog Blitz: Blogger Edition","tags":[],"nodes":[{"id":"0662e539-26b3-41ec-b8a9-d0660dec86cd","name":"🖼️ Generate Blog Image","type":"@n8n/n8n-nodes-langchain.openAi","position":[-460,620],"parameters":{},"typeVersion":1.8},{"id":"84450a41-1377-42e5-a225-9cd96ecddbd1","name":"☁️ Upload Image to Imgur","type":"n8n-nodes-base.httpRequest","position":[-240,620],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"dccb695c-ad43-49ca-8038-4ced549890c4","name":"\t🟢 Start: Telegram Input","type":"n8n-nodes-base.telegramTrigger","position":[-820,-120],"webhookId":"69c62591-71fe-4d8e-8039-ba3e8c12b676","parameters":{},"typeVersion":1.2},{"id":"a5b36c49-f986-4157-96ca-fe109ddcc601","name":"\t📨 Notify: Title Received","type":"n8n-nodes-base.telegram","position":[-600,-120],"webhookId":"913313df-ba77-4d62-a6a7-f9ed9b00b216","parameters":{},"typeVersion":1.2},{"id":"ab40a618-b920-4a9b-bcd6-1f36ad68f9a1","name":"🔑 Get Blogger Profile","type":"n8n-nodes-base.httpRequest","position":[-380,-120],"parameters":{},"typeVersion":4.2},{"id":"11a280a5-9d8d-40e8-b6ec-b7c9b54c8ee3","name":"\t🧠 Generate Blog Metadata","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-160,-120],"parameters":{},"retryOnFail":true,"typeVersion":1.6},{"id":"9b42b432-0e53-411d-bd79-a1996f60e5cc","name":"\t📄 Extract Metadata Structure","type":"@n8n/n8n-nodes-langchain.outputParserStructured","position":[0,100],"parameters":{},"typeVersion":1.2},{"id":"887e93de-0902-4ee8-a8b8-3be11d3d3f9e","name":"🧠 AI Model: Metadata Generator","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-160,100],"parameters":{},"typeVersion":1.2},{"id":"25890b52-4833-4451-a9f8-bda9f476a38e","name":"\t✍️ Write Full Blog Content","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[220,-120],"parameters":{},"retryOnFail":true,"typeVersion":1.6},{"id":"095d7031-cb99-459c-b070-dd7908bc3fd9","name":"🧠 AI Model: Article Writer","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[220,100],"parameters":{},"typeVersion":1.2},{"id":"e1cabb9d-311f-4df9-ad2a-0803af1e201f","name":"🔗 Create Custom Blog Post URL","type":"n8n-nodes-base.code","position":[-680,620],"parameters":{},"typeVersion":2},{"id":"c987917d-c8d7-4780-a1b7-82fa571e0547","name":"🧷 Embed Image in HTML","type":"n8n-nodes-base.set","position":[-20,620],"parameters":{},"typeVersion":3.4},{"id":"9c4c580d-1447-4a5a-97ed-4928ed4fb1df","name":"\t🚀 Publish Article to Blogger","type":"n8n-nodes-base.httpRequest","position":[300,620],"parameters":{},"typeVersion":4.2,"alwaysOutputData":true},{"id":"64f51b33-e518-472d-b849-505ccf69727a","name":"\t📬 Send Blog Link to User","type":"n8n-nodes-base.telegram","position":[500,620],"webhookId":"b50ba0b0-77ca-47ae-82ae-ac6d179c50f2","parameters":{},"typeVersion":1.2},{"id":"7726e17f-c786-4974-854e-722bf7c50b53","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1340,140],"parameters":{"content":""},"typeVersion":1},{"id":"1bd39260-ae6c-4703-a489-484762102487","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-200,-420],"parameters":{"content":""},"typeVersion":1},{"id":"b7805d48-9d95-41be-bdac-28c4cf4b9780","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-520,260],"parameters":{"content":""},"typeVersion":1},{"id":"759a7e5f-1b5e-4ec6-8d20-aca26d660b10","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[200,260],"parameters":{"content":""},"typeVersion":1},{"id":"6208b35b-7721-4bf9-a49d-cfaf65d68344","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-920,-420],"parameters":{"content":""},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"05f9cbde-9689-4207-9501-f3d2cfb6d958","connections":{"🔑 Get Blogger Profile":{"main":[[{"node":"\t🧠 Generate Blog Metadata","type":"main","index":0}]]},"🧷 Embed Image in HTML":{"main":[[{"node":"\t🚀 Publish Article to Blogger","type":"main","index":0}]]},"\t🟢 Start: Telegram Input":{"main":[[{"node":"\t📨 Notify: Title Received","type":"main","index":0}]]},"🖼️ Generate Blog Image":{"main":[[{"node":"☁️ Upload Image to Imgur","type":"main","index":0}]]},"\t📨 Notify: Title Received":{"main":[[{"node":"🔑 Get Blogger Profile","type":"main","index":0}]]},"\t🧠 Generate Blog Metadata":{"main":[[{"node":"\t✍️ Write Full Blog Content","type":"main","index":0}]]},"☁️ Upload Image to Imgur":{"main":[[{"node":"🧷 Embed Image in HTML","type":"main","index":0}]]},"🧠 AI Model: Article Writer":{"ai_languageModel":[[{"node":"\t✍️ Write Full Blog Content","type":"ai_languageModel","index":0}]]},"\t✍️ Write Full Blog Content":{"main":[[{"node":"🔗 Create Custom Blog Post URL","type":"main","index":0}]]},"\t📄 Extract Metadata Structure":{"ai_outputParser":[[{"node":"\t🧠 Generate Blog Metadata","type":"ai_outputParser","index":0}]]},"\t🚀 Publish Article to Blogger":{"main":[[{"node":"\t📬 Send Blog Link to User","type":"main","index":0}]]},"🔗 Create Custom Blog Post URL":{"main":[[{"node":"🖼️ Generate Blog Image","type":"main","index":0}]]},"🧠 AI Model: Metadata Generator":{"ai_languageModel":[[{"node":"\t🧠 Generate Blog Metadata","type":"ai_languageModel","index":0}]]}}}


name: Discover Business Leads with Gemini, Brave Search and Web Scraping
author_name: Jez
author_username: jez
categories: []
created_at: 2025-06-13T02:32:46.657Z
updated_at: 2025-06-13T02:32:46.657Z
url: https://n8n.io/workflows/4910
scraped_at: 2025-07-06 21:16:30
description:
  This workflow contains community nodes that are only compatible with the self-hosted version of n8n. 

  Uncover new business leads with this AI-Powered Prospect Discovery Agent! This n8n workflow acts as a specialized intelligent assistant that, given a business type and location, uses multiple search strategies to identify a list of potential prospect companies and their websites.

  Stop manually trawling through search results! This agent automates the initial phase of lead generation by:
  Understanding your target business profile (type, location, keywords).
  Strategically using web search tools (Brave Search, Google Gemini Search) to find relevant businesses.
  Performing quick validations to confirm relevance.
  Returning a clean, structured JSON list of prospect names and their website URLs.

  How it Works:

  The workflow is built around an AI agent powered by Google Gemini. This agent is equipped with tools like:

  Brave Web Search:** For broad initial sourcing of potential business candidates.
  Google Gemini Search:** For advanced, context-aware discovery and finding businesses mentioned in various online sources.
  Brave Local Search (Selective):** For quick verification of local presence or finding website URLs for identified names.
  Jina AI Web Page Scraper (Very Selective):** For extremely rapid relevance checks on uncertain websites by scanning page content for keywords.

  The agent's system prompt guides it to use these tools efficiently to build a list of prospects without getting bogged down in deep research on any single one at this discovery stage.

  Use Cases:

  Lead Generation:** Automatically generate lists of potential clients based on industry and location.
  Market Research:** Identify key players or types of businesses in a specific geographical area.
  Sales Development:** Provide SDRs with initial lists of companies to research further.
  Called as a Sub-Workflow:** Designed to be easily integrated as a "tool" into more complex orchestrating AI agents (e.g., a BNI Pitch Planner that first needs to identify who to target).

  Setup:

  Import the workflow.
  Configure Credentials: You'll need n8n credentials for:
      Google Gemini (for the Chat model and the Gemini Search/Vertex AI Search tool).
      Brave Search (e.g., via Smithery MCP, or adapt if you have direct API access).
      Jina AI (for the web scraper).
      Assign these to the respective nodes.
  Review System Prompt: The prospect_discovery_agent node contains a detailed system prompt. You can fine-tune this to adjust its search strategies or the strictness of its matching.
  Inputs: This workflow is triggered by an "Execute Workflow Trigger" node (prospect_discovery_workflow). It expects the following inputs:
      business_type (string): e.g., "artisan bakery"
      location_query (string): e.g., "Portland, Oregon"
      desired_num_prospects (number): e.g., 5
      additional_keywords (string, optional): e.g., "organic, gluten-free"

  To Use (as a Sub-Workflow/Tool):

  This workflow is typically called by another n8n workflow (e.g., using a "Tool Workflow" node from the Langchain nodes). The calling workflow would provide the inputs listed above. The "Prospect Discovery" workflow will then execute and its final node (the prospect_discovery_agent) will output a JSON array of found prospects, like:

  [
    {
      "business_name": "Rose Petal Bakery",
      "website_url": "https://rosepetalbakerypdx.com"
    },
    {
      "business_name": "The Daily Bread Artisans",
      "website_url": "https://dailybreadpdx.com"
    }
  ]
  If no prospects are found, it returns an empty array [].

  This template provides a powerful and focused tool for automating the initial stages of prospect identification.

nodes_used:
  ["@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.toolWorkflow","@n8n/n8n-nodes-langchain.lmChatGoogleGemini"]

workflow_json:
  {"id":"tqyzrnyfFxB3x8LO","meta":{"instanceId":"3612a0c89f35a354ddd1216385240db51b4635fde7cae2a0d5004be915b832f3","templateCredsSetupCompleted":true},"name":"Prospect Discovery","tags":[],"nodes":[{"id":"dc30089e-2dea-4cba-ae74-f043240b5176","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-40,1560],"parameters":{"options":{},"modelName":"models/gemini-2.5-flash-preview-05-20"},"credentials":{"googlePalmApi":{"id":"c8jj7D6oz6RJ81qp","name":"Google Gemini Context7"}},"typeVersion":1},{"id":"27d02a47-659e-4b6a-8c5f-50253fc5be1c","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[820,1620],"parameters":{"sessionKey":"={{ $execution.id }}","sessionIdType":"customKey"},"typeVersion":1.3},{"id":"b791c4dd-bdc8-4d38-a301-ababb9ff129f","name":"brave_web_search","type":"n8n-nodes-mcp.mcpClientTool","position":[1160,1300],"parameters":{"toolName":"brave_web_search","operation":"executeTool","connectionType":"http","toolParameters":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', `Generate a JSON object with the parameters for the 'brave_web_search' tool.\nThe tool expects a JSON object with the following keys:\n- \"query\": (string, **required**) The search terms designed to find multiple examples of a business type in a given area. Examples: \"list of crane hire companies in Newcastle NSW\", \"artisan bakeries Sydney CBD reviews\", \"marketing agencies California specializing in tech startups\".\n- \"count\": (number, optional) Number of results. For prospect discovery, a higher count (e.g., 10-20) might be useful to cast a wider net.\n- \"offset\": (number, optional) For pagination if analyzing multiple pages of results.\n\nExample:\n{\"query\": \"top rated plumbing services in Bristol UK\", \"count\": 15}`, 'json') }}","descriptionType":"manual","toolDescription":"Performs a general web search using Brave Search. Primarily used to find lists, directories, articles, or multiple mentions of businesses matching a specified type and location. The goal is to identify several potential prospect company names and their websites, not just one official site. Effective for initial broad sweeps to gather candidate businesses. Parameters: 'query' (required string), 'count' (optional number, max 20), 'offset' (optional number)."},"credentials":{"mcpClientHttpApi":{"id":"izP58157WoLmqx5y","name":"smithery brave search"}},"typeVersion":1},{"id":"d33f89c7-ed40-427e-9f2c-b699194e860e","name":"brave_local_search","type":"n8n-nodes-mcp.mcpClientTool","position":[1720,1300],"parameters":{"toolName":"brave_local_search","operation":"executeTool","connectionType":"http","toolParameters":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Tool_Parameters', `Generate a JSON object with the parameters for the 'brave_local_search' tool.\nThe tool expects a JSON object with the following keys:\n- \"query\": (string, **required**) The search terms, typically a specific business name and its suspected city/area, to get a quick local listing check. Example: \"ABC Cranes Newcastle\", \"The Corner Bakery Springfield\".\n- \"count\": (number, optional) Usually 1 or a small number (e.g., 3) is sufficient, as you're checking a specific entity.\n\nExample:\n{\"query\": \"Summit Logistics, Dallas TX\", \"count\": 1}`, 'json') }}","descriptionType":"manual","toolDescription":"Searches for local business listings using Brave Local Search. In prospect discovery, this tool can be used sparingly to quickly verify if a business name found through broader searches has a local presence or to find a website URL if it's not immediately apparent from web search results. Not the primary tool for initial discovery of types, but useful for quick validation of individual potential prospects from a list. Parameters: 'query' (required string), 'count' (optional number, usually 1-3 for this purpose)."},"credentials":{"mcpClientHttpApi":{"id":"izP58157WoLmqx5y","name":"smithery brave search"}},"typeVersion":1},{"id":"d2cd00e1-bb22-4a6d-a7c5-bcf299883396","name":"jina_ai_web_page_scraper","type":"n8n-nodes-base.jinaAiTool","position":[2880,1300],"parameters":{"url":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('URL', `Provide the full URL of a potential prospect's homepage or 'About Us' page. Use this only if you need to quickly verify from the website's text if the business matches the desired type before finalizing it as a prospect. Example: 'https://potentialprospect.com/about'.`, 'string') }}","options":{"outputFormat":"markdown","enableImageCaptioning":true},"requestOptions":{},"descriptionType":"manual","toolDescription":"Extracts main textual content from a given web page URL. In prospect discovery, use this very selectively and sparingly. If a promising business website is found but it's unclear if they are the correct business type, a quick scrape of their homepage or 'About Us' page can help confirm relevance before adding them to the prospect list. Not for deep information extraction at this stage. Parameter: 'url' (required string). Critical: Use for 1-2 URLs max for quick validation if needed, due to time limits."},"credentials":{"jinaAiApi":{"id":"Ds8w0d9HhKCi6twc","name":"Jina AI account"}},"typeVersion":1},{"id":"27045509-9f22-4fd8-a753-5d5e2109caa7","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[680,-940],"parameters":{"color":7,"width":940,"height":460,"content":"## 📞 MCP Client Configuration (for Prospect Discovery Service)\n\nExternal clients can configure this agent as a tool to discover lists of potential business prospects.\n\n    **Example Client Tool Configuration (e.g., for Roo Code/Cline):**\n\n\n    \"prospect-discovery\": {\n      \"url\": \"https://SERVER/mcp/PATHTOYOURMCP/sse\",\n      \"alwaysAllow\": [\n        \"discover_prospect\"\n      ]\n    }\n\n\n*Note: The tool_name here (prospect-discovery) is how the client would refer to this entire MCP service. The alwaysAllow refers to the tool exposed by this Prospect Discovery MCP server.*"},"typeVersion":1},{"id":"4cc52e11-b88f-44ec-8411-4e6f8cdb725c","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-860,-420],"parameters":{"color":4,"width":840,"height":420,"content":"## 📡 prospect_discovery (MCP Server Trigger - Optional Endpoint)\n\n🚪 **Optional Entry Point for External Prospect Discovery Requests**\n*   **Purpose:** If this workflow is exposed as a direct MCP service, this node receives requests from external clients (e.g., other n8n workflows, applications) looking to get a list of business prospects.\n*   **Function:** Listens for HTTP POST requests formatted according to the MCP (Multi-Capability Peer) protocol.\n*   **Tool Exposed:** Would expose the `discover_prospect` tool capability (defined by the connected Tool Workflow node) to the external caller.\n*   **Typical Input:** A JSON payload from the client specifying `tool_name: \"discover_prospect\"` (or similar, matching the exposed tool) and `tool_input` containing `business_type`, `location_query`, `desired_num_prospects`, and `additional_keywords`.\n*   **Typical Output:** Parses the incoming request and passes the `tool_input` to the `discover_prospect` (Tool Workflow) node, initiating the Prospect Discovery Agent's process.\n*   **Note:** This workflow is also designed to be called as a sub-workflow directly (e.g., by the \"60s Referral Planner\"), which might be its primary use case."},"typeVersion":1},{"id":"e69f1690-e3f8-43a4-b258-a562db2d4338","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-860,60],"parameters":{"color":4,"width":840,"height":320,"content":"## ➡️ discover_prospect (Tool Workflow Node)\n\n📞 **Invokes the Prospect Discovery Agent Logic**\n*   **Purpose:** This node acts as the bridge, formally calling the `prospect_discovery_agent`'s core logic.\n*   **Triggered by:**\n    1.  The `prospect_discovery` (MCP Trigger) node, if this workflow is called as an external MCP service.\n    2.  A parent workflow (like \"60s Referral Planner\") that uses this \"Prospect Discovery\" workflow as a tool/sub-workflow.\n*   **Action:** Calls the \"Prospect Discovery\" workflow itself by triggering the `prospect_discovery_workflow` (Execute Workflow Trigger node within this same n8n workflow).\n*   **Inputs:** Receives `business_type`, `location_query`, `desired_num_prospects`, and `additional_keywords` from the calling source (either MCP Trigger or parent workflow's tool call).\n*   **Outputs:** Passes these inputs to the `prospect_discovery_workflow` (Execute Workflow Trigger). The final JSON list of prospects, compiled by the `prospect_discovery_agent`, will be the result of this tool call."},"typeVersion":1},{"id":"cebaa441-7072-42f4-abb6-52dff61d38ae","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[680,-460],"parameters":{"color":7,"width":940,"height":400,"content":"## 🗺️ Main MCP Server Workflow Overview (Prospect Discovery Service)\n\n**Agent Name:** Prospect Discovery Agent\n*   **Gateway Function (If Exposed):** This workflow *could* act as an MCP Server, making the \"Prospect Discovery Agent\" directly callable by external systems.\n*   **Trigger (If Exposed):** A dedicated `prospect_discovery_mcp_trigger` (MCP Trigger node) would receive external requests to find lists of prospects.\n*   **Tool Workflow Node (If Exposed):** A `discover_prospects_mcp_tool` (Tool Workflow node) would package the incoming request (business type, location, etc.) and invoke this agent's core logic.\n*   **Data Flow (If Exposed):** External Request -> `prospect_discovery_mcp_trigger` -> `discover_prospects_mcp_tool` -> `prospect_discovery_workflow` (Execute Workflow Trigger, starts agent logic).\n*   **Primary Design:** Note that this workflow is primarily designed as a sub-workflow. Exposing it directly as an MCP service is an optional extension."},"typeVersion":1},{"id":"44491f1b-4042-45b3-9fb7-87a96212d2c2","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1680,-1240],"parameters":{"color":3,"width":740,"height":280,"content":"## 📄 Workflow Information: Prospect Discovery Agent\n\n*   **Workflow Name:** Prospect Discovery Agent\n*   **Version:** 1.0.0\n*   **Last Updated:** 2025-06-12\n*   **👤 Author:** Jeremy Dawes, Jezweb ([www.jezweb.com.au](https://www.jezweb.com.au/))\n*   **Description:** This workflow functions as a specialized AI agent dedicated to identifying a list of potential business prospects (names and website URLs). It takes a business type, location query, and other criteria as input, uses search tools to find matching businesses, and returns a structured list. It's designed to be called as a tool by other orchestrating agents (like the \"60s Referral Planner\")."},"typeVersion":1},{"id":"4805790c-b4e7-4f37-949a-2d9a62bce598","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[2480,-80],"parameters":{"color":2,"width":740,"height":560,"content":"## ✅ TODO / Future Enhancements (Prospect Discovery Agent)\n\n*   [ ] **Improve Location Disambiguation:** Add more sophisticated logic if the `location_query` is ambiguous or very broad.\n*   [ ] **Confidence Scoring:** Could the agent assign a confidence score to each prospect found based on how well it matches the criteria?\n*   [ ] **Negative Keywords:** Allow input for negative keywords (e.g., \"find bakeries, NOT specializing in wedding cakes\").\n*   [ ] **Alternative Directory Searching:** Explicitly add a tool or logic to search specific online business directories if relevant for certain `business_type` inputs.\n*   [ ] **Batching/Pagination for Large Areas:** If a `location_query` is very large (e.g., \"all of USA\"), implement a strategy to break down the search.\n*   [ ] **Allow specifying number of results per search tool call** to better control the initial pool of candidates.\n*   [ ] **Refine criteria for using `jina_ai_web_page_scraper`:** Make the conditions for its use even more stringent in the system prompt."},"typeVersion":1},{"id":"249f9bfb-b92f-4bf5-ad59-300271da9bff","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-740,720],"parameters":{"color":4,"width":640,"height":520,"content":"## 🏁 Sub-Workflow Start: Prospect Discovery Logic\n(Node: `prospect_discovery_workflow` - Execute Workflow Trigger)\n\n🎯 **Initiates the Prospect Identification Process**\n*   **Purpose:** This is the internal entry point for the \"Prospect Discovery Agent's\" core logic. It's triggered when the `discover_prospect` tool (from the \"60s Referral Planner\" workflow) is called.\n*   **Receives:**\n    *   `business_type`: The category of business to find.\n    *   `location_query`: The geographical area for the search.\n    *   `desired_num_prospects`: How many prospects to aim for.\n    *   `additional_keywords`: Optional search refinements.\n*   **Passes Data To:** The `prospect_discovery_agent` (AI Agent) node to begin the process of identifying potential business leads."},"typeVersion":1},{"id":"89ff4b9f-d13a-4ec4-af43-77f56fd2de03","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[20,620],"parameters":{"color":4,"width":740,"height":620,"content":"## 🧠 prospect_discovery_agent (Core Logic)\n\n🔍 **The Prospect Identification Engine**\n*   **Purpose:** Processes the request to find a list of potential business prospects (names and websites) based on type, location, and other criteria, using available search tools and LLM reasoning.\n*   **Model:** `models/gemini-2.5-flash-preview-05-20` (or your chosen model, via the connected `Google Gemini Chat Model` node).\n*   **System Prompt:** Defined within this agent node. This prompt is CRITICAL and guides the AI on:\n    *   Its specific mission (finding a list of prospects).\n    *   How to interpret input parameters (`business_type`, `location_query`, etc.).\n    *   Strategic use of its tools (`brave_web_search`, `google_gemini_business_search`, selective `brave_local_search`, and very rare `jina_ai_web_page_scraper` for quick validation).\n    *   The precise JSON output format required (an array of business objects).\n*   **Tools Used (with a Prospect Discovery focus):**\n    *   `brave_web_search`: For broad sourcing of potential candidates.\n    *   `google_gemini_business_search`: For advanced and contextual discovery of multiple businesses.\n    *   `brave_local_search`: Selectively for quick URL finding for an already identified name.\n    *   `jina_ai_web_page_scraper`: VERY sparingly for rapid relevance checks on uncertain websites.\n*   **Memory Setup:** Uses `Planner Memory` (or your named `Simple Memory` node for this workflow) to retain short-term context for the LLM during its multi-step search process.\n*   **Input:** Receives `business_type`, `location_query`, `desired_num_prospects`, and `additional_keywords` from the `prospect_discovery_workflow` trigger.\n*   **Output:** A JSON array of prospect objects, each containing `business_name` and `website_url`. This output becomes the result of the `discover_prospect` tool call in the parent workflow."},"typeVersion":1},{"id":"b73ca6ea-094f-487f-ab64-4a9c08d8d6d5","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[260,1660],"parameters":{"color":6,"width":620,"height":340,"content":"## 💾 Agent Memory (Planner Memory / Simple Memory)\n\n🧠 **Short-Term Recall for Prospect Search**\n*   **Purpose:** Provides conversational memory to the `prospect_discovery_agent`, allowing it to remember previous tool calls and results within a single execution of its task (e.g., remembering businesses already found to avoid duplicates, or recalling search strategies that were or weren't effective).\n*   **Type:** Window Buffer Memory (keeps a limited history of interactions for the current discovery task).\n*   **Session Key:** `={{ $execution.id }}` (Ensures memory is unique to each specific prospect discovery request).\n*   **Importance:** Helps the agent conduct a more coherent multi-step search process to build its list of prospects."},"typeVersion":1},{"id":"923fa510-9f62-4295-a604-72d02406d01a","name":"Sticky Note9","type":"n8n-nodes-base.stickyNote","position":[960,720],"parameters":{"color":5,"width":460,"height":620,"content":"## 🛠️ Tool: brave_web_search (Prospect Discovery Context)\n\n🌐 **Broad Prospect Sourcing & List Generation**\n*   **Connection:** Uses `smithery brave search` credential.\n*   **Purpose for Prospect Discovery:** Performs general web searches to identify multiple potential businesses matching a given type, location, and keywords. Used to find directories, articles listing companies, or general search results that indicate several candidate businesses.\n*   **AI Interaction (Prospect Discovery Agent):**\n    *   Agent formulates queries to cast a wide net, e.g., `\"list of [business_type] in [location_query]\"`, `\"top [business_type] [location_query] [keywords]\"`.\n    *   Agent analyzes search snippets for company names and potential website URLs.\n    *   Aims to gather a pool of initial candidates. It might use a higher `count` (e.g., 10-20) in its parameters for this tool.\n    *   Example AI-generated params: `{\"query\": \"artisan coffee roasters in Portland Oregon\", \"count\": 15}`\n*   **Output:** Search results (list of URLs, snippets) used to compile an initial list of potential prospect names and websites."},"typeVersion":1},{"id":"69d2a0c8-6535-424e-8663-7d99e225d441","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[1540,720],"parameters":{"color":5,"width":460,"height":620,"content":"## 🛠️ Tool: brave_local_search (Prospect Discovery Context - Limited Use)\n\n📍 **Quick Validation & URL Sniffing for Potential Prospects**\n*   **Connection:** Uses `smithery brave search` credential.\n*   **Purpose for Prospect Discovery:** Used very selectively. If a promising company name is found via `brave_web_search` or `google_gemini_prospect_finder` but its website isn't immediately clear, this tool can quickly check for a local listing in the target area to try and find an official website URL or confirm its local presence.\n*   **AI Interaction (Prospect Discovery Agent):**\n    *   Agent uses this for specific company names identified in earlier, broader searches.\n    *   Example: After finding \"Acme Widgets\" as a potential, agent might query `{\"query\": \"Acme Widgets [location_query]\"}` to find its website from a local result.\n    *   NOT used for the initial broad discovery of business types. Usually, `count: 1` is sufficient.\n*   **Output:** Local search results, primarily to extract a website URL or confirm the existence of a *specific, already identified* potential prospect."},"typeVersion":1},{"id":"376c605e-7453-43b4-8d86-ebc701165e0a","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[2120,720],"parameters":{"color":5,"width":460,"height":620,"content":"## 🛠️ Tool: google_gemini_prospect_finder (Prospect Discovery Context)\n\n✨ **Advanced Prospect Sourcing & Contextual Discovery**\n*   **Connection:** Uses `Gemini Credentials account` credential.\n*   **Purpose for Prospect Discovery:** Leverages Google Gemini's advanced search to identify potential businesses based on type, location, and nuanced criteria. Useful for discovering businesses mentioned in context (articles, discussions) or when broader queries are needed to identify multiple candidates. Can supplement `brave_web_search`.\n*   **AI Interaction (Prospect Discovery Agent):**\n    *   Agent uses this for queries like: `\"Find examples of [business_type] serving [location_query] with a focus on [keywords]\"`, `\"companies in [industry] in [region]\"`.\n    *   Helps identify businesses that might not appear in simple directory listings.\n    *   Agent scans results for multiple company names and their websites.\n    *   Example AI-generated params: `{\"query\": \"eco-friendly packaging suppliers in Northern Europe\"}`\n*   **Output:** Rich search results, from which the agent extracts potential business names and website URLs for the prospect list."},"typeVersion":1},{"id":"38df04af-6a16-48b9-b028-3025c74131f5","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[2700,720],"parameters":{"color":5,"width":460,"height":620,"content":"## 🛠️ Tool: jina_ai_web_page_scraper (Prospect Discovery Context - VERY Limited Use)\n\n📄 **Rapid Relevance Check for Uncertain Prospects**\n*   **Connection:** Uses `Jina AI account` credential.\n*   **Purpose for Prospect Discovery:** Used EXTREMELY SPARINGLY and only as a final check. If a website is found for a potential prospect, but it's highly unclear from the URL or search snippet if they truly match the `business_type`, this tool can scrape the homepage or \"About Us\" page. The agent then quickly scans the text for keywords to confirm relevance before adding to the final prospect list.\n*   **AI Interaction (Prospect Discovery Agent):**\n    *   Agent provides URL of a single, uncertain prospect's page (e.g., homepage or about page).\n    *   Agent instructs itself (via its system prompt) to look for specific keywords related to `business_type` in the scraped text.\n    *   **NOT for detailed information extraction or profiling at this stage.** Goal is quick go/no-go relevance validation.\n    *   Example AI-generated params: `{\"url\": \"https://ambiguouscompany.com/about\"}`\n*   **Output:** Markdown content of the scraped page. **CRITICAL: Use for 1-2 URLs MAX per run for quick validation only due to time limits and the discovery phase's need for speed.**"},"typeVersion":1},{"id":"6c8a16f5-cb1d-46f3-8a75-688914e3a6c5","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[1680,-900],"parameters":{"color":2,"width":740,"height":500,"content":"## 💡 n8n AI Agent as a Specialized Sub-Workflow (Prospect Discovery Pattern)\n\n**This workflow implements a specialized n8n AI Agent designed to be called as a tool or sub-workflow by another parent agent.**\n*   **What this \"Agent Logic\" part does:** Implements the core intelligence for discovering potential business prospects. It receives criteria (business type, location, etc.), uses its LLM (`Google Gemini Chat Model`) and a suite of search tools (`brave_web_search`, `google_gemini_business_search`, and very selectively `brave_local_search`, `jina_ai_web_page_scraper`) to identify a list of businesses, and then formats this list as a structured JSON output.\n*   **How it works internally:** The `prospect_discovery_agent` node orchestrates tool calls based on its system prompt and the input criteria. Its primary goal is to generate a list of relevant business names and websites, not deep profiles.\n*   **Why this pattern is useful:**\n    1.  **Modularity & Specialization:** Complex tasks (like broad prospect discovery vs. specific business lookup) are broken down into specialized agents, making each agent simpler and more effective at its specific job.\n    2.  **Reusability:** This Prospect Discovery agent could potentially be called by other workflows in the future that need to identify types of businesses.\n    3.  **Clarity:** Separating discovery logic from detailed research logic keeps each workflow cleaner."},"typeVersion":1},{"id":"c8cd4af9-911a-4175-ae49-98b27c1f1558","name":"Sticky Note14","type":"n8n-nodes-base.stickyNote","position":[1680,-360],"parameters":{"color":2,"width":740,"height":460,"content":"## 🔑 External Service Credentials (Prospect Discovery Agent Logic)\n\nList of credentials used by tools within this Prospect Discovery agent:\n\n1.  **Tool Nodes:** `brave_web_search`, `brave_local_search` (selective use)\n    *   **n8n Credential Name:** `smithery brave search`\n    *   **Target Service (Example):** Smithery MCP for Brave Search\n2.  **Tool Node:** `Google Gemini Chat Model` (LLM for the `prospect_discovery_agent`)\n    *   **n8n Credential Name:** `Google Gemini Context7` (or your specific Gemini credential)\n    *   **Target Service:** Google AI (Generative Language API)\n3.  **Tool Node:** `google_gemini_business_search`\n    *   **n8n Credential Name:** `Gemini Credentials account` (or your specific Gemini credential for search)\n    *   **Target Service:** Google AI (Gemini Search API / Vertex AI Search)\n4.  **Tool Node:** `jina_ai_web_page_scraper` (very selective use for relevance check)\n    *   **n8n Credential Name:** `Jina AI account`\n    *   **Target Service:** Jina AI API"},"typeVersion":1},{"id":"31a06a5a-c805-48c0-889a-e72a4192b341","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[-720,1600],"parameters":{"color":6,"width":740,"height":260,"content":"## ⚙️ Key LLM & Agent Settings (Prospect Discovery Logic Area)\n\n*   **LLM Model:** `models/gemini-2.5-flash-preview-05-20` (Configured in the `Google Gemini Chat Model` node connected to the `prospect_discovery_agent`).\n*   **System Prompt Location:** Crucially defined within the `prospect_discovery_agent` node, in the \"Options\" -> \"System Message\" parameter. This prompt dictates the agent's specialized behavior for finding lists of prospects.\n*   **Memory Type/Key:** Window Buffer Memory (using the `Planner Memory` or your named `Simple Memory` node for this workflow), with the Session Key typically set to `={{ $execution.id }}` to ensure memory is isolated for each run of the prospect discovery task."},"typeVersion":1},{"id":"d982e681-f48e-4020-9d6b-cf862f24ace7","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[2480,-900],"parameters":{"color":2,"width":740,"height":360,"content":"## 🎯 Sub-Workflow: Business Finder Core Logic (Agent Logic Area)\n\n*   **Purpose:** This section of the workflow is dedicated to understanding the user's business search request, strategically utilizing search and scraping tools, and synthesizing the findings into a comprehensive and helpful formatted response for sales prospecting.\n*   **Expected Input Details (from `business_finder_workflow` trigger, originating from the `find_business` tool call):**\n    *   `query`: (string) A natural language query describing the business to find. This can include business name, type, industry, location hints, known website, or specific information sought (e.g., \"Acme Corp New York contact details\", \"find owner of bestlocalplumber.com\", \"tech startups in Austin with less than 50 employees\")."},"typeVersion":1},{"id":"f23b12e0-a347-4b85-ae2c-17f50f2b2e98","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","position":[2480,-500],"parameters":{"color":2,"width":740,"height":400,"content":"## 🛠️ Troubleshooting Tips (Prospect Discovery Agent Logic)\n\n*   **Check `prospect_discovery_agent` Logs:** Examine execution logs for tool call details (especially the queries sent to search tools), LLM interactions, and any errors during the list generation.\n*   **Test Search Tools Individually:** If the agent struggles to find prospects, manually test the `brave_web_search` and `google_gemini_business_search` nodes with the types of queries the agent *should* be making to see if the underlying search services can find relevant businesses.\n*   **Review System Prompt:** Ensure the system prompt for `prospect_discovery_agent` clearly guides its search strategy, its interpretation of `business_type` and `location_query`, and its use of tools for list generation (not deep dives).\n*   **Input Specificity:** The quality of prospects found will heavily depend on the clarity of the `business_type` and `location_query` inputs it receives. Test with various inputs.\n*   **`jina_ai_web_page_scraper` Timeouts:** This tool should be used extremely rarely by this agent. If timeouts occur, it's likely being overused; its role here is only for quick validation of uncertain website relevance.\n*   **Output Format:** Ensure the agent is consistently returning the JSON array as specified. Issues here will break the calling workflow."},"typeVersion":1},{"id":"a7f54d15-946f-4712-94ca-97a360adc9bc","name":"Sticky Note18","type":"n8n-nodes-base.stickyNote","position":[3440,-1160],"parameters":{"color":7,"width":860,"height":1640,"content":"### n8n Community Template Submission Description (for \"Prospect Discovery\" Workflow)\n\nThis description is for the \"Prospect Discovery\" workflow itself, highlighting its specific capabilities.\n\n**Workflow Title:** AI-Powered Prospect Discovery Agent\n\n**Description:**\n\nUncover new business leads with this AI-Powered Prospect Discovery Agent! This n8n workflow acts as a specialized intelligent assistant that, given a business type and location, uses multiple search strategies to identify a list of potential prospect companies and their websites.\n\nStop manually trawling through search results! This agent automates the initial phase of lead generation by:\n*   Understanding your target business profile (type, location, keywords).\n*   Strategically using web search tools (Brave Search, Google Gemini Search) to find relevant businesses.\n*   Performing quick validations to confirm relevance.\n*   Returning a clean, structured JSON list of prospect names and their website URLs.\n\n**How it Works:**\n\nThe workflow is built around an AI agent powered by Google Gemini. This agent is equipped with tools like:\n\n*   **Brave Web Search:** For broad initial sourcing of potential business candidates.\n*   **Google Gemini Search:** For advanced, context-aware discovery and finding businesses mentioned in various online sources.\n*   **Brave Local Search (Selective):** For quick verification of local presence or finding website URLs for identified names.\n*   **Jina AI Web Page Scraper (Very Selective):** For extremely rapid relevance checks on uncertain websites by scanning page content for keywords.\n\nThe agent's system prompt guides it to use these tools efficiently to build a list of prospects without getting bogged down in deep research on any single one at this discovery stage.\n\n**Use Cases:**\n\n*   **Lead Generation:** Automatically generate lists of potential clients based on industry and location.\n*   **Market Research:** Identify key players or types of businesses in a specific geographical area.\n*   **Sales Development:** Provide SDRs with initial lists of companies to research further.\n*   **Called as a Sub-Workflow:** Designed to be easily integrated as a \"tool\" into more complex orchestrating AI agents (e.g., a BNI Pitch Planner that first needs to identify who to target).\n\n**Setup:**\n\n1.  **Import the workflow.**\n2.  **Configure Credentials:** You'll need n8n credentials for:\n    *   Google Gemini (for the Chat model and the Gemini Search/Vertex AI Search tool).\n    *   Brave Search (e.g., via Smithery MCP, or adapt if you have direct API access).\n    *   Jina AI (for the web scraper).\n    Assign these to the respective nodes.\n3.  **Review System Prompt:** The `prospect_discovery_agent` node contains a detailed system prompt. You can fine-tune this to adjust its search strategies or the strictness of its matching.\n4.  **Inputs:** This workflow is triggered by an \"Execute Workflow Trigger\" node (`prospect_discovery_workflow`). It expects the following inputs:\n    *   `business_type` (string): e.g., \"artisan bakery\"\n    *   `location_query` (string): e.g., \"Portland, Oregon\"\n    *   `desired_num_prospects` (number): e.g., 5\n    *   `additional_keywords` (string, optional): e.g., \"organic, gluten-free\"\n\n**To Use (as a Sub-Workflow/Tool):**\n\nThis workflow is typically called by another n8n workflow (e.g., using a \"Tool Workflow\" node from the Langchain nodes). The calling workflow would provide the inputs listed above. The \"Prospect Discovery\" workflow will then execute and its final node (the `prospect_discovery_agent`) will output a JSON array of found prospects, like:\n\n```json\n[\n  {\n    \"business_name\": \"Rose Petal Bakery\",\n    \"website_url\": \"https://rosepetalbakerypdx.com\"\n  },\n  {\n    \"business_name\": \"The Daily Bread Artisans\",\n    \"website_url\": \"https://dailybreadpdx.com\"\n  }\n]\n```\nIf no prospects are found, it returns an empty array `[]`.\n\nThis template provides a powerful and focused tool for automating the initial stages of prospect identification."},"typeVersion":1},{"id":"71869bea-8ed4-4aa6-a8d3-6a19be1af7e8","name":"prospect_discovery","type":"@n8n/n8n-nodes-langchain.mcpTrigger","position":[-220,-80],"webhookId":"5de5d0b6-7f58-47df-8d2c-4096f61212c8","parameters":{"path":"5de5d0b6-7f58-47df-8d2c-4096f61212c8"},"typeVersion":1},{"id":"617b4a64-691a-4850-9b2c-f38c9580869c","name":"discover_prospect","type":"@n8n/n8n-nodes-langchain.toolWorkflow","position":[-60,320],"parameters":{"workflowId":{"__rl":true,"mode":"list","value":"tqyzrnyfFxB3x8LO","cachedResultName":"Prospect Discovery"},"description":"=This tool calls the specialized \"Prospect Discovery\" AI agent to find a list of potential business prospects (names and website URLs) based on specified criteria. Use this when the user's 'Ideal Referral' input describes a TYPE of business rather than a specific company name. This tool helps identify examples of businesses that match the desired profile in a given location. The output will be a list of potential businesses that can then be further researched individually if needed.","workflowInputs":{"value":{"business_type":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('business_type', `Specify the category or type of business to search for. This should be derived from the user's 'Ideal Referral' input when it describes a general business category. Examples: \"crane hire company\", \"artisan bakery\", \"SaaS provider for HR\", \"boutique marketing agency\".`, 'string') }}","location_query":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('location_query', `Provide a description of the target geographical area for the prospect search. This should be inferred from the user's own business location (e.g., if the user is in Newcastle, search for prospects in Newcastle or surrounding areas, unless otherwise specified). Examples: \"Newcastle NSW Australia\", \"downtown San Francisco\", \"Midlands UK\", \"businesses operating primarily online globally\".`, 'string') }}","additional_keywords":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('additional_keywords', `(Optional) Include any other relevant terms or specializations mentioned by the user for their ideal referral, or that you infer might refine the search for the business type. Examples: \"specializing in commercial projects\", \"eco-friendly products\", \"B2B focus\", \"serves small businesses\". Leave empty if no specific refinements are needed beyond type and location.`, 'string') }}","desired_num_prospects":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('desired_num_prospects', `Set the target number of unique prospect examples to find. A small number (e.g., 2 or 3) is usually sufficient at this stage, as the goal is to get a few good examples that can then be used to craft a more targeted referral ask or for further specific research.`, 'string') }}"},"schema":[{"id":"business_type","type":"string","display":true,"removed":false,"required":false,"displayName":"business_type","defaultMatch":false,"canBeUsedToMatch":true},{"id":"location_query","type":"string","display":true,"removed":false,"required":false,"displayName":"location_query","defaultMatch":false,"canBeUsedToMatch":true},{"id":"desired_num_prospects","type":"string","display":true,"removed":false,"required":false,"displayName":"desired_num_prospects","defaultMatch":false,"canBeUsedToMatch":true},{"id":"additional_keywords","type":"string","display":true,"removed":false,"required":false,"displayName":"additional_keywords","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false}},"typeVersion":2.2},{"id":"2b29393a-1ffe-494c-9ab3-803da13efbc9","name":"prospect_discovery_agent","type":"@n8n/n8n-nodes-langchain.agent","position":[240,1180],"parameters":{"text":"=Based on the provided business type, location, desired number of prospects, and any additional keywords, identify a list of potential business prospects including their names and website URLs.\n\nbusiness_type: {{ $('prospect_discovery_workflow').item.json.business_type || 'Not specified' }}\nlocation_query: {{ $('prospect_discovery_workflow').item.json.location_query || 'Not specified' }}\ndesired_num_prospects: {{ Number($('prospect_discovery_workflow').item.json.desired_num_prospects) || 1 }}\nadditional_keywords: {{ $('prospect_discovery_workflow').item.json.additional_keywords || 'None' }}","options":{"systemMessage":"=You are an AI Prospecting Specialist. Your mission is to identify a specified number of potential business prospects. For EACH prospect you identify, you must gather key details including their official name, website URL, a brief description of their services, a key contact person/owner (if discoverable), and a business phone number (if discoverable). This process is guided by the `business_type`, `location_query`, `desired_num_prospects`, and optional `additional_keywords` you receive. Your final output must be a structured JSON array of these detailed prospect profiles.\n\n**Inputs You Will Receive:**\n*   `business_type`: (string) The category or type of business to search for (e.g., \"crane hire company\", \"artisan bakery\").\n*   `location_query`: (string) A description of the target geographical area (e.g., \"Newcastle NSW Australia\", \"downtown San Francisco\"). This is crucial.\n*   `desired_num_prospects`: (number) The target number of unique, well-profiled prospects.\n*   `additional_keywords`: (string, optional) Other terms to refine the search.\n\n**Your Operational Protocol:**\n\n**Phase 1: Initial Prospect Candidate Identification**\n1.  **Formulate Broad Search Queries:** Combine `business_type`, `location_query`, and `additional_keywords`. Examples: \"list of `[business_type]` in `[location_query]` `[additional_keywords]`\", \"top `[business_type]` `[location_query]`\".\n2.  **Use Search Tools for Candidate List:**\n    *   Primarily use `brave_web_search` (e.g., with `count: 10` or `15`) and/or `google_gemini_prospect_finder` for these broad queries.\n    *   **Goal:** From search result snippets and titles, extract a working list of potential company names and their website URLs. Aim for slightly more candidates than `desired_num_prospects` initially (e.g., if targeting 3, find 5-7).\n\n**Phase 2: Detailed Profiling of Selected Candidates**\nIterate through your initial list of candidates. For each candidate, attempt to build a detailed profile until you have successfully profiled up to `desired_num_prospects` businesses.\n\nFor each candidate business from Phase 1:\n1.  **Confirm Official Name & Primary Website URL:**\n    *   If not perfectly clear, use a targeted `brave_web_search` (e.g., `{\"query\": \"[Candidate Company Name from initial list] official website\"}`) or `brave_local_search` (e.g., `{\"query\": \"[Candidate Company Name from initial list] [location_query]\"}`).\n    *   If a clear official website cannot be confidently found, consider skipping this candidate for detailed profiling.\n\n2.  **Gather Key Business Details (once website is confirmed):**\n    *   **Website Content Analysis (`jina_ai_web_page_scraper`):**\n        *   **Tool Input:** `{\"url\": \"[Prospect's Confirmed Website URL]\"}`. Prioritize scraping 'About Us', 'Contact Us', or 'Services' pages if their URLs are identifiable or inferable. If not, scrape the homepage.\n        *   **Information to Extract:** A brief description of their services/business focus; contact phone numbers; general email addresses (like info@, sales@); names of owners, founders, or key management.\n        *   **Usage Note:** Be judicious. If a site is very large, focus on 1-2 key pages.\n    *   **Targeted Information Search (using `google_gemini_prospect_finder` or `brave_local_search`):**\n        *   **Tool Inputs:** Formulate precise queries.\n            *   `google_gemini_prospect_finder`: e.g., `{\"query\": \"owner of [Prospect Name]\"}` or `{\"query\": \"contact phone [Prospect Name] [location_query]\"}`. If a key person's name is found from scraping: `{\"query\": \"[Key Person Name] [Prospect Name] LinkedIn\"}`.\n            *   `brave_local_search`: e.g., `{\"query\": \"[Prospect Name] [location_query]\"}` (can yield listed phone, address).\n        *   **Goal:** Find/confirm phone numbers, identify contact persons, and verify service descriptions.\n\n3.  **Synthesize and Construct Profile for Current Prospect:**\n    *   Compile all verified information for the current prospect.\n    *   If essential details (e.g., a verifiable phone number or a clear description of services that matches the `business_type`) cannot be found after reasonable attempts, you may discard this candidate and move to the next from your initial list. Aim for quality profiles.\n\n**Phase 3: Final Output Generation**\n1.  **Format as JSON Array:** Your final output MUST be a JSON array containing one object for each successfully profiled prospect.\n    ```json\n    [\n      {\n        \"business_name\": \"Example Crane Hire Pty Ltd\",\n        \"website_url\": \"https://www.examplecrane.com.au\",\n        \"description\": \"Provides crane rental and lifting services for construction projects in Newcastle.\",\n        \"key_contact_owner\": \"John Smith (Owner/Operator)\", // Or \"Contact: Operations Manager\", or \"N/A\" if not found\n        \"phone_number\": \"02-1234-5678\", // Or \"N/A\" if not found\n        \"contact_email\": \"info@examplecrane.com.au\", // Or \"N/A\" if not found\n        \"linkedin_profile\": \"https://linkedin.com/in/johnsmithcrane\" // Or \"N/A\" if not found\n      }\n      // ... up to desired_num_prospects objects\n    ]\n    ```\n2.  **Return ONLY the JSON Array:** No introductory text, no \"Here is the list:\", just the array itself.\n3.  **Empty Array for No Valid Results:** If no prospects can be adequately profiled up to `desired_num_prospects`, return an empty array: `[]`.\n\n**Critical: Tool Input Precision:**\n*   When preparing to call ANY tool (`brave_web_search`, `google_gemini_prospect_finder`, `brave_local_search`, `jina_ai_web_page_scraper`), the JSON input you generate for that tool MUST strictly match its expected schema.\n    *   `brave_web_search`: Expects `{\"query\": \"string\", \"count\": number (optional), \"offset\": number (optional)}`.\n    *   `google_gemini_prospect_finder`: Expects `{\"query\": \"string\", \"organization\": \"string (optional)\", \"restrictUrls\": \"string (optional)\"}`.\n    *   `brave_local_search`: Expects `{\"query\": \"string\", \"count\": number (optional)}`.\n    *   `jina_ai_web_page_scraper`: Expects `{\"url\": \"string\"}`.\n*   **Always ensure all required parameters for a tool are present in your generated input, and that data types are correct (strings are quoted, numbers are not).** Mistakes here will cause schema errors.\n\n**Priorities:**\n*   **Actionable Contact Details:** For each profiled prospect, strive to find a business phone number. A key contact/owner is highly desirable.\n*   **Relevance:** Profiled businesses must genuinely match the `business_type` in the `location_query`.\n*   **Accuracy:** Verify information where possible. If a detail is uncertain or cannot be found, use \"N/A\" or a similar indicator in the output JSON."},"promptType":"define"},"typeVersion":2},{"id":"d54d6483-54bc-45b3-9a2b-05767176aa08","name":"prospect_discovery_workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-500,1180],"parameters":{"workflowInputs":{"values":[{"name":"business_type"},{"name":"location_query"},{"name":"desired_num_prospects"},{"name":"additional_keywords"}]}},"typeVersion":1.1},{"id":"4c2d5725-1e5b-4ca5-b030-6be6cb28638c","name":"google_gemini_prospect_finder","type":"n8n-nodes-gemini-search.geminiSearchToolTool","position":[2300,1300],"parameters":{"model":"gemini-2.5-flash-preview-05-20","query":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', `Formulate a search query aimed at discovering multiple businesses of a certain type within a geographical area or industry. Examples: \"Find crane hire companies operating in Newcastle, Australia\", \"List software development agencies in London focusing on fintech\", \"What are some popular artisan bakeries in San Francisco's Mission District?\".`, 'string') }}","options":{"extractSourceUrl":true},"organization":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Organization_Context', `(Optional) Provide an industry or general business type as context if not already clear in the main query. Example: 'logistics companies', 'eco-friendly retail'. Less about a specific business name here, more about the category.`, 'string') }}","restrictUrls":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Restrict_Search_to_URLs', `(Optional and use sparingly for discovery) Provide a comma-separated list of specific website URLs ONLY if you are trying to find businesses listed on a known, relevant directory (e.g., 'yellowpages.com.au', 'clutch.co'). Generally, for broad discovery, leave blank.`, 'string') }}","toolDescription":"Leverages Google's Gemini model for advanced, context-aware searching to identify potential business prospects. Use this to find lists of businesses by type and location, discover companies mentioned in relevant articles, or to perform more nuanced queries for business discovery when standard search isn't sufficient. Can help identify multiple potential leads rather than a single specific entity. Key Parameters: 'query' (string), 'organization' (can be used for industry context), 'restrictUrls' (rarely used for discovery unless searching specific directories)."},"credentials":{"geminiSearchApi":{"id":"grHOyabfaEb2A17I","name":"Gemini Credentials account"}},"typeVersion":1},{"id":"f5d70acc-c6f9-4ce9-85d0-35c3c6403725","name":"Sticky Note19","type":"n8n-nodes-base.stickyNote","position":[-1940,-780],"parameters":{"color":7,"width":940,"height":1760,"content":"![MCP Usage Example](https://www.jezweb.com.au/wp-content/uploads/2025/06/prospect-discovery-01.png#full-width)"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"fa334835-a924-4cd6-9835-73a02b7c3f02","connections":{"Simple Memory":{"ai_memory":[[{"node":"prospect_discovery_agent","type":"ai_memory","index":0}]]},"brave_web_search":{"ai_tool":[[{"node":"prospect_discovery_agent","type":"ai_tool","index":0}]]},"discover_prospect":{"ai_tool":[[{"node":"prospect_discovery","type":"ai_tool","index":0}]]},"brave_local_search":{"ai_tool":[[{"node":"prospect_discovery_agent","type":"ai_tool","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"prospect_discovery_agent","type":"ai_languageModel","index":0}]]},"jina_ai_web_page_scraper":{"ai_tool":[[{"node":"prospect_discovery_agent","type":"ai_tool","index":0}]]},"prospect_discovery_workflow":{"main":[[{"node":"prospect_discovery_agent","type":"main","index":0}]]},"google_gemini_prospect_finder":{"ai_tool":[[{"node":"prospect_discovery_agent","type":"ai_tool","index":0}]]}}}


name: Generate Summaries from Uploaded Files using OpenAI Assistants API
author_name: Sam Robertson
author_username: samrobertson
nodes_used: ["n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-06-13T03:33:27.446Z
updated_at: 2025-06-13T03:33:27.446Z
url: https://n8n.io/workflows/4911
scraped_at: 2025-07-06 21:16:30
description:
  Generate Summaries from Uploaded Files using OpenAI Assistants API

  📑 Overview  
  Upload a document (PDF, DOCX, PPTX, TXT, CSV, JSON, or Markdown) and receive an AI-generated summary containing:

  title** – 5-10 words  
  summary** – 1-2 sentences  
  bullets** – 3-5 key points  
  tags** – 3-6 short keywords  

  The workflow:

  Stores the file in OpenAI.  
  Runs an Assistant with File Search and Code Interpreter enabled.  
  Polls until the run finishes.  
  Retrieves the summary JSON.

  ✅ Prerequisites  

  OpenAI Assistant
  Create one at &lt;https://platform.openai.com/assistants&gt;
  Enable File Search and Code Interpreter
  Note: The assistant ID starts with asst_

  OpenAI API credential setup in n8n
  Go to Credentials → New → HTTP Header Auth
  Header name: Authorization
  Value: Bearer YOUR-OPENAI-API-KEY (replace YOUR-OPENAI-API-KEY with your OpenAI API secret key for your assistant, starts with sk-)
  Name it: openAIApiHeader

  🔧 Setup  

  Import the workflow JSON.  
  When n8n prompts for a credential, choose openAIApiHeader for every HTTP Request node.  
  Open Run Assistant → Body and replace  

        "assistant_id": "REPLACE_WITH_YOUR_ASSISTANT_ID"
     
     with your real ID (starts with asst_…). Save.

  🚀 How it works  

  | # | Node | Purpose |
  |---|------|---------|
  | 1 | On form submission | User uploads a file (File). |
  | 2 | Upload File | POST /v1/files (multipart) → returns file_id. |
  | 3 | Create Thread | Creates a thread and attaches the uploaded file. |
  | 4 | Run Assistant | Starts the run using your assistant_id. |
  | 5 | Poll Run Status → Wait 2 s → IF | Loops until status = completed. |
  | 6 | Fetch Summary | GET /v1/threads/{thread_id}/messages → summary JSON. |

  🖌️ Customisation ideas  

  Edit the user prompt in Create Thread to change summary length, tone, or language.  
  Add an HTTP Response node after Fetch Summary to return plaintext to the uploader.  
  Replace the polling loop with OpenAI’s forthcoming wait-for-run endpoint when available.

  No community nodes required. Works on any n8n Cloud plan (Starter, Pro, Enterprise) or self-hosted Community Edition.

workflow_json:
  {"id":"fXtw0Iqzc5X1fyPf","meta":{"instanceId":"ff48f7ccab544841a640404b50e0fa0da433887df04172f71a32d80a79b0fa7d","templateCredsSetupCompleted":true},"name":"Generate Summaries From Uploaded Files","tags":[],"nodes":[{"id":"e8d5aaf3-8ef3-4b66-8d61-1a8eedde36ca","name":"On form submission","type":"n8n-nodes-base.formTrigger","position":[140,100],"webhookId":"2c3f820b-8b84-41d8-bc1a-1e33f9bb7bfd","parameters":{"path":"2c3f820b-8b84-41d8-bc1a-1e33f9bb7bfd","options":{},"formTitle":"Upload Form","formFields":{"values":[{"fieldType":"file","fieldLabel":"File","multipleFiles":false,"requiredField":true}]}},"typeVersion":2},{"id":"d7817690-47d2-491d-8819-373bb5402daf","name":"Create Thread","type":"n8n-nodes-base.httpRequest","position":[540,100],"parameters":{"url":"https://api.openai.com/v1/threads","options":{},"requestMethod":"POST","authentication":"headerAuth","jsonParameters":true,"bodyParametersJson":"={\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": \"Summarize the attached file.\",\n      \"attachments\": [\n        {\n          \"file_id\": \"{{$node['Upload File'].json['id']}}\",\n          \"tools\": [ { \"type\": \"file_search\" } ]\n        }\n      ]\n    }\n  ]\n}","headerParametersJson":"{\n  \"OpenAI-Beta\": \"assistants=v2\"\n}"},"credentials":{"httpHeaderAuth":{"name":"openAIApiHeader"}},"typeVersion":1},{"id":"5b93297d-c354-410a-a19e-5f7e3993ba32","name":"Poll Run Status","type":"n8n-nodes-base.httpRequest","position":[140,320],"parameters":{"url":"=https://api.openai.com/v1/threads/{{$node[\"Create Thread\"].json[\"id\"]}}/runs/{{$node[\"Run Assistant\"].json[\"id\"]}}","options":{},"authentication":"headerAuth","headerParametersUi":{"parameter":[{"name":"OpenAI-Beta","value":"assistants=v2"}]}},"credentials":{"httpHeaderAuth":{"name":"openAIApiHeader"}},"typeVersion":1},{"id":"d6b28a0e-1468-4dbc-b193-7a7f5b6c7e99","name":"Is Not Complete?","type":"n8n-nodes-base.if","position":[340,320],"parameters":{"conditions":{"string":[{"value1":"={{ $node[\"Poll Run Status\"].json[\"status\"] }}","value2":"completed","operation":"notEqual"}]}},"typeVersion":1},{"id":"88db0070-35f4-4fd7-9e51-8a30bd18bc23","name":"Wait 2s","type":"n8n-nodes-base.wait","position":[540,300],"webhookId":"b4801f60-2351-4ffb-9d70-da37524204fa","parameters":{"unit":"seconds","amount":2},"typeVersion":1},{"id":"9ea51b21-08e3-4a28-b8f5-fd85758e46f9","name":"Fetch Summary","type":"n8n-nodes-base.httpRequest","position":[720,340],"parameters":{"url":"=https://api.openai.com/v1/threads/{{$node[\"Create Thread\"].json[\"id\"]}}/messages","options":{},"authentication":"headerAuth","jsonParameters":true,"headerParametersJson":"{\n  \"OpenAI-Beta\": \"assistants=v2\"\n}"},"credentials":{"httpHeaderAuth":{"name":"openAIApiHeader"}},"typeVersion":1},{"id":"14fdac82-a66a-493e-a8ed-74bdda5ea316","name":"Run Assistant","type":"n8n-nodes-base.httpRequest","position":[720,100],"parameters":{"url":"=https://api.openai.com/v1/threads/{{$node[\"Create Thread\"].json[\"id\"]}}/runs","method":"POST","options":{},"jsonBody":"{\n  \"assistant_id\": \"REPLACE_WITH_YOUR_ASSISTANT_ID\",\n  \"instructions\": \"You are an AI knowledge-base assistant.\\n\\nFor every file provided (PDF, DOCX, slides, or an audio/video transcript) return a single, valid JSON object with exactly these keys:\\n{\\n  \\\"title\\\": string,\\n  \\\"summary\\\": string,\\n  \\\"bullets\\\": string[],\\n  \\\"tags\\\": string[]\\n}\\n• Read or transcribe the entire file first.\\n• Do not add any extra keys, comments, or explanatory text.\\n• If the file is audio or video, transcribe it before summarizing.\\n• If the file type is unsupported (e.g., pure image), reply with:\\n  { \\\"error\\\": \\\"unsupported_file_type\\\" }\\n• Return **only** the JSON object—nothing else.\"\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"OpenAI-Beta","value":"assistants=v2"}]}},"credentials":{"httpHeaderAuth":{"name":"openAIApiHeader"}},"typeVersion":4.2},{"id":"fabdc95f-4bfd-41c3-8f1b-3b74ee6513fd","name":"Upload File","type":"n8n-nodes-base.httpRequest","position":[340,100],"parameters":{"url":"https://api.openai.com/v1/files","method":"POST","options":{},"sendBody":true,"contentType":"multipart-form-data","sendHeaders":true,"authentication":"genericCredentialType","bodyParameters":{"parameters":[{"name":"file","parameterType":"formBinaryData","inputDataFieldName":"File"},{"name":"purpose","value":"assistants"}]},"genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"OpenAI-Beta","value":"assistants=v2"}]}},"credentials":{"httpHeaderAuth":{"name":"openAIApiHeader"}},"typeVersion":4.2}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"a9a89fc0-37bf-43ba-bae3-97b159f84a27","connections":{"Wait 2s":{"main":[[{"node":"Poll Run Status","type":"main","index":0}]]},"Upload File":{"main":[[{"node":"Create Thread","type":"main","index":0}]]},"Create Thread":{"main":[[{"node":"Run Assistant","type":"main","index":0}]]},"Run Assistant":{"main":[[{"node":"Poll Run Status","type":"main","index":0}]]},"Poll Run Status":{"main":[[{"node":"Is Not Complete?","type":"main","index":0}]]},"Is Not Complete?":{"main":[[{"node":"Wait 2s","type":"main","index":0}],[{"node":"Fetch Summary","type":"main","index":0}]]},"On form submission":{"main":[[{"node":"Upload File","type":"main","index":0}]]}}}


name: Lead Workflow: Yelp & Trustpilot Scraping + OpenAI Analysis via BrightData
author_name: Incrementors
author_username: incrementors
categories: []
created_at: 2025-06-13T04:57:33.354Z
updated_at: 2025-06-13T04:57:33.354Z
url: https://n8n.io/workflows/4912
scraped_at: 2025-07-06 21:16:30
description:
  🛒 Lead Workflow: Yelp & Trustpilot Scraping + OpenAI Analysis via BrightData

  &gt; Description: Automated lead generation workflow that scrapes business data from Yelp and Trustpilot based on location and category, analyzes credibility, and sends personalized outreach emails using AI.

  &gt; ⚠️ Important: This template requires a self-hosted n8n instance to run.

  📋 Overview

  This workflow provides an automated lead generation solution that identifies high-quality prospects from Yelp and Trustpilot, analyzes their credibility through reviews, and sends personalized outreach emails. Perfect for digital marketing agencies, sales teams, and business development professionals.

  ✨ Key Features

  🎯 Smart Location Analysis**  
    AI breaks down cities into sub-locations for comprehensive coverage

  🛍 Yelp Integration**  
    Scrapes business details using BrightData's Yelp dataset

  ⭐ Trustpilot Verification**  
    Validates business credibility through review analysis

  📊 Data Storage**  
    Automatically saves results to Google Sheets

  🤖 AI-Powered Outreach**  
    Generates personalized emails using Claude AI

  📧 Automated Sending**  
    Sends emails directly through Gmail integration

  🔄 How It Works

  User Input: Submit location, country, and business category through a form  
  AI Location Analysis: Gemini AI identifies sub-locations within the specified area  
  Yelp Scraping: BrightData extracts business information from multiple locations  
  Data Processing: Cleans and stores business details in Google Sheets  
  Trustpilot Verification: Scrapes reviews and company details for credibility check  
  Email Generation: Claude AI creates personalized outreach messages  
  Automated Outreach: Sends emails to qualified prospects via Gmail

  📊 Data Output

  | Field         | Description                      | Example                          |
  |---------------|----------------------------------|----------------------------------|
  | Company Name  | Business name from Yelp/Trustpilot | Best Local Restaurant            |
  | Website       | Company website URL              | https://example-restaurant.com   |
  | Phone Number  | Business contact number          | (555) 123-4567                   |
  | Email         | Business email address           | demo@example.com                 |
  | Address       | Physical business location       | 123 Main St, City, State         |
  | Rating        | Overall business rating          | 4.5/5                            |
  | Categories    | Business categories/tags         | Restaurant, Italian, Fine Dining |

  🚀 Setup Instructions

  ⏱️ Estimated Setup Time: 10–15 minutes

  Prerequisites

  n8n instance (self-hosted or cloud)
  Google account with Sheets access
  BrightData account with Yelp and Trustpilot datasets
  Google Gemini API access
  Anthropic API key for Claude
  Gmail account for sending emails

  Step 1: Import the Workflow

  Copy the JSON workflow code  
  In n8n: Workflows → + Add workflow → Import from JSON  
  Paste JSON and click Import

  Step 2: Configure Google Sheets Integration

  Create two Google Sheets:  
     Yelp data: Name, Categories, Website, Address, Phone, URL, Rating  
     Trustpilot data: Company Name, Email, Phone Number, Address, Rating, Company About
  Copy Sheet IDs from URLs  
  In n8n: Credentials → + Add credential → Google Sheets OAuth2 API  
  Complete OAuth setup and test connection  
  Update all Google Sheets nodes with your Sheet IDs

  Step 3: Configure BrightData

  Set up BrightData credentials in n8n  
  Replace API token with: BRIGHT_DATA_API_KEY  
  Verify dataset access:  
     Yelp dataset: gd_lgugwl0519h1p14rwk  
     Trustpilot dataset: gd_lm5zmhwd2sni130p  
  Test connections

  Step 4: Configure AI Models

  Google Gemini (Location Analysis)**  
    Add Google Gemini API credentials  
    Configure model: models/gemini-1.5-flash

  Claude AI (Email Generation)**  
    Add Anthropic API credentials  
    Configure model: claude-sonnet-4-20250514

  Step 5: Configure Gmail Integration

  Set up Gmail OAuth2 credentials in n8n  
  Update "Send Outreach Email" node  
  Test email sending

  Step 6: Test & Activate

  Activate the workflow  
  Test with sample data:  
     Country: United States  
     Location: Dallas  
     Category: Restaurants  
  Verify data appears in Google Sheets  
  Check that emails are generated and sent

  📖 Usage Guide

  Starting a Lead Generation Campaign

  Access the form trigger URL  
  Enter your target criteria:  
     Country: Target country  
     Location: City or region  
     Category: Business type (e.g., restaurants)  
  Submit the form to start the process

  Monitoring Results

  Yelp Data Sheet:** View scraped business information  
  Trustpilot Sheet:** Review credibility data  
  Gmail Sent Items:** Track outreach emails sent

  🔧 Customization Options

  Modifying Email Templates

  Edit the "AI Generate Email Content" node to customize:

  Email tone and style  
  Services mentioned  
  Call-to-action messages  
  Branding elements

  Adjusting Data Filters

  Modify rating thresholds  
  Set minimum review counts  
  Add geographic restrictions  
  Filter by business size

  Scaling the Workflow

  Increase batch sizes  
  Add delays between requests  
  Use parallel processing  
  Add error handling

  🚨 Troubleshooting

  Common Issues & Solutions

  1. BrightData Connection Failed  
  Cause: Invalid API credentials or dataset access  
  Solution: Verify credentials and dataset permissions

  2. No Data Extracted  
  Cause: Invalid location or changed page structure  
  Solution: Verify location names and test other categories

  3. Gmail Authentication Issues  
  Cause: Expired OAuth tokens  
  Solution: Re-authenticate and check permissions

  4. AI Model Errors  
  Cause: API quota exceeded or invalid keys  
  Solution: Check usage limits and API key

  Performance Optimization

  Rate Limiting:** Add delays  
  Error Handling:** Retry failed requests  
  Data Validation:** Check for malformed data  
  Memory Management:** Process in smaller batches

  📈 Use Cases & Examples

  1. Digital Marketing Agency Lead Generation

  Goal:** Find businesses needing marketing  
  Target:** Restaurants, retail stores  
  Approach:** Focus on good-rated but low-online-presence businesses

  2. B2B Sales Prospecting

  Goal:** Find software solution clients  
  Target:** Growing businesses  
  Approach:** Focus on recent positive reviews

  3. Partnership Development

  Goal:** Find complementary businesses  
  Target:** Established businesses  
  Approach:** Focus on reputation and satisfaction scores

  ⚡ Performance & Limits

  Expected Performance

  Processing Time:** 5–10 minutes/location  
  Data Accuracy:** 90%+  
  Success Rate:** 85%+  
  Daily Capacity:** 100–500 leads

  Resource Usage

  API Calls:** ~10–20 per business  
  Storage:** Minimal (Google Sheets)  
  Execution Time:** 3–8 minutes/10 businesses  
  Network Usage:** ~5–10MB/business

  🤝 Support & Community

  Getting Help

  n8n Community Forum:** community.n8n.io  
  Docs:** docs.n8n.io  
  BrightData Support:** Via dashboard

  Contributing

  Share improvements  
  Report issues and suggestions  
  Create industry-specific variations  
  Document best practices

  &gt; 🔒 Privacy & Compliance: Ensure GDPR/CCPA compliance. Always respect robots.txt and terms of service of scraped sites.

  🎯 Ready to Generate Leads!

  This workflow provides a complete solution for automated lead generation and outreach. Customize it to fit your needs and start building your pipeline today!

  For any questions or support, please contact:  
  📧 info@incrementors.com  
  or fill out this form: Contact Us

nodes_used:
  ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatAnthropic","@n8n/n8n-nodes-langchain.lmChatGoogleGemini"]

workflow_json:
  {"id":"bCzsdWA9ELzYNPUy","meta":{"instanceId":"bc8ca75c203589705ae2e446cad7181d6f2a7cc1766f958ef9f34810e53b8cb2","templateCredsSetupCompleted":true},"name":"Lead Workflow: Yelp & Trustpilot Scraping + OpenAI Analysis via BrightData","tags":[],"nodes":[{"id":"607d9645-e0ef-47a3-985d-15b50ffc522a","name":"Form Trigger - Get User Input","type":"n8n-nodes-base.formTrigger","position":[-640,-3320],"webhookId":"37d0e84c-0cda-47f8-826d-9ae5b22ba1d5","parameters":{"options":{},"formTitle":"YelpDataScraper","formFields":{"values":[{"fieldLabel":"country"},{"fieldLabel":"category "},{"fieldLabel":"location"}]}},"typeVersion":2.2},{"id":"80bd12f9-5fd0-4255-9834-d80838dfcba2","name":"AI Location Analyzer","type":"@n8n/n8n-nodes-langchain.agent","position":[-340,-3460],"parameters":{"text":"=You are an intelligent assistant helping to guide in location like i will give me some details like country location and business category so what you have to do give me some location names based in location (city).\n\nhere are some details:\n- Country: {{ $json.country }}\n- Location: {{ $json.location }}\n- Category: {{ $json['category '] }}\n\nnow analyse this city and find some sub placeces in this city and give me their name commas seperated for example we have a city Fort Worth so in Fort Worth there are many famous location or areas so you have to give some location and area name in this city.\n\n- ouput should be comma seperated.\n- do not include intro outro supporting text.\n- dont use special characters like $,*,# and more.","options":{},"promptType":"define"},"typeVersion":2},{"id":"7b6d4d3d-a76e-4b2f-8e75-d4a68da0b572","name":"Split Sub-locations","type":"n8n-nodes-base.code","position":[160,-3520],"parameters":{"jsCode":"// Get the input data\nconst category = $('Form Trigger - Get User Input').first().json['category '];\nconst country = $('Form Trigger - Get User Input').first().json.country;\nconst aiOutput = $input.first().json.output;\n\n// Clean and split the AI output to get individual locations\nconst locationsString = aiOutput.replace(/[{}]/g, '').trim(); // Remove curly braces\nconst locations = locationsString\n  .split(',')\n  .map(location => location.trim())\n  .filter(location => location.length > 0); // Remove empty strings\n\n// Create output array with each location as a separate item\nconst output = locations.map((location, index) => {\n  return {\n    id: index + 1,\n    category: category,\n    country: country,\n    location: location\n  };\n});\n\n// Return the transformed data\nreturn output;"},"typeVersion":2},{"id":"a82eeee9-66df-45ce-8604-4685bab3a67f","name":"Loop Yelp Locations","type":"n8n-nodes-base.splitInBatches","position":[460,-3520],"parameters":{"options":{}},"typeVersion":3},{"id":"304e8b0e-6c0d-48aa-b67a-2f37dd5a2c49","name":"Yelp Scraper","type":"n8n-nodes-base.httpRequest","position":[560,-3360],"parameters":{"url":"https://api.brightdata.com/datasets/v3/trigger","method":"POST","options":{},"jsonBody":"={\n  \"input\": [\n    {\n      \"country\": \"{{ $json.country }}\",\n      \"location\": \"{{ $json.location }}\",\n      \"category\": \"{{ $json.category }}\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"name\",\n    \"overall_rating\",\n    \"reviews_count\",\n    \"categories\",\n    \"website\",\n    \"phone_number\",\n    \"address\",\n    \"url\"\n  ]\n}\n","sendBody":true,"sendQuery":true,"sendHeaders":true,"specifyBody":"json","queryParameters":{"parameters":[{"name":"dataset_id","value":"gd_lgugwl0519h1p14rwk"},{"name":"include_errors","value":"true"},{"name":"type","value":"discover_new"},{"name":"discover_by","value":"search_filters"},{"name":"limit_per_input","value":"10"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"2afb35ee-9881-4bff-9267-eb754203e232","name":"Check Yelp Scrape Progress","type":"n8n-nodes-base.httpRequest","position":[760,-3360],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}","options":{},"sendHeaders":true,"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2,"alwaysOutputData":true},{"id":"892f2e2e-9171-4c87-99e3-468c4621ee28","name":"Wait (1 min) Yelp Completion","type":"n8n-nodes-base.wait","position":[960,-3360],"webhookId":"10b45556-5e91-4387-abd0-f9078b220286","parameters":{"unit":"minutes","amount":1},"typeVersion":1.1},{"id":"a2deac3d-eb34-49bd-9c1b-f940ec59887b","name":"Verify Yelp Ready","type":"n8n-nodes-base.if","position":[1200,-3360],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"35ed620d-b5d5-4e97-bcc5-52b283d85616","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"ready"}]}},"typeVersion":2.2},{"id":"3557f70e-29e6-4655-919a-997b9b905450","name":"If Yelp Has Records","type":"n8n-nodes-base.if","position":[1420,-3380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"80b55138-4007-47ce-9e4a-bf001c875047","operator":{"type":"number","operation":"notEquals"},"leftValue":"={{ $json.records }}","rightValue":0}]}},"typeVersion":2.2},{"id":"53b7ba95-719c-4161-a8c2-ccd45aaa9768","name":"Fetch Yelp Results","type":"n8n-nodes-base.httpRequest","position":[1660,-3400],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"format","value":"json"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"430f7f49-c0b8-4e0e-b217-d5b5831062e0","name":"Save Yelp Data to Sheet","type":"n8n-nodes-base.googleSheets","position":[1820,-3260],"parameters":{"columns":{"value":{"URL":"={{ $json.url }}","name":"={{ $json.name }}","address":"={{ $json.address }}","Phone No":"={{ $json.phone_number }}","categories":"={{ $json.categories }}","overall_rating":"={{ $json.name }}","Company Website":"={{ $json.website }}"},"schema":[{"id":"overall_rating","type":"string","display":true,"required":false,"displayName":"overall_rating","defaultMatch":false,"canBeUsedToMatch":true},{"id":"URL","type":"string","display":true,"required":false,"displayName":"URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"name","type":"string","display":true,"required":false,"displayName":"name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"categories","type":"string","display":true,"required":false,"displayName":"categories","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Phone No","type":"string","display":true,"required":false,"displayName":"Phone No","defaultMatch":false,"canBeUsedToMatch":true},{"id":"address","type":"string","display":true,"required":false,"displayName":"address","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Company Website","type":"string","display":true,"required":false,"displayName":"Company Website","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1hJD3mDpa93IvPrnvo29FFfqQWEAjGHA_wGG5hfIlqlk","cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk","cachedResultName":"Lead Generator Finder"}},"credentials":{"googleSheetsOAuth2Api":{"id":"3GynTMfjoyPl1MTl","name":"Google Sheets-Aksh"}},"typeVersion":4.6},{"id":"70d7b107-8722-4269-8aaa-40c1c2f01ad6","name":"Clean Unique Websites","type":"n8n-nodes-base.code","position":[1760,-3540],"parameters":{"jsCode":"// Set to collect unique non-empty websites\nconst websites = new Set();\n\nfor (const item of items) {\n  const website = item.json[\"Company Website\"];\n  if (website && website.toString().trim() !== \"\") {\n    websites.add(website.toString().trim());\n  }\n}\n\n// Return one item per website\nreturn Array.from(websites).map(site => {\n  return {\n    json: {\n      website: site\n    }\n  };\n});\n"},"typeVersion":2,"alwaysOutputData":true},{"id":"1fa4c014-2c1b-4d9a-978f-cf16423fc88d","name":"Read Yelp Sheet Websites","type":"n8n-nodes-base.googleSheets","position":[2020,-3540],"parameters":{"options":{},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=0","cachedResultName":"Sheet1"},"documentId":{"__rl":true,"mode":"list","value":"1hJD3mDpa93IvPrnvo29FFfqQWEAjGHA_wGG5hfIlqlk","cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk","cachedResultName":"Lead Generator Finder"}},"credentials":{"googleSheetsOAuth2Api":{"id":"3GynTMfjoyPl1MTl","name":"Google Sheets-Aksh"}},"typeVersion":4.6,"alwaysOutputData":true},{"id":"092a5d61-79a4-4a73-8633-05d2a6482efc","name":"Make Trustpilot URLs","type":"n8n-nodes-base.code","position":[2200,-3540],"parameters":{"jsCode":"return items.map(item => {\n  const rawUrl = item.json[\"Company Website\"] || \"\";\n  const cleanDomain = rawUrl.replace(/^https?:\\/\\//, \"\").replace(/\\/$/, \"\");\n  const trustpilotUrl = `https://www.trustpilot.com/review/${cleanDomain}`;\n\n  return {\n    json: {\n      \"Trustpilot Website URL\": trustpilotUrl\n    }\n  };\n});\n"},"typeVersion":2},{"id":"6116588d-cb2c-4bc4-af6c-1a0b400f9cc4","name":"Remove Duplicate TP URLs","type":"n8n-nodes-base.code","position":[2440,-3180],"parameters":{"jsCode":"const seen = new Set();\nconst output = [];\n\nfor (const item of items) {\n  const url = item.json[\"Trustpilot Website URL\"];\n  \n  if (!seen.has(url)) {\n    seen.add(url);\n    output.push({ json: { \"Trustpilot Website URL\": url } });\n  }\n}\n\nreturn output;\n"},"typeVersion":2},{"id":"c0e0112a-d61a-4241-adaa-08844c77f3bc","name":"Loop Trustpilot URLs","type":"n8n-nodes-base.splitInBatches","position":[-420,-2740],"parameters":{"options":{}},"typeVersion":3},{"id":"1260b1be-baf0-4d4c-bde2-5a0479704730","name":"Trigger Trustpilot Scraper","type":"n8n-nodes-base.httpRequest","position":[-60,-2940],"parameters":{"url":"https://api.brightdata.com/datasets/v3/trigger","method":"POST","options":{},"jsonBody":"={\n  \"input\": [\n    {\n      \"url\": \"{{ $json[\"Trustpilot Website URL\"] }}\",\n      \"date_posted\": \"\"\n    }\n  ],\n  \"custom_output_fields\": [\n    \"company_name\",\n    \"review_id\",\n    \"review_date\",\n    \"review_rating\",\n    \"review_title\",\n    \"review_content\",\n    \"is_verified_review\",\n    \"review_date_of_experience\",\n    \"reviewer_location\",\n    \"reviews_posted_overall\",\n    \"review_replies\",\n    \"review_useful_count\",\n    \"reviewer_name\",\n    \"company_logo\",\n    \"url\",\n    \"company_rating_name\",\n    \"company_overall_rating\",\n    \"is_verified_company\",\n    \"company_total_reviews\",\n    \"5_star\",\n    \"4_star\",\n    \"3_star\",\n    \"2_star\",\n    \"1_star\",\n    \"company_about\",\n    \"company_email\",\n    \"company_phone\",\n    \"company_location\",\n    \"company_country\",\n    \"breadcrumbs\",\n    \"company_category\",\n    \"company_id\",\n    \"company_website\",\n    \"company activity\",\n    \"company_other_categories\",\n    \"review_url\",\n    \"date_posted\"\n  ]\n} ","sendBody":true,"sendQuery":true,"sendHeaders":true,"specifyBody":"json","queryParameters":{"parameters":[{"name":"dataset_id","value":"gd_lm5zmhwd2sni130p"},{"name":"include_errors","value":"true"},{"name":"limit_multiple_results","value":"2"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"7cae1204-b356-42e6-80cb-8333e676cb49","name":"Check Trustpilot Scrape Progress","type":"n8n-nodes-base.httpRequest","position":[200,-2940],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/progress/{{ $json.snapshot_id }}","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"format","value":"json"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"d915bb86-bc43-4a7a-afb4-e5264b24e3a1","name":"Verify Trustpilot Scraper Ready","type":"n8n-nodes-base.if","position":[400,-2940],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"or","conditions":[{"id":"35ed620d-b5d5-4e97-bcc5-52b283d85616","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"ready"}]}},"typeVersion":2.2},{"id":"74fd5339-ef01-4aa2-9646-6ef9e65c9c31","name":"Wait (1 min) Trustpilot Completion","type":"n8n-nodes-base.wait","position":[560,-2840],"webhookId":"7047efad-de41-4608-b95c-d3e0203ef620","parameters":{"unit":"minutes","amount":1},"typeVersion":1.1},{"id":"e57b97a7-3904-453c-9fa9-a95e455a77c7","name":"If Trustpilot Has Records","type":"n8n-nodes-base.if","position":[940,-2820],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f01bd215-c406-493c-a6e4-2b8ec5686b44","operator":{"type":"number","operation":"notEquals"},"leftValue":"={{ $json.records }}","rightValue":"={{ 0 }}"}]}},"typeVersion":2.2},{"id":"40ff595d-c011-4cf8-8353-a97ecf2ecdde","name":"Download Trustpilot Data","type":"n8n-nodes-base.httpRequest","position":[1180,-2840],"parameters":{"url":"=https://api.brightdata.com/datasets/v3/snapshot/{{ $json.snapshot_id }}","options":{},"sendQuery":true,"sendHeaders":true,"queryParameters":{"parameters":[{"name":"format","value":"json"}]},"headerParameters":{"parameters":[{"name":"Authorization","value":"Bearer YOUR_TOKEN_HERE"}]}},"typeVersion":4.2},{"id":"0b535959-7c31-44c9-8d2d-4f3428f4e8dc","name":"Save Trustpilot Data to Sheet","type":"n8n-nodes-base.googleSheets","position":[1460,-2840],"parameters":{"columns":{"value":{"Email":"={{ $json.company_email }}","Rating":"={{ $json.review_rating }}","Address":"={{ $json.company_location }}","Company Name":"={{ $json.company_name }}","Phone Number":"={{ $json.company_phone }}","Company About":"={{ $json.company_about }}"},"schema":[{"id":"Email","type":"string","display":true,"removed":false,"required":false,"displayName":"Email","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Phone Number","type":"string","display":true,"required":false,"displayName":"Phone Number","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Address","type":"string","display":true,"required":false,"displayName":"Address","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Rating","type":"string","display":true,"required":false,"displayName":"Rating","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Company Name","type":"string","display":true,"removed":false,"required":false,"displayName":"Company Name","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Company About","type":"string","display":true,"removed":false,"required":false,"displayName":"Company About","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"append","sheetName":{"__rl":true,"mode":"list","value":972788573,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=972788573","cachedResultName":"Mail Scrap"},"documentId":{"__rl":true,"mode":"list","value":"1xkNBckPDGf4YR74bJQN07tAr3qlEoA-70pQc63nBqZ8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk","cachedResultName":"Job Finder sheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"3GynTMfjoyPl1MTl","name":"Google Sheets-Aksh"}},"typeVersion":4.6,"alwaysOutputData":true},{"id":"7e4768b9-0932-4b7c-bdf5-5348cbecb2eb","name":"Read Emails from Trustpilot Sheet","type":"n8n-nodes-base.googleSheets","position":[1680,-2840],"parameters":{"options":{},"filtersUI":{"values":[{"lookupValue":"=demo@example.com","lookupColumn":"Email"}]},"sheetName":{"__rl":true,"mode":"list","value":972788573,"cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit#gid=972788573","cachedResultName":"Mail Scrap"},"documentId":{"__rl":true,"mode":"list","value":"1xkNBckPDGf4YR74bJQN07tAr3qlEoA-70pQc63nBqZ8","cachedResultUrl":"https://docs.google.com/spreadsheets/d/GOOGLE_SHEET_ID_PLACEHOLDER/edit?usp=drivesdk","cachedResultName":"Job Finder sheet"}},"credentials":{"googleSheetsOAuth2Api":{"id":"3GynTMfjoyPl1MTl","name":"Google Sheets-Aksh"}},"typeVersion":4.6,"alwaysOutputData":true},{"id":"80e0f93f-5a25-40c5-9413-261781ddca4b","name":"Get Unique Emails","type":"n8n-nodes-base.code","position":[1880,-2840],"parameters":{"jsCode":"const seen = new Set();\nconst output = [];\n\nfor (const item of items) {\n  const email = item.json.Email;\n  if (!email || seen.has(email)) continue;\n\n  seen.add(email);\n\n  output.push({\n    json: {\n      email: email\n    }\n  });\n}\n\nreturn output;\n"},"typeVersion":2,"alwaysOutputData":true},{"id":"d7301840-e464-4394-ae16-c479a1508bb7","name":"AI Generate Email Content","type":"@n8n/n8n-nodes-langchain.agent","position":[2080,-2840],"parameters":{"text":"=`Write a friendly and professional outreach message from a digital marketing agency to the business\n\nThe message should offer services to help them boost their sales and services, such as SEO, ads, and website optimization.\n\nReturn the result in JSON format with:\n{\n  \"email\": \"{{ $json.email }}\"\n}`\n","options":{},"promptType":"define"},"typeVersion":2,"alwaysOutputData":true},{"id":"a1d9596c-c9cd-4111-8b78-8d101020dfa7","name":"Parse Email JSON","type":"n8n-nodes-base.code","position":[2480,-2840],"parameters":{"jsCode":"// Fix for parsing AI email output\ntry {\n    const output = $input.first().json.output;\n    \n    // Remove the ```json\\n prefix and ```\\n suffix if present\n    let cleanOutput = output;\n    if (output.startsWith('```json\\n')) {\n        cleanOutput = output.replace(/^```json\\n/, '').replace(/\\n```$/, '');\n    }\n    \n    // Parse the JSON\n    const parsed = JSON.parse(cleanOutput);\n    \n    // Return the email details as separate fields\n    return {\n        email: parsed.email || '',\n        subject: parsed.subject || '',\n        content: parsed.message || parsed.content || ''\n    };\n    \n} catch (error) {\n    // If JSON parsing fails, try to extract info using regex from the raw output\n    const output = $input.first().json.output;\n    \n    const emailMatch = output.match(/\"email\":\\s*\"([^\"]*)\"/);\n    const subjectMatch = output.match(/\"subject\":\\s*\"([^\"]*)\"/);\n    const messageMatch = output.match(/\"message\":\\s*\"([^\"]*(?:\\\\.[^\"]*)*)\"/);\n    \n    return {\n        email: emailMatch ? emailMatch[1] : '',\n        subject: subjectMatch ? subjectMatch[1] : '',\n        content: messageMatch ? messageMatch[1].replace(/\\\\n/g, '\\n').replace(/\\\\\"/g, '\"') : ''\n    };\n}"},"typeVersion":2},{"id":"38e46cfe-4fda-4b3d-9921-19a9f73848c1","name":"Send Outreach Email","type":"n8n-nodes-base.gmail","position":[2720,-2720],"webhookId":"51b5a9b3-7d26-4ea9-b507-206129cf9646","parameters":{"sendTo":"={{ $json.email }}","message":"={{ $json.content }}","options":{},"subject":"={{ $json.subject }}","emailType":"text"},"credentials":{"gmailOAuth2":{"id":"gVmVsyjENjEeeaq9","name":"Gmail - sender@example.com"}},"typeVersion":2.1},{"id":"ae6ec720-694f-43de-be99-fc9baee03622","name":"Gemini - Location AI Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-360,-3260],"parameters":{"options":{},"modelName":"models/gemini-1.5-flash"},"credentials":{"googlePalmApi":{"id":"QEE7fHoS8DGBZLp5","name":"Google Gemini(PaLM) Api account 2"}},"typeVersion":1},{"id":"4882a0ef-e8f3-4954-b7bc-5aaaf9566d11","name":"Claude - Email AI Model","type":"@n8n/n8n-nodes-langchain.lmChatAnthropic","position":[2020,-2680],"parameters":{"model":{"__rl":true,"mode":"list","value":"claude-sonnet-4-20250514","cachedResultName":"Claude 4 Sonnet"},"options":{}},"credentials":{"anthropicApi":{"id":"ipIAoB1BlqWHYhi2","name":"Anthropic account 5"}},"typeVersion":1.3},{"id":"e7cfac25-d88e-4504-aaa6-1f74ac04b819","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[200,-3920],"parameters":{"color":4,"width":340,"content":"Make a Copy of This Google Sheet.\n\n(https://docs.google.com/spreadsheets/d/1hX0MD_BLVWuEaXwOjKtwrWsjsBzc32ZtFVjP7wVGQYI/edit?usp=drive_link)"},"typeVersion":1},{"id":"c2c6abba-589f-4e26-a5fc-a563ad3ee3ef","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[0,-4200],"parameters":{"color":7,"width":880,"height":520,"content":"Optimized Workflow Summary:\nThis automation identifies high-quality leads from Yelp and Trustpilot based on a user-submitted location and business category. It uses AI to break down the area into sub-locations, scrapes business details via BrightData, checks credibility through Trustpilot reviews, and stores the best matches in Google Sheets. Finally, AI generates personalized outreach emails, which are automatically sent via Gmail — enabling fully automated lead generation and email marketing with zero manual effort."},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"a4b1073a-b560-481c-9208-535aace8da01","connections":{"Yelp Scraper":{"main":[[{"node":"Check Yelp Scrape Progress","type":"main","index":0}]]},"Parse Email JSON":{"main":[[{"node":"Send Outreach Email","type":"main","index":0}]]},"Get Unique Emails":{"main":[[{"node":"AI Generate Email Content","type":"main","index":0}]]},"Verify Yelp Ready":{"main":[[{"node":"If Yelp Has Records","type":"main","index":0}],[{"node":"Check Yelp Scrape Progress","type":"main","index":0}]]},"Fetch Yelp Results":{"main":[[{"node":"Save Yelp Data to Sheet","type":"main","index":0}]]},"If Yelp Has Records":{"main":[[{"node":"Fetch Yelp Results","type":"main","index":0}],[]]},"Loop Yelp Locations":{"main":[[{"node":"Clean Unique Websites","type":"main","index":0}],[{"node":"Yelp Scraper","type":"main","index":0}]]},"Send Outreach Email":{"main":[[{"node":"Loop Trustpilot URLs","type":"main","index":0}]]},"Split Sub-locations":{"main":[[{"node":"Loop Yelp Locations","type":"main","index":0}]]},"AI Location Analyzer":{"main":[[{"node":"Split Sub-locations","type":"main","index":0}]]},"Loop Trustpilot URLs":{"main":[[],[{"node":"Trigger Trustpilot Scraper","type":"main","index":0}]]},"Make Trustpilot URLs":{"main":[[{"node":"Remove Duplicate TP URLs","type":"main","index":0}]]},"Clean Unique Websites":{"main":[[{"node":"Read Yelp Sheet Websites","type":"main","index":0}]]},"Claude - Email AI Model":{"ai_languageModel":[[{"node":"AI Generate Email Content","type":"ai_languageModel","index":0}]]},"Save Yelp Data to Sheet":{"main":[[{"node":"Loop Yelp Locations","type":"main","index":0}]]},"Download Trustpilot Data":{"main":[[{"node":"Save Trustpilot Data to Sheet","type":"main","index":0}]]},"Read Yelp Sheet Websites":{"main":[[{"node":"Make Trustpilot URLs","type":"main","index":0}]]},"Remove Duplicate TP URLs":{"main":[[{"node":"Loop Trustpilot URLs","type":"main","index":0}]]},"AI Generate Email Content":{"main":[[{"node":"Parse Email JSON","type":"main","index":0}]]},"If Trustpilot Has Records":{"main":[[{"node":"Download Trustpilot Data","type":"main","index":0}],[{"node":"Loop Trustpilot URLs","type":"main","index":0}]]},"Check Yelp Scrape Progress":{"main":[[{"node":"Wait (1 min) Yelp Completion","type":"main","index":0}]]},"Gemini - Location AI Model":{"ai_languageModel":[[{"node":"AI Location Analyzer","type":"ai_languageModel","index":0}]]},"Trigger Trustpilot Scraper":{"main":[[{"node":"Check Trustpilot Scrape Progress","type":"main","index":0}]]},"Wait (1 min) Yelp Completion":{"main":[[{"node":"Verify Yelp Ready","type":"main","index":0}]]},"Form Trigger - Get User Input":{"main":[[{"node":"AI Location Analyzer","type":"main","index":0}]]},"Save Trustpilot Data to Sheet":{"main":[[{"node":"Read Emails from Trustpilot Sheet","type":"main","index":0}]]},"Verify Trustpilot Scraper Ready":{"main":[[{"node":"If Trustpilot Has Records","type":"main","index":0}],[{"node":"Wait (1 min) Trustpilot Completion","type":"main","index":0}]]},"Check Trustpilot Scrape Progress":{"main":[[{"node":"Verify Trustpilot Scraper Ready","type":"main","index":0}]]},"Read Emails from Trustpilot Sheet":{"main":[[{"node":"Get Unique Emails","type":"main","index":0}]]},"Wait (1 min) Trustpilot Completion":{"main":[[{"node":"Check Trustpilot Scrape Progress","type":"main","index":0}]]}}}


name: Auto-Publish PR News Articles with Featured Images to WordPress from RSS
author_name: The Higher Pitch
author_username: digvijay
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.wordpress","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-13T06:01:06.664Z
updated_at: 2025-06-13T06:01:06.664Z
url: https://n8n.io/workflows/4913
scraped_at: 2025-07-06 21:16:30
description:
  This workflow automates the process of publishing PR News articles to the WordPress website.

  🔧 How it works:

  Uses an RSS Feed Trigger to monitor new PR News articles.

  Extracts the article content and parses the featured image URL.

  Uploads the image to WordPress as a media item.

  Creates a new draft post on the WordPress site using the article's content and sets the uploaded image as the featured image.

  ✅ Features:

  Polls RSS feed every minute.

  Automatically extracts and sets featured images.

  Posts are created as drafts for editorial review.

  📝 Requirements:

  WordPress REST API access with media upload permission.

  Active WordPress credentials in n8n.

  Perfect for teams who want to streamline PR content publishing without manual effort.

workflow_json:
  {"id":"88x49jmELpXBXgy8","meta":{"instanceId":"ca7e4439d37f2d7ddaa363ea2b029357e1ee59824d58b9533ac05bf57f803d9d","templateCredsSetupCompleted":true},"name":"PR news post to Techeela Website","tags":[],"nodes":[{"id":"c762fb88-f496-4ff6-80fc-3da2047096d6","name":"RSS Feed Trigger","type":"n8n-nodes-base.rssFeedReadTrigger","position":[0,0],"parameters":{"feedUrl":"","pollTimes":{"item":[{"mode":"everyMinute"}]}},"typeVersion":1},{"id":"572e403a-ee70-46ee-ac24-45faf8fe1d98","name":"Wordpress","type":"n8n-nodes-base.wordpress","position":[440,0],"parameters":{"title":"={{ $json.title }}","additionalFields":{"format":"standard","status":"draft","content":"={{ $json.content }}","authorId":3,"categories":[1057],"postTemplate":{"values":{}}}},"credentials":{"wordpressApi":{"id":"","name":""}},"typeVersion":1},{"id":"2ff6ba75-5c55-4203-a670-f6688acf8520","name":"Code","type":"n8n-nodes-base.code","position":[220,0],"parameters":{"jsCode":"const items = $input.all();\nconst updatedItems = items.map((item) => {\n  const content = item?.json?.content;\n  const srcMatch = content.match(/src=\"(.*?)\"/);\n  item.json.imageSrc = srcMatch ? srcMatch[1] : \"\";\n  return item;\n});\nreturn updatedItems;\n"},"typeVersion":2},{"id":"1c0c60e0-0f1f-4f64-9186-5640599f62a7","name":"Upload Image to Wordpress","type":"n8n-nodes-base.httpRequest","position":[1040,0],"parameters":{"url":"https://xyz.com/wp-json/wp/v2/media","method":"POST","options":{},"sendBody":true,"contentType":"binaryData","sendHeaders":true,"authentication":"predefinedCredentialType","headerParameters":{"parameters":[{"name":"Content-Disposition","value":"=attachment; filename=\"cover-image-{{ $('Wordpress').item.json.id }}.jpeg\""}]},"inputDataFieldName":"data","nodeCredentialType":"wordpressApi"},"credentials":{"wordpressApi":{"id":"","name":"Wordpress Account"}},"typeVersion":4.2},{"id":"38326346-0f38-4491-b786-ee1e06b65f96","name":"Set Image on Wordpress Post","type":"n8n-nodes-base.httpRequest","position":[1240,0],"parameters":{"url":"=https://xyz.com/wp-json/wp/v2/posts/{{ $('Wordpress').item.json.id }}","method":"POST","options":{},"sendQuery":true,"authentication":"predefinedCredentialType","queryParameters":{"parameters":[{"name":"featured_media","value":"={{ $json.id }}"}]},"nodeCredentialType":"wordpressApi"},"credentials":{"wordpressApi":{"id":"","name":"Wordpress Account"}},"typeVersion":4.2},{"id":"45505c71-ff36-4f4c-be2c-bf705ae0a902","name":"GET Image","type":"n8n-nodes-base.httpRequest","position":[840,0],"parameters":{"url":"={{ $json['image-url'] }}","options":{}},"typeVersion":4.2},{"id":"6f1ff8bc-622d-49bb-a172-bf23b6e1baa3","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[200,-80],"parameters":{"width":1240,"height":280,"content":"## Set Image and Content In Techeela Wordpress Post"},"typeVersion":1},{"id":"8272d49e-cf24-43a0-b948-db29adf5a95f","name":"Set Image URL","type":"n8n-nodes-base.set","position":[640,0],"parameters":{"options":{},"assignments":{"assignments":[{"id":"1f0541df-05ab-4e3d-a5d8-3904579fc8a9","name":"image-url","type":"string","value":"={{ $('Code').item.json.imageSrc }}"}]}},"typeVersion":3.4},{"id":"f6685e58-6c23-495d-9b75-a8066eab8829","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-120,-80],"parameters":{"color":4,"width":280,"height":280,"content":"## Feed from PR Newswire\n"},"typeVersion":1}],"active":true,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"71481a3f-f3d0-45aa-b039-5f2cdb2e5267","connections":{"Code":{"main":[[{"node":"Wordpress","type":"main","index":0}]]},"GET Image":{"main":[[{"node":"Upload Image to Wordpress","type":"main","index":0}]]},"Wordpress":{"main":[[{"node":"Set Image URL","type":"main","index":0}]]},"Set Image URL":{"main":[[{"node":"GET Image","type":"main","index":0}]]},"RSS Feed Trigger":{"main":[[{"node":"Code","type":"main","index":0}]]},"Upload Image to Wordpress":{"main":[[{"node":"Set Image on Wordpress Post","type":"main","index":0}]]}}}


name: Transform Images with AI Prompts using FLUX Kontext, Google Sheets and Drive
author_name: Davide
author_username: n3witalia
nodes_used: ["n8n-nodes-base.googleSheets","n8n-nodes-base.httpRequest","n8n-nodes-base.googleDrive"]
categories: []
created_at: 2025-06-13T08:19:08.504Z
updated_at: 2025-06-13T08:19:08.504Z
url: https://n8n.io/workflows/4916
scraped_at: 2025-07-06 21:16:30
description:
  This workflow automates the generation of AI-enhanced, contextualized images using FLUX Kontext, based on prompts stored in a Google Sheet. The generated images are then saved to Google Drive, and their URLs are written back to the spreadsheet for easy access.

  Example

  Image:


  Prompt:
  The girl is lying on the bed and sleeping

  Result:

  Perfect for E-commerce and Social Media

  This workflow is especially useful for e-commerce businesses:

  Generate product images with dynamic backgrounds based on the use-case or season.
  Create contextual marketing visuals for ads, newsletters, or product pages.
  Scale visual content creation without the need for manual design work.

  How It Works  

  Trigger**: The workflow can be started manually (via "Test workflow") or scheduled at regular intervals (e.g., every 5 minutes) using the "Schedule Trigger" node.  
  Data Fetch**: The "Get new image" node retrieves a row from a Google Sheet where the "RESULT" column is empty. It extracts the prompt, image URL, output format, and aspect ratio for processing.  
  Image Generation**: The "Create Image" node sends a request to the FLUX Kontext API (fal.run) with the provided parameters to generate a new AI-contextualized image.  
  Status Check**: The workflow waits 60 seconds ("Wait 60 sec." node) before checking the status of the image generation request via the "Get status" node. If the status is "COMPLETED," it proceeds; otherwise, it loops back to wait.  
  Result Handling**: Once completed, the "Get Image Url" node fetches the generated image URL, which is then downloaded ("Get Image File"), uploaded to Google Drive ("Upload Image"), and the Google Sheet is updated with the result ("Update result").  

  Set Up Steps  
  To configure this workflow, follow these steps:  

  Google Sheet Setup:  
     Create a Google Sheet with columns for PROMPT, IMAGE URL, ASPECT RATIO, OUTPUT FORMAT, and RESULT (leave this empty).  
     Link the sheet in the "Get new image" and "Update result" nodes.  

  API Key Configuration:  
     Sign up at fal.ai to obtain an API key.  
     In the "Create Image" node, set the Header Auth with:  
       Name: Authorization  
       Value: Key YOURAPIKEY  

  Google Drive Setup:  
     Specify the target folder ID in the "Upload Image" node where generated images will be saved.  

  Schedule Trigger (Optional):  
     Adjust the "Schedule Trigger" node to run the workflow at desired intervals (e.g., every 5 minutes).  

  Test Execution:  
     Run the workflow manually via the "Test workflow" node to verify all steps function correctly.  

  Once configured, the workflow will automatically process pending prompts, generate images, and update the Google Sheet with results.

  Need help customizing?  
  Contact me for consulting and support or add me on Linkedin. 

workflow_json:
  {"id":"IctMuVMXlEownJe1","meta":{"instanceId":"a4bfc93e975ca233ac45ed7c9227d84cf5a2329310525917adaf3312e10d5462","templateCredsSetupCompleted":true},"name":"Generate AI Contextualize Images with FLUX Kontext","tags":[],"nodes":[{"id":"b0f612bd-9665-4607-81fd-5b6fbd9cb562","name":"When clicking ‘Test workflow’","type":"n8n-nodes-base.manualTrigger","position":[-140,660],"parameters":{},"typeVersion":1},{"id":"8f02f950-7ea3-4dfe-be9e-989f675080e0","name":"Get status","type":"n8n-nodes-base.httpRequest","position":[800,660],"parameters":{"url":"=https://queue.fal.run/fal-ai/flux-pro/requests/{{ $('Create Image').item.json.request_id }}/status ","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"daOZafXpRXLtoLUV","name":"Fal.run API"}},"typeVersion":4.2},{"id":"ec42f3a9-f489-4dcd-b606-e5dee097eea9","name":"Wait 60 sec.","type":"n8n-nodes-base.wait","position":[580,660],"webhookId":"8d37a81d-c373-479f-9cc6-42598c4f37e5","parameters":{"amount":60},"typeVersion":1.1},{"id":"8c927df4-9f70-4e91-940c-9c3a08394a8b","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-140,520],"parameters":{"rule":{"interval":[{"field":"minutes"}]}},"typeVersion":1.2},{"id":"19b6b133-842d-49e6-9fe4-3acb2afeac78","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-220,-500],"parameters":{"color":3,"width":740,"height":320,"content":"# Generate AI Contextualize Images with FLUX Kontext\n\n## Generate AI Contextualize Images in a scenario with FLUX Kontext and Save to Google Drive\n\nThis workflow automates the generation of **AI-enhanced, contextualized images using FLUX Kontext**, based on prompts stored in a Google Sheet. The generated images are then s**aved to Google Drive**, and their URLs are written back to the spreadsheet for easy access.\n\n\n\n\n"},"typeVersion":1},{"id":"de86c0a1-ad6f-4037-83a1-099b52b8ed8b","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-220,-140],"parameters":{"width":740,"height":220,"content":"## STEP 1 - GOOGLE SHEET\nCreate a [Google Sheet like this](https://docs.google.com/spreadsheets/d/1N1Yg7FA4tQ8mDll5HLKqwPBuHj31AGDKwzAOg8mLQKs/edit?usp=sharing).\n\nPlease insert:\n- in the \"PROMPT\" column the accurate description of the image you want to generate\n- in the \"IMAGE_URL\" starting image\n- in the \"ASPECT RATIO\" select the aspect ratio\n- in the \"OUTPU FORMAT\" select jpeg or png"},"typeVersion":1},{"id":"74a1a103-a662-4b03-97e6-1d557731c43e","name":"Completed?","type":"n8n-nodes-base.if","position":[1020,660],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"383d112e-2cc6-4dd4-8985-f09ce0bd1781","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"COMPLETED"}]}},"typeVersion":2.2},{"id":"8410d765-7507-4b14-b64c-429cb962db0a","name":"Update result","type":"n8n-nodes-base.googleSheets","position":[820,1000],"parameters":{"columns":{"value":{"RESULT":"={{ $('Get Image Url').item.json.images[0].url }}","row_number":"={{ $('Get new image').item.json.row_number }}"},"schema":[{"id":"IMAGE URL","type":"string","display":true,"removed":false,"required":false,"displayName":"IMAGE URL","defaultMatch":false,"canBeUsedToMatch":true},{"id":"PROMPT","type":"string","display":true,"removed":false,"required":false,"displayName":"PROMPT","defaultMatch":false,"canBeUsedToMatch":true},{"id":"ASCPECT RATIO","type":"string","display":true,"removed":false,"required":false,"displayName":"ASCPECT RATIO","defaultMatch":false,"canBeUsedToMatch":true},{"id":"OUTPUT FORMAT","type":"string","display":true,"removed":false,"required":false,"displayName":"OUTPUT FORMAT","defaultMatch":false,"canBeUsedToMatch":true},{"id":"RESULT","type":"string","display":true,"removed":false,"required":false,"displayName":"RESULT","defaultMatch":false,"canBeUsedToMatch":true},{"id":"row_number","type":"string","display":true,"removed":false,"readOnly":true,"required":false,"displayName":"row_number","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":["row_number"],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"update","sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/11ebWJvwwXHgvQld9kxywKQUvIoBw6xMa0g0BuIqHDxE/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1N1Yg7FA4tQ8mDll5HLKqwPBuHj31AGDKwzAOg8mLQKs","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1N1Yg7FA4tQ8mDll5HLKqwPBuHj31AGDKwzAOg8mLQKs/edit?usp=drivesdk","cachedResultName":"Flux Kontext"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"b3087b1a-f9c9-4674-a894-0290768b0c9b","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-220,300],"parameters":{"width":740,"height":100,"content":"## STEP 4 - MAIN FLOW\nStart the workflow manually or periodically by hooking the \"Schedule Trigger\" node. It is recommended to set it at 5 minute intervals."},"typeVersion":1},{"id":"9b149100-99eb-4b6a-9335-ee4888a97c25","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-220,120],"parameters":{"width":740,"height":140,"content":"## STEP 2 - GET API KEY (YOURAPIKEY)\nCreate an account [here](https://fal.ai/) and obtain API KEY.\nIn the node \"Create Image\" set \"Header Auth\" and set:\n- Name: \"Authorization\"\n- Value: \"Key YOURAPIKEY\""},"typeVersion":1},{"id":"8a34a1a2-3f39-4cc5-9739-0cad1d811f10","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[280,600],"parameters":{"width":180,"height":200,"content":"Set API Key created in Step 2"},"typeVersion":1},{"id":"d8240bd8-f127-40a7-aa3a-29211befe2e3","name":"Get Image Url","type":"n8n-nodes-base.httpRequest","position":[100,1000],"parameters":{"url":"=https://queue.fal.run/fal-ai/flux-pro/requests/{{ $json.request_id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{"httpHeaderAuth":{"id":"daOZafXpRXLtoLUV","name":"Fal.run API"}},"typeVersion":4.2},{"id":"987ce6a8-13ac-4516-9a3a-a71fa8b513b1","name":"Upload Image","type":"n8n-nodes-base.googleDrive","position":[580,1000],"parameters":{"name":"={{ $now.format('yyyyLLddHHmmss') }}.{{ $('Get new image').item.json[\"OUTPUT FORMAT\"] }}","driveId":{"__rl":true,"mode":"list","value":"My Drive"},"options":{},"folderId":{"__rl":true,"mode":"list","value":"1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ","cachedResultUrl":"https://drive.google.com/drive/folders/1aHRwLWyrqfzoVC8HoB-YMrBvQ4tLC-NZ","cachedResultName":"Fal.run"}},"credentials":{"googleDriveOAuth2Api":{"id":"HEy5EuZkgPZVEa9w","name":"Google Drive account (n3w.it)"}},"typeVersion":3},{"id":"1d6b21c5-429e-4095-b74d-fd12ca62afca","name":"Create Image","type":"n8n-nodes-base.httpRequest","position":[320,660],"parameters":{"url":"https://queue.fal.run/fal-ai/flux-pro/kontext","method":"POST","options":{},"jsonBody":"={\n  \"prompt\": \"{{ $json.PROMPT }}\",\n  \"image_url\": \"{{ $json['IMAGE URL'] }}\",\n  \"output_format\": \"{{ $json['OUTPUT FORMAT'] }}\",\n  \"aspect_ratio\": \"{{ $json['ASCPECT RATIO'] }}\"\n}","sendBody":true,"sendHeaders":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth","headerParameters":{"parameters":[{"name":"Content-Type","value":"application/json"}]}},"credentials":{"httpHeaderAuth":{"id":"daOZafXpRXLtoLUV","name":"Fal.run API"}},"typeVersion":4.2},{"id":"c350e744-bf61-4837-bc97-8b35ff1c6755","name":"Get new image","type":"n8n-nodes-base.googleSheets","position":[80,660],"parameters":{"options":{},"filtersUI":{"values":[{"lookupColumn":"RESULT"}]},"sheetName":{"__rl":true,"mode":"list","value":"gid=0","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1N1Yg7FA4tQ8mDll5HLKqwPBuHj31AGDKwzAOg8mLQKs/edit#gid=0","cachedResultName":"Foglio1"},"documentId":{"__rl":true,"mode":"list","value":"1N1Yg7FA4tQ8mDll5HLKqwPBuHj31AGDKwzAOg8mLQKs","cachedResultUrl":"https://docs.google.com/spreadsheets/d/1N1Yg7FA4tQ8mDll5HLKqwPBuHj31AGDKwzAOg8mLQKs/edit?usp=drivesdk","cachedResultName":"Flux Kontext"}},"credentials":{"googleSheetsOAuth2Api":{"id":"JYR6a64Qecd6t8Hb","name":"Google Sheets account"}},"typeVersion":4.5},{"id":"6f5181b9-300f-4214-a19b-f0f717c9db29","name":"Get Image File","type":"n8n-nodes-base.httpRequest","position":[320,1000],"parameters":{"url":"={{ $json.images[0].url }}","options":{}},"typeVersion":4.2},{"id":"539eb1dc-e439-42ad-b313-943d1dbc1937","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[560,-500],"parameters":{"color":5,"width":360,"height":900,"content":"## Example\n\n**Image**:\n![image](https://n3wstorage.b-cdn.net/n3witalia/model.jpg)\n\n**Prompt**:\nThe girl is lying on the bed and sleeping\n\n**Result**:\n![image](https://n3wstorage.b-cdn.net/n3witalia/flux_output.jpeg)"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"0efa8e9f-21d0-45ce-b557-03620f3fc771","connections":{"Completed?":{"main":[[{"node":"Get Image Url","type":"main","index":0}],[{"node":"Wait 60 sec.","type":"main","index":0}]]},"Get status":{"main":[[{"node":"Completed?","type":"main","index":0}]]},"Create Image":{"main":[[{"node":"Wait 60 sec.","type":"main","index":0}]]},"Upload Image":{"main":[[{"node":"Update result","type":"main","index":0}]]},"Wait 60 sec.":{"main":[[{"node":"Get status","type":"main","index":0}]]},"Get Image Url":{"main":[[{"node":"Get Image File","type":"main","index":0}]]},"Get new image":{"main":[[{"node":"Create Image","type":"main","index":0}]]},"Update result":{"main":[[]]},"Get Image File":{"main":[[{"node":"Upload Image","type":"main","index":0}]]},"When clicking ‘Test workflow’":{"main":[[{"node":"Get new image","type":"main","index":0}]]}}}


name: Automatic Travel Itinerary Generation via Email with Llama AI
author_name: OneClick IT Consultancy P Limited
author_username: oneclick-it
categories: []
created_at: 2025-06-13T09:12:39.320Z
updated_at: 2025-06-13T09:12:39.320Z
url: https://n8n.io/workflows/4917
scraped_at: 2025-07-06 21:16:30
description:
  Travel Agent that Auto Response on Mail

  In this guide, we’ll break down how to set up an AI-powered auto-reply system that works while you sleep. Ready to 10X your efficiency? Let’s dive in!

  What’s the Goal?
   AI-driven auto-responses for Email.
   Instant replies to FAQs, order confirmations, and support queries.
   24/7 availability - no more “We’ll get back to you soon” delays.
   Seamless integration with existing business tools.

  By the end, you’ll have a self-running communication assistant that never takes a coffee break.

  Why Does It Matter?
  Why automate replies? Because time = money and manual typing is so 2010. Here’s why this workflow is a game changer:
   Zero Human Error: AI doesn’t get tired or make typos.
   Lightning-Fast Replies: Customers get instant answers, improving satisfaction.
   24/7 Availability: No more “Out of Office” replies.
   Focus on High-Value Work: Free your team from mundane tasks.
  Think of it as hiring a super efficient virtual assistant - minus the salary.

  How It Works
  Here’s the step by step magic behind the automation
  Step 1: Trigger the Workflow
   Detect new messages from WhatsApp, Email, or Slack.
   Use n8n’s webhook or API integration to capture incoming queries.

  Step 2: Process the Message with AI
   Send the message to an AI model (like OpenAI GPT-4 or Gemini).
   Generate a context-aware, human-like response.

  Step 3: Send the Automated Reply
   Route the AI-generated response back to the original platform.
   Ensure personalization (e.g., “Hi [Name], thanks for reaching out!”).

  Step 4: Log & Optimize
   Store interactions in a database (Airtable, Google Sheets).
   Continuously improve AI responses based on past data.

  How to use the workflow?
  Importing a workflow in n8n is a straightforward process that allows you to use pre-built or shared workflows to save time. Below is a step-by-step guide to importing a workflow in n8n, based on the official documentation and community resources.

  Steps to Import a Workflow in n8n
  1. Obtain the Workflow JSON
  Source the Workflow:**
  	Workflows are typically shared as JSON files or code snippets. You might receive them from:
  	The n8n community (e.g., n8n.io workflows page).
  	A colleague or tutorial (e.g., a .json file or copied JSON code).
  	Exported from another n8n instance (see export instructions below if needed).
  Format:** Ensure you have the workflow in JSON format, either as a file (e.g., workflow.json) or as text copied to your clipboard.

  2. Access the n8n Workflow Editor
  Log in to n8n:**
  	Open your n8n instance (via n8n Cloud or your self-hosted instance).
  	Navigate to the Workflows tab in the n8n dashboard.
  Open a New Workflow:**
  	Click Add Workflow to create a blank workflow, or open an existing workflow if you want to merge the imported workflow.

  3. Import the Workflow
  Option 1: Import via JSON Code (Clipboard):
  In the n8n editor, click the three dots (⋯) in the top-right corner to open the menu.
  Select Import from Clipboard.
  Paste the JSON code of the workflow into the provided text box.
  Click Import to load the workflow into the editor.

  Option 2: Import via JSON File:
  In the n8n editor, click the three dots (⋯) in the top-right corner.
  Select Import from File.
  Choose the .json file from your computer.
  Click Open to import the workflow.

nodes_used:
  ["n8n-nodes-base.emailSend","@n8n/n8n-nodes-langchain.chainLlm","@n8n/n8n-nodes-langchain.lmOllama"]

workflow_json:
  {"id":"UlSHcKupAZfb0FZt","meta":{"instanceId":"dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281","templateCredsSetupCompleted":true},"name":"AI Travel Agent","tags":[],"nodes":[{"id":"6f0a745d-aa01-4edd-ac2a-444de56e8c60","name":"Ollama Model","type":"@n8n/n8n-nodes-langchain.lmOllama","position":[-300,80],"parameters":{"model":"llama3.2-16000:latest","options":{}},"credentials":{"ollamaApi":{"id":"h9CEBFmYALm3FvZf","name":"Ollama account"}},"typeVersion":1},{"id":"261ba61b-5c01-4cd3-8033-41db9ad2b625","name":"Trigger From Mail (IMAP)","type":"n8n-nodes-base.emailReadImap","position":[-500,-120],"parameters":{"options":{"customEmailConfig":"[\"UNSEEN\", [\"SUBJECT\", \"itinerary\"]]"}},"credentials":{"imap":{"id":"D3nLrSlP1dHWcIDE","name":"IMAP account"}},"typeVersion":2},{"id":"750101d2-7fc0-44d7-a615-d98803669ff2","name":"Basic LLM","type":"@n8n/n8n-nodes-langchain.chainLlm","position":[-300,-120],"parameters":{"text":"={{ $json.textPlain }}","messages":{"messageValues":[{"message":"=Create a friendly, human-style travel itinerary based on the email content in {{ $json.textPlain }}. The itinerary should be casual, easy to read, and feel like it was written by a person — not a robot.\n\nInclude the following elements:\n\nA short, warm greeting at the top\n\nA one-line summary of the destination and a few top highlights mentioned in the email\n\nAlways Daily breakdowns starting with \"Day 1:\", \"Day 2:\", etc., matching the number of days specified in the email (e.g., if the email says 4 days, include only Day 1 to Day 4, with Day 4 as the departure day).This thing is important so keep it in mind.\n\nFor each day, include key activities, hotel info, flight times, and transport details — in simple language\n\nKeep the tone conversational, light, and informative — like you're helping a friend plan their trip\n\nAvoid using markdown, emojis, special characters, or extra spacing\n\n\"\"\"\"Use this exact structure, do not add any extra words, and match the number of days to the email content and highlights imp things\"\"\"\"\":\n\nHello Traveller,\n\nHere’s your itinerary for your [destination] adventure! Get ready to explore amazing places like [a few highlights based on the email].\n\nDay 1: [Arrival details, flight info, hotel check-in, maybe a light activity or dinner nearby]\nDay 2: [Activities, any planned tours, transport details if moving around]\nDay 3: [Activities, hotel name if changing, any travel between cities]\nDay 4: [Departure day – include checkout time, transport to airport, and flight info]\n\nBest regards,\nOneclick\n\n\nthis is sample mail \n\nDelhi, the vibrant capital of India! I'd be delighted to help you plan your 4-day trip to Delhi with your family.\n\nHere's a suggested itinerary that covers some of the top attractions, cultural experiences, and culinary delights:\n\n**Day 1: Red Fort, Qutub Minar, and Chandni Chowk**\n\n* Morning: Start at the Red Fort (open from 9:30 AM), a majestic Mughal fort with stunning architecture. Explore the fort's imposing walls, gardens, and palaces.\n* Afternoon: Visit Qutub Minar (open from 10:00 AM), the tallest minaret in India, built by Qutb-ud-din Aibak in 1199 AD.\n* Evening: Take a leisurely stroll through Chandni Chowk, one of Delhi's oldest and most vibrant streets, lined with street food stalls, shops, and historic landmarks.\n\n**Day 2: Humayun's Tomb, Lotus Temple, and Indian Museum**\n\n* Morning: Visit Humayun's Tomb (open from 9:30 AM), a beautiful Mughal mausoleum built by Haji Begum in 1573 AD.\n* Afternoon: Explore the Baha'i Temple (Lotus Temple) in Ashok Vihar (open from 10:00 AM), an iconic temple with stunning architecture and peaceful surroundings.\n* Evening: Head to the Indian Museum, a treasure trove of Indian history and culture, located in Central Delhi.\n\n**Day 3: Akshardham Temple, Laxmi Nagar Shopping Mall, and Chilla Village**\n\n* Morning: Visit the Akshardham Temple (open from 9:00 AM), a magnificent temple complex with intricate carvings, stunning architecture, and beautiful gardens.\n* Afternoon: Spend some time shopping at Laxmi Nagar Shopping Mall, one of Delhi's popular shopping destinations.\n* Evening: Head to Chilla Village, a small village located on the outskirts of Delhi, where you can experience rural India and enjoy a peaceful evening.\n\n**Day 4: Gandhi Smriti, India Gate, and Hauz Khas Village**\n\n* Morning: Visit Gandhi Smriti (open from 9:30 AM), the museum dedicated to Mahatma Gandhi's life and legacy.\n* Afternoon: Explore India Gate (open from 10:00 AM), a stunning war memorial built in honor of Indian soldiers who fought in World War I.\n* Evening: Head to Hauz Khas Village, a trendy neighborhood with boutique shops, cafes, and restaurants.\n\n**Additional Tips**\n\n* Be prepared for the crowds and heat during peak summer months (April to June).\n* Wear comfortable shoes, as you'll be doing a lot of walking throughout the day.\n* Try some local street food, like chaat items or kebabs, but ensure they're cooked and served hygienically.\n* Don't forget to bargain when shopping at local markets!\n* Take breaks and stay hydrated throughout the day.\n\n**Getting Around**\n\n* Use an auto-rickshaw, taxi, or ride-hailing apps (like Ola, Uber) to get around Delhi. Be prepared for traffic congestion.\n* The Metro network in Delhi is efficient and convenient, but be aware of peak hours (7:00 AM - 9:00 AM and 4:00 PM - 6:00 PM).\n\n**Budget Breakdown**\n\n* Accommodation: ₹5,000-₹10,000 (approximately $65-$130 USD) for a family of four, depending on the hotel or hostel you choose.\n* Transportation: ₹1,500-₹3,000 (approximately $20-$40 USD) for auto-rickshaws, taxis, and ride-hailing services.\n* Food: ₹2,000-₹4,000 (approximately $25-$50 USD) per day for meals at local restaurants and street food stalls.\n\nThis itinerary provides a good balance of culture, history, and fun activities that are suitable for families. Feel free to adjust it according to your interests and preferences!\n\n**Are there any specific requests or changes you'd like me to make?\n"}]},"promptType":"define"},"typeVersion":1.6},{"id":"e5e3a173-43dd-41e5-b373-97c457c70025","name":"Email Field Setup","type":"n8n-nodes-base.set","position":[100,-120],"parameters":{"options":{},"assignments":{"assignments":[{"id":"7d428c48-4809-45d8-ba1e-c96d68c02c07","name":"from","type":"string","value":"={{ $('Trigger From Mail (IMAP)').first().json.from }}"},{"id":"63b99545-3d2d-4563-b9d7-078cbc20dbcc","name":"subject","type":"string","value":"=Re: {{ $('Trigger From Mail (IMAP)').first().json.subject }}"},{"id":"11d94d3f-2170-4b54-b5f9-b85bb95ad472","name":"text","type":"string","value":"={{ $json.text }} "}]}},"typeVersion":3.4},{"id":"f42413ba-81fb-4995-ad56-21f469f7da82","name":"Sending Email","type":"n8n-nodes-base.emailSend","position":[320,-120],"webhookId":"8ddf4c83-5990-4b1c-ab0d-4cc55932d2c4","parameters":{"text":"={{ $json.text }}","options":{},"subject":"={{ $json.subject }}","toEmail":"={{ $json.from }}","fromEmail":"XYZ@gmail.com","emailFormat":"text"},"credentials":{"smtp":{"id":"3QSx1pWoS0BZcK4c","name":"SMTP account"}},"typeVersion":2.1},{"id":"9a3324e1-3fe5-4b13-924d-dcb05daf4c8d","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1000,-340],"parameters":{"width":420,"height":220,"content":"#### Configure Mail Credentials for Trigger Mail Node\nUnder Credentials, choose or create new IMAP credentials.\nUse settings as per below\n\nIMAP Settings Example:\nHost     - imap.gmail.com\nPort     - 993\nSecure   - true\nUser     - your-email@gmail.com\nPassword - App password (for Gmail, use App Password)"},"typeVersion":1},{"id":"0e562abb-7c3a-41e2-8a98-7d583dfa2c90","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1000,-100],"parameters":{"width":420,"height":220,"content":"#### Configure SMTP Settings for the Send Mail Node.\nYou need to enter SMTP details:\n\nUser     - your-email@gmail.com\nPassword - App password (for Gmail, use App Password)\nHost     - smtp.gmail.com\nPort     - 465\nSSL/TLS  - True"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"2742d28b-b293-481a-8ef2-ec0972d34fe5","connections":{"Basic LLM":{"main":[[{"node":"Email Field Setup","type":"main","index":0}]]},"Ollama Model":{"ai_languageModel":[[{"node":"Basic LLM","type":"ai_languageModel","index":0}]]},"Email Field Setup":{"main":[[{"node":"Sending Email","type":"main","index":0}]]},"Trigger From Mail (IMAP)":{"main":[[{"node":"Basic LLM","type":"main","index":0}]]}}}


name: Upload & Categorize Files with Supabase Storage and Secure URL Generation
author_name: Jan Willem Altink
author_username: jwa91
nodes_used: ["n8n-nodes-base.httpRequest"]
categories: []
created_at: 2025-06-13T09:45:59.332Z
updated_at: 2025-06-13T09:45:59.332Z
url: https://n8n.io/workflows/4920
scraped_at: 2025-07-06 21:16:30
description:
  Supabase Storage File Upload Workflow

  works with selfhosted Supabase

  ℹ️ How it works
  • Accepts file data (MIME type, filename, base64 content) from other workflows
  • Automatically routes files to appropriate storage buckets based on file type (images, audio, video, documents)
  • Uploads files to Supabase Storage using the REST API
  • Generates secure signed URLs for file access with 30-day expiration
  • Returns structured success/error responses for downstream processing

  🏗️ Set up steps
  • Configure Supabase API credentials in n8n 

  • Create storage buckets in your Supabase project (image-files, audio-files, video-files, document-files) (or choose your own structuring system)

  • Replace url paths with your own

  • Test the workflow using the included form trigger

  • Remove test form and integrate with your main workflows

  📚 Reference: Supabase Storage Documentation

workflow_json:
  {"meta":{"instanceId":"1eec3d74182f3fda9f29f20c85422320a70882840e1b07acd098d5b4a836392a","templateCredsSetupCompleted":true},"nodes":[{"id":"ece7684b-64fa-4c80-9697-c6e7a4999eeb","name":"When Executed by Another Workflow","type":"n8n-nodes-base.executeWorkflowTrigger","position":[-1420,620],"parameters":{"workflowInputs":{"values":[{"name":"mime_type"},{"name":"original_filename"},{"name":"binary_data_base64"}]}},"typeVersion":1.1},{"id":"6d600da3-a9e7-4015-bc73-a0fb5e400724","name":"Prepare Upload Data","type":"n8n-nodes-base.set","position":[-940,440],"parameters":{"options":{},"assignments":{"assignments":[{"id":"bucket-mapping","name":"bucket_name","type":"string","value":"={{ \n  (() => {\n    const mimeType = $json.mime_type || 'application/octet-stream';\n    if (mimeType.startsWith('image/')) return 'image-files';\n    if (mimeType.startsWith('audio/')) return 'audio-files';\n    if (mimeType.startsWith('video/')) return 'video-files';\n    return 'document-files';\n  })()\n}}"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"5b5b91e9-b082-4d57-a191-c0fd71c84eae","name":"Success Response","type":"n8n-nodes-base.set","position":[200,440],"parameters":{"options":{},"assignments":{"assignments":[{"id":"action-type","name":"action","type":"string","value":"s3_upload"},{"id":"success-status","name":"status","type":"string","value":"success"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"aa6355d3-5c2e-4b55-9f04-fcd1f5246428","name":"Convert to File","type":"n8n-nodes-base.convertToFile","notes":"Instead of the code note i would prefer to use the n8n dedicated note for this. only thing i am not sure of now is if i map the fields correct. ","position":[-720,440],"parameters":{"options":{"fileName":"={{ $json.original_filename }}","mimeType":"={{ $json.mime_type }}"},"operation":"toBinary","sourceProperty":"binary_data_base64"},"typeVersion":1.1},{"id":"2c1f3cf0-3726-4dd9-9121-e060e684d633","name":"temp form to test workflow","type":"n8n-nodes-base.formTrigger","position":[-1420,300],"webhookId":"1ccfd79e-c611-46e5-90c9-4f84d54ee1af","parameters":{"options":{"path":"action-workflows-testform","appendAttribution":false},"formTitle":"test workflow form","formFields":{"values":[{"fieldLabel":"original_filename","requiredField":true},{"fieldType":"textarea","fieldLabel":"binary_data_base64","requiredField":true},{"fieldLabel":"mime_type"}]},"formDescription":"use this form to test action workflows without having to use another workflow"},"typeVersion":2.2},{"id":"64932e5f-b7fc-46ad-9946-41703fec5823","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1800,-100],"parameters":{"color":4,"width":1100,"height":260,"content":"## 📦 Upload files to Supabase Storage\n\n- Link to [Supabase docs](https://supabase.com/docs/guides/storage)\n\nThis workflow shows how you could upload files to a Supabase Storage Instance. It's primarily designed to be called by other workflows, as there wasn't a default node for this yet, and this could be usefull in quite a lot of other workflows. \n\nIn this particular example we use mime-type to sort files to specific buckets, but this is of course dependent on your specific storage structure. \n\nThe output is a signed url for the object, to avoid having to share secrets for entire buckets to applications that need the object as input"},"typeVersion":1},{"id":"96202c5f-d481-4b20-a526-7ba0c79396a1","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-1800,180],"parameters":{"width":340,"height":340,"content":"## 🧪  Quick Test Form during building\n\n\nThis form allowed me to quickly check this flow without having to execute another workflow.\n\nOf course you could also pin data, but given the fact i wanted to check different filetypes i opted for this temporary form, you can populate the base64 field with base64 encoded string of testfile (using for example `base64 -i /path/to/file | pbcopy`)\n\n⚠️ Remove before putting flow live."},"typeVersion":1},{"id":"c95e5ad4-0bad-4670-814b-198f51ecb1bb","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-1800,540],"parameters":{"color":3,"width":340,"height":280,"content":"## ⚖️ Pro's and Con's of base64 encoding here\n\nI used the encoding step to be able to define input schema in this node below, it comes with a trade off though: file size of base 64 encoded files are 33% larger, also execution data is becoming quite large. \n\n⚠️Carefully consider if this is usable if you are working with large files. "},"typeVersion":1},{"id":"36278709-336e-43a7-8f66-6f7b29cdca74","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-1020,180],"parameters":{"color":5,"width":460,"height":240,"content":"## 🔧Highlevel dataprep explanation\n\n\n**Prepare Upload Data:** maps inputs to buckets based on mimetype - passes through all other inputs.\n\n**Convert to file:** converts base64 encoded files back to actual files. (see red sticky node at start)"},"typeVersion":1},{"id":"0a2490ad-78ce-4252-884d-900e9848d865","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-540,180],"parameters":{"color":6,"width":640,"height":240,"content":"## 🔑 About Supabase Storage\n\nSupabase Storage uses HTTP API with Bearer YOUR_TOKEN_HERE authentication, not traditional AWS S3 SDK protocols.\n\nIn this set up we use an anon key/service key. We dont want to use that key all the time, so we generate a signed url to the object.\n\n⚠️ Replace the url in these nodes with your own."},"typeVersion":1},{"id":"309c7e12-bcfa-4756-85e8-2d54639296a6","name":"Upload to Supabase Storage","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[-460,440],"parameters":{"url":"=https://api-sb.janwillemaltink.com/storage/v1/object/{{ $('Prepare Upload Data').item.json.bucket_name }}/{{ $('Prepare Upload Data').item.json.original_filename }}","method":"POST","options":{},"sendBody":true,"contentType":"binaryData","authentication":"predefinedCredentialType","inputDataFieldName":"data","nodeCredentialType":"supabaseApi"},"credentials":{"supabaseApi":{"id":"rpq8Z0VD0KxUEfDd","name":"Supabase account"}},"typeVersion":4.2},{"id":"ad17d932-adc3-4a93-8e02-1f52fe8a8196","name":"Generate Signed Url","type":"n8n-nodes-base.httpRequest","onError":"continueErrorOutput","position":[-220,440],"parameters":{"url":"=https://api-sb.janwillemaltink.com/storage/v1/object/sign/{{ $json.Key }}","method":"POST","options":{},"jsonBody":"{\n\t\"expiresIn\": 2592000\n}","sendBody":true,"specifyBody":"json","authentication":"predefinedCredentialType","nodeCredentialType":"supabaseApi"},"credentials":{"supabaseApi":{"id":"rpq8Z0VD0KxUEfDd","name":"Supabase account"}},"typeVersion":4.2},{"id":"9be14ebe-84f1-4d91-8c54-392fabf89c05","name":"Upload Error Response","type":"n8n-nodes-base.set","position":[-260,620],"parameters":{"options":{},"assignments":{"assignments":[{"id":"action-type-error","name":"action","type":"string","value":"supabase_upload"},{"id":"error-status","name":"status","type":"string","value":"error"}]},"includeOtherFields":true},"typeVersion":3.4},{"id":"8dbc6a1e-1a6b-4cc1-ac9f-51fe38c386b8","name":"add domain","type":"n8n-nodes-base.set","position":[-20,440],"parameters":{"options":{},"assignments":{"assignments":[{"id":"d346fd86-3905-4f89-8754-6966c9725a77","name":"full_signedURL","type":"string","value":"=https://api-sb.janwillemaltink.com/storage/v1{{ $json.signedURL }}"}]}},"typeVersion":3.4},{"id":"e21970f6-23d8-4e23-b42b-f5636dd52358","name":"Sign Error Response","type":"n8n-nodes-base.set","position":[-20,620],"parameters":{"options":{},"assignments":{"assignments":[{"id":"action-type-error","name":"action","type":"string","value":"supabase_sign"},{"id":"error-status","name":"status","type":"string","value":"error"}]},"includeOtherFields":true},"typeVersion":3.4}],"pinData":{},"connections":{"add domain":{"main":[[{"node":"Success Response","type":"main","index":0}]]},"Convert to File":{"main":[[{"node":"Upload to Supabase Storage","type":"main","index":0}]]},"Success Response":{"main":[[]]},"Generate Signed Url":{"main":[[{"node":"add domain","type":"main","index":0}],[{"node":"Sign Error Response","type":"main","index":0}]]},"Prepare Upload Data":{"main":[[{"node":"Convert to File","type":"main","index":0}]]},"Upload to Supabase Storage":{"main":[[{"node":"Generate Signed Url","type":"main","index":0}],[{"node":"Upload Error Response","type":"main","index":0}]]},"temp form to test workflow":{"main":[[{"node":"Prepare Upload Data","type":"main","index":0}]]},"When Executed by Another Workflow":{"main":[[{"node":"Prepare Upload Data","type":"main","index":0}]]}}}


name: Generate Trend-Based Video Marketing Ideas with GPT-4, Tavily and Veo 3
author_name: Automate With Marc
author_username: marconi
nodes_used: ["n8n-nodes-base.httpRequest","n8n-nodes-base.gmail","@n8n/n8n-nodes-langchain.openAi"]
categories: []
created_at: 2025-06-13T10:19:37.664Z
updated_at: 2025-06-13T10:19:37.664Z
url: https://n8n.io/workflows/4921
scraped_at: 2025-07-06 21:16:30
description:
  This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

  Automate your entire video content creation pipeline with this AI-powered, no-code workflow built in n8n.
  Watch Step-by-step video guide here: https://www.youtube.com/watch?v=x7nHpcggpX8&t=5s
   
  This template connects a suite of smart tools to help you generate scroll-stopping short video ideas based on daily trending topics and auto-deliver them via email—ready for production in Veo 3.

  🔧 How it works:
  Scheduled Trigger (Daily)
  Kicks off the process each day at your chosen time.

  Tavily Agent (Web Search)
  Searches the latest trends, viral moments, or market news based on your e-commerce brand (e.g. “Sally’s Closet”).

  OpenAI GPT-4 Agent (Creative Brainstorming)
  Generates high-conversion marketing video ideas based on your brand’s tone and what’s trending.

  Prompt Formatter for Veo 3
  Converts the idea into a cinematic-style prompt, optimized for Veo’s video generation engine (via FAL API).

  Send via Gmail
  The final Veo 3 prompt is emailed to you or your creative team for immediate use or manual refinement.

  Watch full step-by-step Tutorial Build Video: https://youtu.be/x7nHpcggpX8

  🧠 Use Cases:
  E-commerce brands that need fresh daily content

  Marketing teams looking to automate creative ideation

  Solopreneurs building a lean video production engine

  Anyone experimenting with Veo 3 prompt-based storytelling

  🛠️ Tools used:
  n8n Scheduled Trigger

  Tavily Node (for real-time web search)

  Langchain Agent (GPT-4 via OpenAI)

  FAL API (Veo 3 prompt delivery)

  Gmail Node (send final output)

  ⚡️ Ready-to-use. Fully editable. Zero coding required.

  💡 Pro Tip: You can hook this up with the Veo 3 generation API (FAL) to complete the automation end-to-end!

workflow_json:
  {"id":"","meta":{},"name":"Veo3 AI Marketing Agent","tags":[],"nodes":[{"id":"1c63ed32-09fa-4f50-9821-f4cbe7b51d09","name":"Idea Gen Agent (research)","type":"@n8n/n8n-nodes-langchain.openAi","position":[-20,-40],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4","cachedResultName":"GPT-4"},"options":{},"messages":{"values":[{"content":"Create an impactful marketing video"},{"role":"system","content":"You are a creative marketing strategist for an e-commerce brand called Sally’s Closet, which sells women’s wear and accessories online.\n\nEach day, your job is to generate one fresh, engaging marketing video idea that ties together:\n\nA trending topic or recent news event, and\n\nA featured product or collection from Sally’s Closet (e.g. floral dresses, pastel handbags, silk scarves).\n\nUse Tavily to research current lifestyle trends, viral moments on social media, fashion-related events, or pop culture news from the past 24–48 hours.\nThen, creatively link that insight to a product theme or customer emotion (e.g. confidence, elegance, boldness) to craft a short, punchy marketing video concept.\n\nOutput format (for daily automation):\nVideo Idea Title: A catchy title (under 10 words)\n\nTrend or News Inspiration: Brief summary of the trend/topic found\n\nHow It Connects to Sally’s Closet: Why this is relevant to the audience and which product(s) to feature\n\nSuggested Hook for Video: 1-line attention-grabber\n\nCall-to-Action: What the viewer should do next (e.g. “Shop the look”, “Limited drop”, etc.)"}]}},"credentials":{},"typeVersion":1.8},{"id":"2c6514c9-7906-4721-b9a1-5fc665e24462","name":"Tavily","type":"@tavily/n8n-nodes-tavily.tavilyTool","position":[140,160],"parameters":{"query":"={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Query', ``, 'string') }}","options":{}},"credentials":{},"typeVersion":1},{"id":"20ef07ca-9bdf-4bc9-913b-0d9f9b7ac594","name":"Video Prompt Agent","type":"@n8n/n8n-nodes-langchain.openAi","position":[340,-40],"parameters":{"modelId":{"__rl":true,"mode":"list","value":"gpt-4","cachedResultName":"GPT-4"},"options":{},"messages":{"values":[{"content":"={{ $json.message.content }}"},{"role":"system","content":"You are a creative video concept generator trained to write highly effective prompts for Veo3, an AI video generation tool.\n\nYour task is to take the user's input — a short video idea or concept — and turn it into a compelling, cinematic-style prompt that Veo3 can use to generate a <5 second marketing video.\n\nYour output should:\n\nBe fewer than 100 words.\n\nClearly describe the visual scene and action.\n\nUse rich sensory and emotional language (e.g. vibrant, dramatic, elegant, playful).\n\nInclude camera angles or transitions (if applicable), e.g. \"slow zoom-in\", \"swooping drone shot\", \"quick cut\", etc.\n\nSpecify product or brand visuals to appear (e.g. “logo reveal at the end”, “woman applying lipstick with brand name glowing behind her”).\n\nTailor the tone to match the goal: e.g. playful for Gen Z fashion, sleek for luxury goods, bold for tech, etc.\n\nFormat your output like this:\n\n🎬 Veo3 Prompt:\n[Your cinematic, descriptive video prompt here]\n\nExample user input:\n\"Promote a new eco-friendly water bottle line for gym goers\"\n\nExample output:\n🎬 Veo3 Prompt:\nIn a dimly lit gym, slow-motion of sweat dripping as a toned athlete finishes a set. A crisp “click” as they open a sleek matte-black eco bottle. Water vapor swirls as they drink. Quick cut to logo reveal: “HydraLoop — Power Sustainably.” Glowing green pulse animates behind the text."}]}},"credentials":{},"typeVersion":1.8},{"id":"15114238-52f2-4ea1-baa7-e8f70c5fa6ab","name":"FAL Veo 3 Post Request","type":"n8n-nodes-base.httpRequest","position":[700,-40],"parameters":{"url":"https://queue.fal.run/fal-ai/veo3","method":"POST","options":{},"jsonBody":"={{ { \"prompt\": $json.message.content } }}","sendBody":true,"specifyBody":"json","authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{},"typeVersion":4.2},{"id":"2abf648d-24f3-4e21-b40c-fb7a7058c557","name":"Wait","type":"n8n-nodes-base.wait","position":[920,-40],"webhookId":"3c49ce0b-6628-41b3-9bba-f993f920ab75","parameters":{"amount":90},"typeVersion":1.1},{"id":"323c0d88-c792-44f3-8f39-3f9e349511ab","name":"Get Video  Status from FAL / Veo 3","type":"n8n-nodes-base.httpRequest","position":[1140,-40],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}/status","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{},"typeVersion":4.2},{"id":"e7513b78-4408-4b85-863f-2b7740660679","name":"Get Video URL request","type":"n8n-nodes-base.httpRequest","position":[1540,-40],"parameters":{"url":"=https://queue.fal.run/fal-ai/veo3/requests/{{ $json.request_id }}","options":{},"authentication":"genericCredentialType","genericAuthType":"httpHeaderAuth"},"credentials":{},"typeVersion":4.2},{"id":"0c2937f5-b5a7-4a1a-baf3-084bb4cebfca","name":"If","type":"n8n-nodes-base.if","position":[1340,-40],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"180190c9-6fcb-4d19-ade4-f221e99ffc82","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $json.status }}","rightValue":"COMPLETED"}]}},"typeVersion":2.2},{"id":"9d37835a-a267-4d6f-8b51-459b31a02f0e","name":"Gmail","type":"n8n-nodes-base.gmail","position":[1720,-40],"webhookId":"54c66ae2-92e4-4735-8ba7-80536d4778c5","parameters":{"sendTo":"REDACTED_EMAIL","message":"={{ $json.video.url }}","options":{},"subject":"Sally's Closet Marketing Video","emailType":"text"},"credentials":{},"typeVersion":2.1},{"id":"ac639284-66c4-4973-8ed4-c039c9156da9","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-220,-40],"parameters":{"rule":{"interval":[{"triggerAtHour":10}]}},"typeVersion":1.2},{"id":"579e6dda-a4db-4473-90da-0ca520131daa","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-60,-260],"parameters":{"color":3,"width":700,"height":560,"content":"Ideation & Prompt Generation"},"typeVersion":1},{"id":"8210a853-3f91-483b-807c-0a7ca897e152","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-320,-260],"parameters":{"height":560,"content":"Scheduled Trigger"},"typeVersion":1},{"id":"2912e1f5-3d8d-444d-ac25-6d99b1102222","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[660,-260],"parameters":{"color":4,"width":200,"height":560,"content":"Request Video"},"typeVersion":1},{"id":"2fd8f905-aea1-4e16-a742-927662930c8e","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[880,-260],"parameters":{"color":6,"width":800,"height":560,"content":"Check & Get Result Loop"},"typeVersion":1},{"id":"49413a91-c5db-43c8-81fc-951d0d9e9d29","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[1700,-260],"parameters":{"color":2,"width":280,"height":560,"content":"Send to Email"},"typeVersion":1},{"id":"dab2f0aa-5d71-465b-8c70-2ab2522eeed6","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-320,360],"parameters":{"color":5,"width":1320,"height":900,"content":"🎬 AI Video Marketing Agent (Veo 3 + GPT-4 + Tavily + Gmail)\nAutomate your entire video content creation pipeline with this AI-powered, no-code workflow built in n8n.\n\nThis template connects a suite of smart tools to help you generate scroll-stopping short video ideas based on daily trending topics and auto-deliver them via email—ready for production in Veo 3.\n\n🔧 How it works:\nScheduled Trigger (Daily)\nKicks off the process each day at your chosen time.\n\nTavily Agent (Web Search)\nSearches the latest trends, viral moments, or market news based on your e-commerce brand (e.g. “Sally’s Closet”).\n\nOpenAI GPT-4 Agent (Creative Brainstorming)\nGenerates high-conversion marketing video ideas based on your brand’s tone and what’s trending.\n\nPrompt Formatter for Veo 3\nConverts the idea into a cinematic-style prompt, optimized for Veo’s video generation engine (via FAL API).\n\nSend via Gmail\nThe final Veo 3 prompt is emailed to you or your creative team for immediate use or manual refinement.\n\nWatch full step-by-step Tutorial Build Video: https://youtu.be/x7nHpcggpX8\n\n🧠 Use Cases:\nE-commerce brands that need fresh daily content\n\nMarketing teams looking to automate creative ideation\n\nSolopreneurs building a lean video production engine\n\nAnyone experimenting with Veo 3 prompt-based storytelling\n\n🛠️ Tools used:\nn8n Scheduled Trigger\n\nTavily Node (for real-time web search)\n\nLangchain Agent (GPT-4 via OpenAI)\n\nFAL API (Veo 3 prompt delivery)\n\nGmail Node (send final output)\n\n⚡️ Ready-to-use. Fully editable. Zero coding required.\n\n💡 Pro Tip: You can hook this up with the Veo 3 generation API (FAL) to complete the automation end-to-end!"},"typeVersion":1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"","connections":{"If":{"main":[[{"node":"Get Video URL request","type":"main","index":0}],[{"node":"Wait","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Get Video  Status from FAL / Veo 3","type":"main","index":0}]]},"Tavily":{"ai_tool":[[{"node":"Idea Gen Agent (research)","type":"ai_tool","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Idea Gen Agent (research)","type":"main","index":0}]]},"Video Prompt Agent":{"main":[[{"node":"FAL Veo 3 Post Request","type":"main","index":0}]]},"Get Video URL request":{"main":[[{"node":"Gmail","type":"main","index":0}]]},"FAL Veo 3 Post Request":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Idea Gen Agent (research)":{"main":[[{"node":"Video Prompt Agent","type":"main","index":0}]]},"Get Video  Status from FAL / Veo 3":{"main":[[{"node":"If","type":"main","index":0}]]}}}


name: Automate Salon Appointment Management with WhatsApp, GPT & Google Calendar
author_name: Denis
author_username: denisholc7
categories: []
created_at: 2025-06-13T18:07:44.956Z
updated_at: 2025-06-13T18:07:44.956Z
url: https://n8n.io/workflows/4926
scraped_at: 2025-07-06 21:16:30
description:
  🤖 Multi-Agent AI WhatsApp Bot for Service Businesses

  Transform your salon/service business with this enterprise-level WhatsApp automation system featuring intelligent conversation routing, automated booking, and comprehensive business management.

  How it works
  Smart Intent Recognition** - AI automatically routes conversations to specialized agents
  Complete Appointment Management** - Book, cancel, update appointments with calendar sync
  Multi-Media Support** - Handles text, voice, images, and PDF documents
  Rate Limiting & Spam Protection** - Professional 30 msg/hour limits with graceful UX
  Automated 1-Day Reminders** - Sends WhatsApp reminders every evening for next-day appointments

  Set up steps
  WhatsApp Business API** setup (detailed instructions included)
  Airtable Database** configuration (3 tables: Services, Bookings, Configuration)  
  Google Calendar** integration for scheduling
  Redis** for caching and conversation state
  Gmail** for owner notifications
  Configure business hours, services, and policies in Airtable

  Key Features
  5 Specialized AI Agents** (Booking, Cancellation, Updates, General Inquiry, Intent Recognition)
  24-Hour Advance Reminders** - Automatic WhatsApp reminders sent at 8 PM for next day appointments
  Double Booking Prevention** with real-time conflict detection
  Conversation Memory** maintains context across interactions
  Error Resilience** with backup models and graceful failure handling
  Business Intelligence** with comprehensive logging and analytics
  Professional UX** with natural conversation flow and emoji matching

  Perfect for salons, spas, clinics, consulting services, or any appointment-based business. Includes complete setup documentation and business configuration templates.

nodes_used:
  ["n8n-nodes-base.airtable","n8n-nodes-base.httpRequest","n8n-nodes-base.redis","n8n-nodes-base.googleCalendar","n8n-nodes-base.gmail","n8n-nodes-base.whatsApp","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.openAi","@n8n/n8n-nodes-langchain.lmChatGoogleGemini"]

workflow_json:
  {"id":"kBUmCI2wIusHTtql","meta":{"instanceId":"1e7a9324ab9334116f824c649ad91453265a99b04bad06eba0c9ec33cc653365"},"name":"Nail Salon US","tags":[],"nodes":[{"id":"4380f8c2-9aed-47f8-b5ae-fc05ae343944","name":"WhatsApp Trigger","type":"n8n-nodes-base.whatsAppTrigger","position":[-10160,1580],"webhookId":"36d2f65f-83a5-4b48-ba15-351828480633","parameters":{},"typeVersion":1},{"id":"f7cdf2d8-9b6b-4782-9449-08b3d2f36348","name":"Download Image","type":"n8n-nodes-base.httpRequest","position":[-3220,1780],"parameters":{},"typeVersion":4.2},{"id":"1bc5c93c-77c3-4ad8-b1ff-3bca5313f13c","name":"Analyze Image","type":"@n8n/n8n-nodes-langchain.openAi","position":[-2980,1780],"parameters":{},"typeVersion":1.8},{"id":"6818c1ee-c489-487e-ae32-684bbd70c46a","name":"Download Audio","type":"n8n-nodes-base.httpRequest","position":[-3220,1460],"parameters":{},"typeVersion":4.2},{"id":"3128b617-aaf9-494f-a4d1-23e6984397b0","name":"Transcribe Audio","type":"@n8n/n8n-nodes-langchain.openAi","position":[-2980,1460],"parameters":{},"typeVersion":1.8},{"id":"b760b73a-c992-43fe-8255-11c48fde248e","name":"Download File","type":"n8n-nodes-base.httpRequest","position":[-3240,2120],"parameters":{},"typeVersion":4.2},{"id":"b35ebaaa-0009-4370-aaab-2997f343b261","name":"Extract from File","type":"n8n-nodes-base.extractFromFile","position":[-2980,2120],"parameters":{},"typeVersion":1},{"id":"3219dbfc-db0a-4798-82ed-f068cffd090d","name":"Get File Url","type":"n8n-nodes-base.whatsApp","position":[-3460,2120],"webhookId":"33325343-415f-4d00-a271-f58a2157860b","parameters":{},"typeVersion":1},{"id":"faefff9e-d1f3-4bd9-8aa9-22fe95eb43c7","name":"Only PDF File","type":"n8n-nodes-base.if","position":[-3740,2140],"parameters":{},"typeVersion":2.2},{"id":"1ac94f56-0022-4478-abbd-7f8263c867d6","name":"Fix mimeType for Audio","type":"n8n-nodes-base.code","position":[280,3880],"parameters":{},"typeVersion":2},{"id":"69dfaa3e-3d58-4d59-a61a-bd790d356da1","name":"Send message","type":"n8n-nodes-base.whatsApp","position":[260,4080],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"b57c81f2-b3e0-4f16-9274-9cd4a66e08f1","name":"Send audio","type":"n8n-nodes-base.whatsApp","position":[500,3880],"webhookId":"ecdb0942-3d3d-4227-baff-6703e9f642b9","parameters":{},"typeVersion":1},{"id":"949b5cd4-d8b3-4b6f-890b-a3f2fc2f76bd","name":"Incorrect format","type":"n8n-nodes-base.whatsApp","position":[-3460,2400],"webhookId":"deccd8d0-41ad-4680-8e02-3341d1b6116d","parameters":{},"typeVersion":1},{"id":"1ae9804a-e8fd-4035-8b9a-5cd21f4e36ed","name":"Text","type":"n8n-nodes-base.set","position":[-3240,1120],"parameters":{},"typeVersion":3.4},{"id":"6f48be7e-f99f-41d7-a34d-223f165c5dd6","name":"Audio","type":"n8n-nodes-base.set","position":[-2720,1460],"parameters":{},"typeVersion":3.4},{"id":"eba50369-fa10-4871-a4a6-6ca834aaf185","name":"Image","type":"n8n-nodes-base.set","position":[-2720,1780],"parameters":{},"typeVersion":3.4},{"id":"138fba31-f65b-400e-ad00-3a5a1bb80831","name":"File","type":"n8n-nodes-base.set","position":[-2720,2120],"parameters":{},"typeVersion":3.4},{"id":"98635683-a651-4242-9a81-3c045b0491b1","name":"Not supported","type":"n8n-nodes-base.whatsApp","position":[-4740,1760],"webhookId":"63f23ab1-de78-4108-90b3-9de916e62f2d","parameters":{},"typeVersion":1},{"id":"e882eb3e-928c-4be7-a50e-4fce8e4e0519","name":"Get Image Url","type":"n8n-nodes-base.whatsApp","position":[-3460,1780],"webhookId":"59c18510-df35-48a8-8878-785af94c4246","parameters":{},"typeVersion":1},{"id":"2f5bffbc-bc50-4465-858b-96671a7cabf0","name":"Get Audio Url","type":"n8n-nodes-base.whatsApp","position":[-3480,1460],"webhookId":"35d87123-bad4-40c4-8058-84ab61eafab6","parameters":{},"typeVersion":1},{"id":"ba08c1a9-dc7b-4759-9428-00d5b68a2932","name":"Generate Audio Response","type":"@n8n/n8n-nodes-langchain.openAi","position":[60,3880],"parameters":{},"typeVersion":1.8},{"id":"7b35913d-a4da-4330-b975-15ececec11fa","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-3820,1100],"parameters":{"content":""},"typeVersion":1},{"id":"7e7d5c95-4f2a-4168-ad53-6a72ad069865","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-3820,1420],"parameters":{"content":""},"typeVersion":1},{"id":"e157f532-1a79-413b-90c6-42f4ca7c25cc","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[-3820,1740],"parameters":{"content":""},"typeVersion":1},{"id":"68f4b508-0662-46d0-b0ff-f1e3d1a9cf32","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[-3820,2060],"parameters":{"content":""},"typeVersion":1},{"id":"56ab02ca-cf00-4c56-82e6-72d7d0195ab6","name":"From audio to audio?","type":"n8n-nodes-base.if","position":[60,4080],"parameters":{},"typeVersion":2.2},{"id":"0b57e4b9-0d8a-4b65-acbf-8a524f5a8d2e","name":"Input type","type":"n8n-nodes-base.switch","position":[-4740,1440],"parameters":{},"typeVersion":3.2},{"id":"52158bd6-be12-41af-ab3b-e063800b078c","name":"Sticky Note5","type":"n8n-nodes-base.stickyNote","position":[-10880,780],"parameters":{"content":""},"typeVersion":1},{"id":"4ebfbfdc-59a0-4752-a76f-65ef05ea9fcd","name":"Simple Memory2","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1760,1740],"parameters":{},"typeVersion":1.3},{"id":"6d0d65d2-225a-46a8-8535-b4a9c46dc1e2","name":"Switch Route","type":"n8n-nodes-base.switch","position":[-560,1460],"parameters":{},"typeVersion":3.2},{"id":"d3a48aa7-d378-4fbc-a1f5-a7fe1b6d58a6","name":"Intent Recognition Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[-1920,1500],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"84562e48-299c-43b4-8209-28cc591d83ef","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-1560,1980],"parameters":{},"typeVersion":1.2},{"id":"cb791657-3bb1-43f5-9714-d12b80401e74","name":"Sticky Note15","type":"n8n-nodes-base.stickyNote","position":[0,2040],"parameters":{"content":""},"typeVersion":1},{"id":"cc044652-67af-44b1-a81e-53f4d2db2872","name":"Sticky Note16","type":"n8n-nodes-base.stickyNote","position":[0,2900],"parameters":{"content":""},"typeVersion":1},{"id":"8444b26d-ec70-4c81-a351-6d5760c43797","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[940,3460],"parameters":{},"typeVersion":1.2},{"id":"268f1a24-67b5-43b0-976c-13032952643b","name":"Google Gemini Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[320,3460],"parameters":{},"typeVersion":1},{"id":"deb0e34f-4327-4fa7-83a5-c2ea9250526f","name":"General Inquiry","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[100,3200],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"3961b971-310b-498b-bad0-9bbce816a63f","name":"General Inquiry - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[880,3220],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"04aec1f5-efbb-4868-a64f-935d13074c16","name":"Parse General Inquiry Output","type":"n8n-nodes-base.code","position":[1480,3000],"parameters":{},"typeVersion":2},{"id":"b69610a5-2a03-47b7-bef1-749e69f4bb6b","name":"Simple Memory1","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[480,3460],"parameters":{},"typeVersion":1.3},{"id":"efc4ed20-3e29-4860-a745-2a949e3d3147","name":"Google Gemini Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[-2000,1740],"parameters":{},"typeVersion":1},{"id":"19e41ff7-b831-4c08-87ae-a247d61f5bdb","name":"Update Ready?","type":"n8n-nodes-base.if","position":[2460,2220],"parameters":{},"typeVersion":2.2},{"id":"607260cc-85e9-4f58-a1cb-e43cc412f025","name":"Update Event","type":"n8n-nodes-base.googleCalendar","position":[2720,2120],"parameters":{},"typeVersion":1.3},{"id":"b67cc3c1-c890-480b-b171-24ec25d14b8d","name":"Search Airtable Record","type":"n8n-nodes-base.airtable","position":[2920,2120],"parameters":{},"typeVersion":2.1},{"id":"a7a72811-61d2-41cd-a398-0959e80ddf9f","name":"Update Airtable Record","type":"n8n-nodes-base.airtable","position":[3160,2120],"parameters":{},"typeVersion":2.1},{"id":"8e34cc7c-de22-46fe-8d8b-e5cd68493151","name":"Customer Confirmation Message","type":"n8n-nodes-base.code","position":[3600,2120],"parameters":{},"typeVersion":2},{"id":"da11d41a-d8ad-4718-be89-1e2e83ce047a","name":"Multiple Appointments","type":"n8n-nodes-base.set","position":[2720,2340],"parameters":{},"typeVersion":3.4},{"id":"af46d06d-593f-4554-8372-1f2c583ea213","name":"Extract JSON from Agent","type":"n8n-nodes-base.code","position":[2160,2140],"parameters":{},"typeVersion":2},{"id":"c339c16b-fb23-4a9c-8912-2cc342cf6e27","name":"Simple Memory10","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[580,2660],"parameters":{},"typeVersion":1.3},{"id":"8e2bba93-66e0-4d65-89cf-d0f9b192e267","name":"Simple Memory11","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[-1220,1980],"parameters":{},"typeVersion":1.3},{"id":"b8e1ca14-aadc-4bf7-8cb1-e647dfb18e78","name":"Intent Recognition Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[-1440,1740],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"daef52d9-49bc-4be0-aa57-79089a503530","name":"Set Processing Lock","type":"n8n-nodes-base.redis","position":[-6820,1480],"parameters":{},"typeVersion":1},{"id":"75dc3496-e16a-4654-b3e8-85411382905b","name":"Wait","type":"n8n-nodes-base.wait","position":[-6580,1480],"webhookId":"77bedc6a-785f-4656-a43b-0be71a58ee5c","parameters":{},"typeVersion":1.1},{"id":"b927fe9b-65c9-4085-974f-a4333032b56e","name":"Get Current Processing Lock","type":"n8n-nodes-base.redis","position":[-6360,1480],"parameters":{},"typeVersion":1},{"id":"ad77a21d-9f9d-49c6-adf5-55b2d07cd846","name":"Am I the Processor?","type":"n8n-nodes-base.if","position":[-6140,1480],"parameters":{},"typeVersion":2.2},{"id":"4973ac21-4d20-42d3-8252-73f12d05b5dc","name":"Pop All Batched Messages","type":"n8n-nodes-base.redis","position":[-5880,1480],"parameters":{},"typeVersion":1},{"id":"e686f949-3bfd-423e-a9d2-0e91bd21456c","name":"Delete Message List","type":"n8n-nodes-base.redis","position":[-5660,1480],"parameters":{},"typeVersion":1},{"id":"e4ebbfd7-1770-4d03-bf5b-7d1fe2e33f78","name":"Delete Processing Lock","type":"n8n-nodes-base.redis","position":[-5420,1480],"parameters":{},"typeVersion":1},{"id":"ac443f93-98d0-463e-94fe-df1db8027010","name":"Push","type":"n8n-nodes-base.redis","position":[-7080,1480],"parameters":{},"typeVersion":1},{"id":"c8382265-8331-4d48-b215-c3143b7e8217","name":"Is User Text Message?","type":"n8n-nodes-base.if","position":[-9260,1600],"parameters":{},"typeVersion":2.2},{"id":"e2391464-0536-4d82-9b52-a7bcff489e02","name":"Is Audio Message?","type":"n8n-nodes-base.if","position":[-9500,1580],"parameters":{},"typeVersion":2.2},{"id":"4f9fbe60-cfa9-49d3-a5ea-28260148a16f","name":"Send Error Notification","type":"n8n-nodes-base.gmail","position":[2160,2380],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"a6dea7fc-f009-411c-b304-1dd27593169e","name":"Notify Client Error","type":"n8n-nodes-base.set","position":[2160,2580],"parameters":{},"typeVersion":3.4},{"id":"06918e43-f131-4de8-a936-0f669c67a092","name":"Send Error Notification1","type":"n8n-nodes-base.gmail","position":[-940,1760],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"3b0962e9-b9ad-433a-bfe4-b96073c37198","name":"Send Error Notification4","type":"n8n-nodes-base.gmail","position":[1480,3240],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"1055ed0f-a487-4247-87cb-e878cb9bcae2","name":"Notify Client Error4","type":"n8n-nodes-base.set","position":[1480,3480],"parameters":{},"typeVersion":3.4},{"id":"a7128293-1582-4332-8e5e-4e8f5174c490","name":"Sticky Note4","type":"n8n-nodes-base.stickyNote","position":[-10220,1280],"parameters":{"content":""},"typeVersion":1},{"id":"e163b2e6-e4f5-49f6-86e8-76e69e9a5aa9","name":"Sticky Note6","type":"n8n-nodes-base.stickyNote","position":[-2200,1180],"parameters":{"content":""},"typeVersion":1},{"id":"41d8d196-0173-4f72-afa5-e44fb2f750ef","name":"Combine Messages","type":"n8n-nodes-base.code","position":[-5200,1480],"parameters":{},"typeVersion":2},{"id":"7308fca3-2654-4b9d-8d60-300642e18c02","name":"Sticky Note7","type":"n8n-nodes-base.stickyNote","position":[-10220,2800],"parameters":{"content":""},"typeVersion":1},{"id":"5250fb2b-76da-41be-b69e-8b1c4aeb6358","name":"Schedule Trigger","type":"n8n-nodes-base.scheduleTrigger","position":[-10160,3120],"parameters":{},"typeVersion":1.2},{"id":"008f9ad8-5d20-4395-a8a8-09513800d4e9","name":"Calculate Tomorrow","type":"n8n-nodes-base.code","position":[-9940,3120],"parameters":{},"typeVersion":2},{"id":"e1fa722e-11fa-4cfa-ab6d-2575b26e5d70","name":"Get Schedule Events","type":"n8n-nodes-base.googleCalendar","position":[-9720,3120],"parameters":{},"typeVersion":1.3},{"id":"bf7d1859-23e2-40a3-a335-e7f3bf607de3","name":"Format Reminder Data","type":"n8n-nodes-base.code","position":[-9500,3120],"parameters":{},"typeVersion":2},{"id":"854296f2-50bf-445e-a324-04969fb687f6","name":"Search Schedule Events","type":"n8n-nodes-base.airtable","position":[-9280,3120],"parameters":{},"executeOnce":false,"typeVersion":2.1},{"id":"f58b9a7e-8332-45ba-8887-8a4c6d66efad","name":"Send Client Reminder","type":"n8n-nodes-base.whatsApp","position":[-9060,3120],"webhookId":"af3e3019-ecf7-49e8-b6a1-693e762d72e1","parameters":{},"typeVersion":1},{"id":"6c0e627c-aea9-41c9-b58c-ead20aee9706","name":"Sticky Note10","type":"n8n-nodes-base.stickyNote","position":[0,3720],"parameters":{"content":""},"typeVersion":1},{"id":"20673ec9-2671-4038-90db-7d968cb1ec16","name":"Google Gemini Chat Model8","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[420,2660],"parameters":{},"typeVersion":1},{"id":"8f9b76a4-6291-48bb-8bd5-f7201268ae66","name":"Package Data","type":"n8n-nodes-base.code","position":[-5000,1480],"parameters":{},"typeVersion":2},{"id":"d6d44d1f-0be1-444a-b504-066a2970cc9c","name":"Create Event","type":"n8n-nodes-base.googleCalendar","onError":"continueErrorOutput","position":[2760,340],"parameters":{},"retryOnFail":true,"typeVersion":1.3},{"id":"834ec55e-9a93-480d-8781-287151df92b7","name":"Logs the confirmed booking details1","type":"n8n-nodes-base.airtable","position":[3480,160],"parameters":{},"typeVersion":2.1},{"id":"ea58a428-7b30-4340-8a0c-5e188cf2642f","name":"Information to be Saved in Airtable1","type":"n8n-nodes-base.set","position":[3260,160],"parameters":{},"typeVersion":3.4},{"id":"4556b6d0-1e01-438d-b051-4a6b41d8d279","name":"Simple Memory6","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1160,900],"parameters":{},"typeVersion":1.3},{"id":"306991d2-98d8-4c6e-8b62-a844ae1b8178","name":"OpenAI Chat Model4","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[460,900],"parameters":{},"typeVersion":1.2},{"id":"4da4e901-b3ac-493f-b7c5-2ccee8822bbb","name":"Sticky Note12","type":"n8n-nodes-base.stickyNote","position":[0,0],"parameters":{"content":""},"typeVersion":1},{"id":"f4e7195b-4424-45d1-b917-cda3a74c54bb","name":"Send Confirmation","type":"n8n-nodes-base.gmail","position":[3020,160],"webhookId":"05ab2f0f-5757-40cc-8278-2c10bbc12983","parameters":{},"typeVersion":2.1},{"id":"aecd6c81-770f-41c7-969b-35cdc54bc8b0","name":"Send Error Notification2","type":"n8n-nodes-base.gmail","position":[2200,580],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"1a55b451-15c1-4ddb-aa90-1e939a94afb9","name":"Notify Client Error2","type":"n8n-nodes-base.set","position":[2180,880],"parameters":{},"typeVersion":3.4},{"id":"fbd17d9b-2140-483f-acab-6f1cdb711336","name":"If","type":"n8n-nodes-base.if","position":[2400,360],"parameters":{},"typeVersion":2.2},{"id":"044e415a-cb8a-429d-b652-009647756f58","name":"check_availability","type":"n8n-nodes-base.googleCalendarTool","position":[1320,900],"parameters":{},"typeVersion":1.3},{"id":"26faa257-d04b-41de-a787-3d0bfa35d33a","name":"Fix JSON Output","type":"n8n-nodes-base.code","position":[2200,360],"parameters":{},"typeVersion":2},{"id":"238400e7-c75c-4370-a292-b042f0847b1b","name":"Parse Confirmation Message","type":"n8n-nodes-base.code","position":[3700,160],"parameters":{},"typeVersion":2},{"id":"5902017e-e94f-4bb1-a0cf-921c56931c56","name":"Send Error Notification5","type":"n8n-nodes-base.gmail","position":[3020,360],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"81c7499e-be1c-418d-a197-c96f3093a518","name":"Notify Client Error5","type":"n8n-nodes-base.set","position":[3020,560],"parameters":{},"typeVersion":3.4},{"id":"b44e68d7-ecf7-4c19-9969-147a59bcb168","name":"list_services","type":"n8n-nodes-base.airtableTool","position":[1020,900],"parameters":{},"typeVersion":2.1},{"id":"d1a339d1-9ac9-4418-ab60-e58d4cfcb61a","name":"Google Gemini Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[860,900],"parameters":{},"typeVersion":1},{"id":"ab49b961-5070-4fdb-ba99-610fe2f7226c","name":"Cancel Appointment","type":"n8n-nodes-base.airtable","position":[3160,1200],"parameters":{},"typeVersion":2.1},{"id":"0445991f-1ff5-4e8e-87cb-a8ddbb70848b","name":"Not Found","type":"n8n-nodes-base.code","position":[2720,1460],"parameters":{},"typeVersion":2},{"id":"786f58f5-5e7a-4c52-8c72-9dc2261562b8","name":"Sticky Note17","type":"n8n-nodes-base.stickyNote","position":[0,1180],"parameters":{"content":""},"typeVersion":1},{"id":"3af56cce-9f6f-469a-b45b-b0be7d5e7026","name":"Prepare Cancel Appointment1","type":"n8n-nodes-base.code","position":[3380,1200],"parameters":{},"typeVersion":2},{"id":"85b28008-4fc0-499f-9d23-1e325d9571e1","name":"Send Cancellation1","type":"n8n-nodes-base.gmail","position":[2720,1200],"webhookId":"99a3344a-9b6c-4e00-bab9-45a57ceed05c","parameters":{},"typeVersion":2.1},{"id":"69efd7f6-0aec-4ec4-8d18-3bf9ba2b9fa6","name":"Send Update Message","type":"n8n-nodes-base.whatsApp","position":[3560,2580],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"17acf1ac-b319-4b43-96dd-b82d4fada4e3","name":"Send Cancel Message","type":"n8n-nodes-base.whatsApp","position":[3120,1800],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"89041ce1-ec03-409d-864a-cc8352081495","name":"Send Booking Message","type":"n8n-nodes-base.whatsApp","position":[3480,920],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"c21617b0-74a8-4d44-8e73-8e90d65ea2f8","name":"get_events","type":"n8n-nodes-base.googleCalendarTool","position":[720,2660],"parameters":{},"typeVersion":1.3},{"id":"ccc4bc70-6749-4f30-a44c-00889c248f42","name":"check_events","type":"n8n-nodes-base.googleCalendarTool","position":[1000,2660],"parameters":{},"typeVersion":1.3},{"id":"1527737d-79d1-40e6-bc08-5d9d2e3966dd","name":"list_services1","type":"n8n-nodes-base.airtableTool","position":[860,2660],"parameters":{},"typeVersion":2.1},{"id":"e6ce761e-f677-49f0-bd4b-5513aaf32e9a","name":"set_appointments","type":"n8n-nodes-base.redisTool","position":[1340,2660],"parameters":{},"typeVersion":1},{"id":"59b1ad49-250f-4713-8a0e-d6f9b67ee7b7","name":"get_appointments","type":"n8n-nodes-base.redisTool","position":[1160,2660],"parameters":{},"typeVersion":1},{"id":"98e3adf5-adc5-44cd-aacd-1c990490f3d9","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1500,2660],"parameters":{},"typeVersion":1.2},{"id":"41404bb1-3468-4127-895a-8d0a1287b683","name":"Send General Message","type":"n8n-nodes-base.whatsApp","position":[1840,3260],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"b4e936fe-e942-44b9-aaa7-03be36226d8e","name":"list_services2","type":"n8n-nodes-base.airtableTool","position":[780,3460],"parameters":{},"typeVersion":2.1},{"id":"9fdc1868-440b-4eca-98d9-eb4579339db2","name":"get_customer_appointments","type":"n8n-nodes-base.googleCalendarTool","position":[640,3460],"parameters":{},"typeVersion":1.3},{"id":"bb310ab0-de1b-4f35-9f31-77b31bd3ead8","name":"Send Update Message1","type":"n8n-nodes-base.gmail","position":[3380,2120],"webhookId":"043d7025-645a-43a0-bd34-6bdc544ca5ff","parameters":{},"typeVersion":2.1},{"id":"ccacfc53-1a57-4017-9897-eff30adb326e","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[300,1800],"parameters":{},"typeVersion":1.3},{"id":"21198f7a-6ef0-4fed-815e-4f14d3e417ef","name":"Google Gemini Chat Model9","type":"@n8n/n8n-nodes-langchain.lmChatGoogleGemini","position":[140,1800],"parameters":{},"typeVersion":1},{"id":"d88c0a2d-ee1e-4b4d-8eea-f0a9fb18ac8d","name":"check_events1","type":"n8n-nodes-base.googleCalendarTool","position":[720,1800],"parameters":{},"typeVersion":1.3},{"id":"5f9fc427-b3f5-4bb7-86c8-edee42360385","name":"list_services3","type":"n8n-nodes-base.airtableTool","position":[580,1800],"parameters":{},"typeVersion":2.1},{"id":"0f5f7e72-63de-460f-a9c2-7b89f9393cbe","name":"set_appointments1","type":"n8n-nodes-base.redisTool","position":[1060,1800],"parameters":{},"typeVersion":1},{"id":"1bc155fc-4920-4b2c-bcc8-bc510bf4b918","name":"get_appointments1","type":"n8n-nodes-base.redisTool","position":[880,1800],"parameters":{},"typeVersion":1},{"id":"d9dc9b2c-4a36-4c7d-b675-a4fe34067993","name":"OpenAI Chat Model3","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[1240,1800],"parameters":{},"typeVersion":1.2},{"id":"574c88ca-e7e9-4ad9-a69b-d74820013752","name":"Cancellation Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[840,1480],"parameters":{},"typeVersion":1.9},{"id":"8904e9c5-acde-4d3b-be2a-d0d099f810b9","name":"Send Error Notification3","type":"n8n-nodes-base.gmail","position":[1540,1500],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"3dbc0e2a-5eac-4cb0-ae9a-74b16dc265d6","name":"Notify Client Error3","type":"n8n-nodes-base.set","position":[1540,1780],"parameters":{},"typeVersion":3.4},{"id":"7ca7368d-8a9c-4f88-a6aa-9d8be3c1d19d","name":"Extract JSON from Cancellation Agent","type":"n8n-nodes-base.code","position":[1540,1260],"parameters":{},"typeVersion":2},{"id":"f7ec6624-13b7-4478-bbd9-3d15386dad04","name":"Delete Ready?","type":"n8n-nodes-base.if","position":[2000,1400],"parameters":{},"typeVersion":2.2},{"id":"d46257c3-750c-4ec0-a42e-1e12f4e783f3","name":"Delete Event","type":"n8n-nodes-base.googleCalendar","onError":"continueErrorOutput","position":[2300,1260],"parameters":{},"retryOnFail":true,"typeVersion":1.3},{"id":"4cb93210-1b02-4969-8724-119fb3de46a9","name":"Search Delete Record","type":"n8n-nodes-base.airtable","position":[2920,1200],"parameters":{},"typeVersion":2.1},{"id":"cac8067d-aa1d-46ad-994f-736b786b6c83","name":"get_events1","type":"n8n-nodes-base.googleCalendarTool","position":[440,1800],"parameters":{},"typeVersion":1.3},{"id":"9c29c462-0032-4709-a1d8-61837acf67c1","name":"Rate Limiter","type":"n8n-nodes-base.code","position":[-9040,1600],"parameters":{},"typeVersion":2},{"id":"c153ab9b-b644-41cd-a15f-8b37fffe8807","name":"Check Limit","type":"n8n-nodes-base.code","position":[-8400,1600],"parameters":{},"typeVersion":2},{"id":"1d056488-5042-4e42-b01b-908cc3f009d3","name":"Check Rate Limited","type":"n8n-nodes-base.if","position":[-8220,1600],"parameters":{},"typeVersion":2.2},{"id":"d9a21e55-4c20-41b5-ace6-7836f879e9ec","name":"Redis Hourly","type":"n8n-nodes-base.redis","position":[-8820,1600],"parameters":{},"typeVersion":1},{"id":"4b008718-6175-4f1f-bc60-6b48624a3569","name":"Increment Counter Hourly","type":"n8n-nodes-base.redis","position":[-8620,1600],"parameters":{},"typeVersion":1},{"id":"412e5fec-2306-4919-822d-23ca49a9dc69","name":"Send Mesage?","type":"n8n-nodes-base.if","position":[-7980,1360],"parameters":{},"typeVersion":2.2},{"id":"4da9c235-3109-433a-be8c-283db9f34bc6","name":"Send Rate Limit Email","type":"n8n-nodes-base.gmail","position":[-7340,1360],"webhookId":"6496a801-0075-4062-b7d2-5b89b969414a","parameters":{},"typeVersion":2.1},{"id":"304863ac-3ff6-435f-a1cd-f757bb8aa1bd","name":"Send User Message","type":"n8n-nodes-base.whatsApp","position":[-7740,1360],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"1a293f83-112d-483a-94f4-d73952cfb61e","name":"Send Owner Message","type":"n8n-nodes-base.whatsApp","position":[-7540,1360],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"d67b5020-f8a3-4dc1-ad93-44a66c1ba4f1","name":"Sticky Note8","type":"n8n-nodes-base.stickyNote","position":[-10220,3380],"parameters":{"content":""},"typeVersion":1},{"id":"c12bca9c-df6f-43de-a9f2-6b05956bd7e9","name":"Send Media Warning Owner","type":"n8n-nodes-base.whatsApp","position":[-4460,1540],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"daf0dd26-544d-4872-83bf-fc2d37342608","name":"Send File Warning Owner","type":"n8n-nodes-base.whatsApp","position":[-4460,1780],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"ea07cc15-b5db-4e6c-b6f0-31869b479043","name":"Send User Notification","type":"n8n-nodes-base.whatsApp","position":[-4240,1660],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"e96a2b5c-e592-4878-b60d-e3dfdee7df90","name":"Cancellation Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[300,1460],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"68ef6339-eef8-4211-b3ab-5108284df01a","name":"Notify Client","type":"n8n-nodes-base.whatsApp","position":[-940,1980],"webhookId":"2d49d505-964e-41af-a7e0-6ee1353d916e","parameters":{},"typeVersion":1},{"id":"fd1ce44a-8caa-43db-bac6-560f642372f3","name":"Booking Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[220,540],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"20f47316-cf4b-4d21-bf72-ac205e0a42be","name":"Booking Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[1420,560],"parameters":{},"retryOnFail":false,"typeVersion":1.9},{"id":"9a6746fa-e62d-4cc3-9b66-3e0f2713fce9","name":"Parse Intent JSON","type":"n8n-nodes-base.code","position":[-940,1480],"parameters":{},"typeVersion":2},{"id":"e14a0e43-9987-4b89-b2a8-1affbf91747b","name":"Get Calendar Events","type":"n8n-nodes-base.googleCalendar","position":[-9940,2380],"parameters":{},"typeVersion":1.3},{"id":"3d00b00f-05ed-4826-a5a0-f5f54200b443","name":"Detect Conflicts","type":"n8n-nodes-base.code","position":[-9540,2380],"parameters":{},"typeVersion":2},{"id":"1de87705-d44f-4bc4-b2d8-c73def148aed","name":"Format Alert Message","type":"n8n-nodes-base.code","position":[-9320,2380],"parameters":{},"typeVersion":2},{"id":"c6aee48f-d9f1-4111-bccd-3c75c11d5065","name":"Send WhatsApp Alert","type":"n8n-nodes-base.whatsApp","position":[-9040,2280],"webhookId":"c83309ed-6bcf-4c99-9e35-078cd87973b7","parameters":{},"typeVersion":1},{"id":"432c71b4-b505-421c-bf66-092f0c462ca0","name":"Send Email Alert","type":"n8n-nodes-base.gmail","position":[-9040,2540],"webhookId":"ca92f4db-316e-4239-b317-dbcc7267fc6d","parameters":{},"typeVersion":2.1},{"id":"42cf8953-f292-465c-9330-decdd5e0beb0","name":"Get Airtable Bookings","type":"n8n-nodes-base.airtable","position":[-9740,2380],"parameters":{},"executeOnce":true,"typeVersion":2.1},{"id":"c0253b8f-e2e8-4d90-8354-b50403a580d7","name":"Schedule Trigger1","type":"n8n-nodes-base.scheduleTrigger","position":[-10140,2380],"parameters":{},"typeVersion":1.2},{"id":"581345ee-f6ad-4d64-9d05-b0d1ed29ccd6","name":"Sticky Note11","type":"n8n-nodes-base.stickyNote","position":[-10220,2080],"parameters":{"content":""},"typeVersion":1},{"id":"6f7d620a-8cd0-4cbb-b3a5-80b697b4f044","name":"Sticky Note13","type":"n8n-nodes-base.stickyNote","position":[-10220,-1020],"parameters":{"content":""},"typeVersion":1},{"id":"1e6284ab-9d98-48f1-ae6c-ba7344e60a5f","name":"Update Agent","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[140,2340],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"4963f829-bcd0-44ec-80ce-234a7c7e2115","name":"Update Agent - Backup","type":"@n8n/n8n-nodes-langchain.agent","onError":"continueErrorOutput","position":[1360,2360],"parameters":{},"retryOnFail":true,"typeVersion":1.9},{"id":"35c72cf2-f4f6-41dd-8a55-ce119f167980","name":"Max Iterations?","type":"n8n-nodes-base.if","position":[960,440],"parameters":{},"typeVersion":2.2},{"id":"52341996-33ad-45aa-a6b2-3533ca6a4959","name":"Max Iterations?1","type":"n8n-nodes-base.if","position":[640,1380],"parameters":{},"typeVersion":2.2},{"id":"505ff291-1f0e-4a2e-af24-09829dcc3868","name":"Max Iterations?2","type":"n8n-nodes-base.if","position":[880,2240],"parameters":{},"typeVersion":2.2},{"id":"3e52fffe-b306-453c-b049-3784144cd786","name":"Max Iterations?3","type":"n8n-nodes-base.if","position":[-1360,1500],"parameters":{},"typeVersion":2.2},{"id":"1b2ea972-f088-4e27-aa93-813cfaba9e80","name":"Set Initial Data","type":"n8n-nodes-base.set","position":[-9740,1580],"parameters":{},"typeVersion":3.4},{"id":"9a10a36f-6d17-4720-a5e5-a32f6b6ce227","name":"Fetch Configuration","type":"n8n-nodes-base.airtable","onError":"continueRegularOutput","position":[-9960,1580],"parameters":{},"typeVersion":2.1}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"b7929b97-f987-421b-a7ab-691877ff27c5","connections":{"If":{"main":[[{"node":"Create Event","type":"main","index":0}],[{"node":"Send Booking Message","type":"main","index":0}]]},"File":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Push":{"main":[[{"node":"Set Processing Lock","type":"main","index":0}]]},"Text":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Wait":{"main":[[{"node":"Get Current Processing Lock","type":"main","index":0}]]},"Audio":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Image":{"main":[[{"node":"Intent Recognition Agent","type":"main","index":0}]]},"Not Found":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Input type":{"main":[[{"node":"Text","type":"main","index":0}],[{"node":"Get Audio Url","type":"main","index":0}],[{"node":"Send Media Warning Owner","type":"main","index":0}],[{"node":"Send File Warning Owner","type":"main","index":0}],[{"node":"Not supported","type":"main","index":0}]]},"get_events":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"Check Limit":{"main":[[{"node":"Check Rate Limited","type":"main","index":0}]]},"get_events1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"Create Event":{"main":[[{"node":"Send Confirmation","type":"main","index":0}],[{"node":"Send Error Notification5","type":"main","index":0},{"node":"Notify Client Error5","type":"main","index":0}]]},"Delete Event":{"main":[[{"node":"Send Cancellation1","type":"main","index":0}],[{"node":"Not Found","type":"main","index":0}]]},"Get File Url":{"main":[[{"node":"Download File","type":"main","index":0}]]},"Package Data":{"main":[[{"node":"Input type","type":"main","index":0}]]},"Rate Limiter":{"main":[[{"node":"Redis Hourly","type":"main","index":0}]]},"Redis Hourly":{"main":[[{"node":"Increment Counter Hourly","type":"main","index":0}]]},"Send Mesage?":{"main":[[{"node":"Send User Message","type":"main","index":0}]]},"Switch Route":{"main":[[{"node":"Booking Agent","type":"main","index":0}],[{"node":"Cancellation Agent","type":"main","index":0}],[{"node":"Update Agent","type":"main","index":0}],[{"node":"General Inquiry","type":"main","index":0}]]},"Update Agent":{"main":[[{"node":"Max Iterations?2","type":"main","index":0}],[{"node":"Update Agent - Backup","type":"main","index":0}]]},"Update Event":{"main":[[{"node":"Search Airtable Record","type":"main","index":0}]]},"check_events":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"Analyze Image":{"main":[[{"node":"Image","type":"main","index":0}]]},"Booking Agent":{"main":[[{"node":"Max Iterations?","type":"main","index":0}],[{"node":"Booking Agent - Backup","type":"main","index":0}]]},"Delete Ready?":{"main":[[{"node":"Delete Event","type":"main","index":0}],[{"node":"Send Cancel Message","type":"main","index":0}]]},"Download File":{"main":[[{"node":"Extract from File","type":"main","index":0}]]},"Get Audio Url":{"main":[[{"node":"Download Audio","type":"main","index":0}]]},"Get Image Url":{"main":[[{"node":"Download Image","type":"main","index":0}]]},"Only PDF File":{"main":[[{"node":"Get File Url","type":"main","index":0}],[{"node":"Incorrect format","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"Cancellation Agent - Backup","type":"ai_memory","index":0},{"node":"Cancellation Agent","type":"ai_memory","index":0}]]},"Update Ready?":{"main":[[{"node":"Update Event","type":"main","index":0}],[{"node":"Multiple Appointments","type":"main","index":0}]]},"check_events1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"list_services":{"ai_tool":[[{"node":"Booking Agent","type":"ai_tool","index":0},{"node":"Booking Agent - Backup","type":"ai_tool","index":0}]]},"Download Audio":{"main":[[{"node":"Transcribe Audio","type":"main","index":0}]]},"Download Image":{"main":[[{"node":"Analyze Image","type":"main","index":0}]]},"Simple Memory1":{"ai_memory":[[{"node":"General Inquiry - Backup","type":"ai_memory","index":0},{"node":"General Inquiry","type":"ai_memory","index":0}]]},"Simple Memory2":{"ai_memory":[[{"node":"Intent Recognition Agent","type":"ai_memory","index":0}]]},"Simple Memory6":{"ai_memory":[[{"node":"Booking Agent","type":"ai_memory","index":0},{"node":"Booking Agent - Backup","type":"ai_memory","index":0}]]},"list_services1":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"list_services2":{"ai_tool":[[{"node":"General Inquiry - Backup","type":"ai_tool","index":0},{"node":"General Inquiry","type":"ai_tool","index":0}]]},"list_services3":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"Fix JSON Output":{"main":[[{"node":"If","type":"main","index":0}]]},"General Inquiry":{"main":[[{"node":"Parse General Inquiry Output","type":"main","index":0}],[{"node":"General Inquiry - Backup","type":"main","index":0}]]},"Max Iterations?":{"main":[[{"node":"Fix JSON Output","type":"main","index":0}],[{"node":"Booking Agent - Backup","type":"main","index":0}]]},"Simple Memory10":{"ai_memory":[[{"node":"Update Agent","type":"ai_memory","index":0},{"node":"Update Agent - Backup","type":"ai_memory","index":0}]]},"Simple Memory11":{"ai_memory":[[{"node":"Intent Recognition Agent - Backup","type":"ai_memory","index":0}]]},"Combine Messages":{"main":[[{"node":"Package Data","type":"main","index":0}]]},"Detect Conflicts":{"main":[[{"node":"Format Alert Message","type":"main","index":0}]]},"Max Iterations?1":{"main":[[{"node":"Extract JSON from Cancellation Agent","type":"main","index":0}],[{"node":"Cancellation Agent - Backup","type":"main","index":0}]]},"Max Iterations?2":{"main":[[{"node":"Extract JSON from Agent","type":"main","index":0}],[{"node":"Update Agent - Backup","type":"main","index":0}]]},"Max Iterations?3":{"main":[[{"node":"Parse Intent JSON","type":"main","index":0}],[{"node":"Intent Recognition Agent - Backup","type":"main","index":0}]]},"Schedule Trigger":{"main":[[{"node":"Calculate Tomorrow","type":"main","index":0}]]},"Set Initial Data":{"main":[[{"node":"Is Audio Message?","type":"main","index":0}]]},"Transcribe Audio":{"main":[[{"node":"Audio","type":"main","index":0}]]},"WhatsApp Trigger":{"main":[[{"node":"Fetch Configuration","type":"main","index":0}]]},"get_appointments":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"set_appointments":{"ai_tool":[[{"node":"Update Agent","type":"ai_tool","index":0},{"node":"Update Agent - Backup","type":"ai_tool","index":0}]]},"Extract from File":{"main":[[{"node":"File","type":"main","index":0}]]},"Is Audio Message?":{"main":[[{"node":"Input type","type":"main","index":0}],[{"node":"Is User Text Message?","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Intent Recognition Agent - Backup","type":"ai_languageModel","index":0}]]},"Parse Intent JSON":{"main":[[{"node":"Switch Route","type":"main","index":0}]]},"Schedule Trigger1":{"main":[[{"node":"Get Calendar Events","type":"main","index":0}]]},"Send Confirmation":{"main":[[{"node":"Information to be Saved in Airtable1","type":"main","index":0}]]},"Send User Message":{"main":[[{"node":"Send Owner Message","type":"main","index":0}]]},"get_appointments1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"set_appointments1":{"ai_tool":[[{"node":"Cancellation Agent","type":"ai_tool","index":0},{"node":"Cancellation Agent - Backup","type":"ai_tool","index":0}]]},"Calculate Tomorrow":{"main":[[{"node":"Get Schedule Events","type":"main","index":0}]]},"Cancel Appointment":{"main":[[{"node":"Prepare Cancel Appointment1","type":"main","index":0}]]},"Cancellation Agent":{"main":[[{"node":"Max Iterations?1","type":"main","index":0}],[{"node":"Cancellation Agent - Backup","type":"main","index":0}]]},"Check Rate Limited":{"main":[[{"node":"Send Mesage?","type":"main","index":0}],[{"node":"Push","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Update Agent - Backup","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"General Inquiry - Backup","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model3":{"ai_languageModel":[[{"node":"Cancellation Agent - Backup","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model4":{"ai_languageModel":[[{"node":"Booking Agent","type":"ai_languageModel","index":0}]]},"Send Cancellation1":{"main":[[{"node":"Search Delete Record","type":"main","index":0}]]},"Send Owner Message":{"main":[[{"node":"Send Rate Limit Email","type":"main","index":0}]]},"check_availability":{"ai_tool":[[{"node":"Booking Agent","type":"ai_tool","index":0},{"node":"Booking Agent - Backup","type":"ai_tool","index":0}]]},"Am I the Processor?":{"main":[[{"node":"Pop All Batched Messages","type":"main","index":0}]]},"Delete Message List":{"main":[[{"node":"Delete Processing Lock","type":"main","index":0}]]},"Fetch Configuration":{"main":[[{"node":"Set Initial Data","type":"main","index":0}]]},"Get Calendar Events":{"main":[[{"node":"Get Airtable Bookings","type":"main","index":0}]]},"Get Schedule Events":{"main":[[{"node":"Format Reminder Data","type":"main","index":0}]]},"Notify Client Error":{"main":[[{"node":"Send Update Message","type":"main","index":0}]]},"Set Processing Lock":{"main":[[{"node":"Wait","type":"main","index":0}]]},"Format Alert Message":{"main":[[{"node":"Send WhatsApp Alert","type":"main","index":0},{"node":"Send Email Alert","type":"main","index":0}]]},"Format Reminder Data":{"main":[[{"node":"Search Schedule Events","type":"main","index":0}]]},"From audio to audio?":{"main":[[{"node":"Send message","type":"main","index":0}],[{"node":"Send message","type":"main","index":0}]]},"Notify Client Error2":{"main":[[{"node":"Send Booking Message","type":"main","index":0}]]},"Notify Client Error3":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Notify Client Error4":{"main":[[{"node":"Send General Message","type":"main","index":0}]]},"Notify Client Error5":{"main":[[{"node":"Send Booking Message","type":"main","index":0}]]},"Search Delete Record":{"main":[[{"node":"Cancel Appointment","type":"main","index":0}]]},"Send Update Message1":{"main":[[{"node":"Customer Confirmation Message","type":"main","index":0}]]},"Get Airtable Bookings":{"main":[[{"node":"Detect Conflicts","type":"main","index":0}]]},"Is User Text Message?":{"main":[[{"node":"Rate Limiter","type":"main","index":0}]]},"Multiple Appointments":{"main":[[{"node":"Send Update Message","type":"main","index":0}]]},"Update Agent - Backup":{"main":[[{"node":"Extract JSON from Agent","type":"main","index":0}],[{"node":"Send Error Notification","type":"main","index":0},{"node":"Notify Client Error","type":"main","index":0}]]},"Booking Agent - Backup":{"main":[[{"node":"Fix JSON Output","type":"main","index":0}],[{"node":"Send Error Notification2","type":"main","index":0},{"node":"Notify Client Error2","type":"main","index":0}]]},"Delete Processing Lock":{"main":[[{"node":"Combine Messages","type":"main","index":0}]]},"Fix mimeType for Audio":{"main":[[{"node":"Send audio","type":"main","index":0}]]},"Search Airtable Record":{"main":[[{"node":"Update Airtable Record","type":"main","index":0}]]},"Search Schedule Events":{"main":[[{"node":"Send Client Reminder","type":"main","index":0}]]},"Update Airtable Record":{"main":[[{"node":"Send Update Message1","type":"main","index":0}]]},"Extract JSON from Agent":{"main":[[{"node":"Update Ready?","type":"main","index":0}]]},"Generate Audio Response":{"main":[[{"node":"Fix mimeType for Audio","type":"main","index":0}]]},"Send File Warning Owner":{"main":[[{"node":"Send User Notification","type":"main","index":0}]]},"General Inquiry - Backup":{"main":[[{"node":"Parse General Inquiry Output","type":"main","index":0}],[{"node":"Notify Client Error4","type":"main","index":0},{"node":"Send Error Notification4","type":"main","index":0}]]},"Google Gemini Chat Model":{"ai_languageModel":[[{"node":"General Inquiry","type":"ai_languageModel","index":0}]]},"Increment Counter Hourly":{"main":[[{"node":"Check Limit","type":"main","index":0}]]},"Intent Recognition Agent":{"main":[[{"node":"Max Iterations?3","type":"main","index":0}],[{"node":"Intent Recognition Agent - Backup","type":"main","index":0}]]},"Pop All Batched Messages":{"main":[[{"node":"Delete Message List","type":"main","index":0}]]},"Send Error Notification3":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Send Media Warning Owner":{"main":[[{"node":"Send User Notification","type":"main","index":0}]]},"Google Gemini Chat Model1":{"ai_languageModel":[[{"node":"Intent Recognition Agent","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model3":{"ai_languageModel":[[{"node":"Booking Agent - Backup","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model8":{"ai_languageModel":[[{"node":"Update Agent","type":"ai_languageModel","index":0}]]},"Google Gemini Chat Model9":{"ai_languageModel":[[{"node":"Cancellation Agent","type":"ai_languageModel","index":0}]]},"get_customer_appointments":{"ai_tool":[[{"node":"General Inquiry","type":"ai_tool","index":0},{"node":"General Inquiry - Backup","type":"ai_tool","index":0}]]},"Parse Confirmation Message":{"main":[[{"node":"Send Booking Message","type":"main","index":0}]]},"Cancellation Agent - Backup":{"main":[[{"node":"Extract JSON from Cancellation Agent","type":"main","index":0}],[{"node":"Send Error Notification3","type":"main","index":0},{"node":"Notify Client Error3","type":"main","index":0}]]},"Get Current Processing Lock":{"main":[[{"node":"Am I the Processor?","type":"main","index":0}]]},"Prepare Cancel Appointment1":{"main":[[{"node":"Send Cancel Message","type":"main","index":0}]]},"Parse General Inquiry Output":{"main":[[{"node":"Send General Message","type":"main","index":0}]]},"Customer Confirmation Message":{"main":[[{"node":"Send Update Message","type":"main","index":0}]]},"Intent Recognition Agent - Backup":{"main":[[{"node":"Parse Intent JSON","type":"main","index":0}],[{"node":"Send Error Notification1","type":"main","index":0},{"node":"Notify Client","type":"main","index":0}]]},"Logs the confirmed booking details1":{"main":[[{"node":"Parse Confirmation Message","type":"main","index":0}]]},"Extract JSON from Cancellation Agent":{"main":[[{"node":"Delete Ready?","type":"main","index":0}]]},"Information to be Saved in Airtable1":{"main":[[{"node":"Logs the confirmed booking details1","type":"main","index":0}]]}}}


name: Complete Lesson Automation for Modern UK Teachers
author_name: Praveena
author_username: pankstr
categories: []
created_at: 2025-06-13T18:48:02.894Z
updated_at: 2025-06-13T18:48:02.894Z
url: https://n8n.io/workflows/4927
scraped_at: 2025-07-06 21:16:30
description:
  Why
  Teachers now spend 3-4 hours per lesson creating materials and resources from scratch. With additional/special needs, this makes it difficult to create additional materials. This is unsustainable and takes their time away from teaching. Tailored for UK teachers but can be expanded globally with prompt and form enhancements.

  How it works
  I built a system with three specialized AI agents that create complete lesson packages and automatically uploads a document in Google drive and puts an appointment in calendar to review the document.
  Features
  Research agent to pull specific information including special education needs and curriculums.
  The scoring and assessment agent to generate tailored assessment plans, assignments, grading mechanism based on chosen requirements.
  The integration agent just provides ideas to expand to other tools. In nfuture there is opportunity to add on Kahoot or other tools to create quizzes.
  Finally the enriched document is emailed and a calendar invite is sent for review. 

  What you need
  N8N
  Any LLM API Key (I used OpenAI)
  Google drive integration
  Google calendar integration
  Modify the email id from XXX@gmail.com to your Email id in email component.

  Support

  Watch this video for intro on how it works. 

  Contact me on info@pankstr.com for any queries.

nodes_used:
  ["n8n-nodes-base.googleDrive","n8n-nodes-base.googleCalendar","n8n-nodes-base.gmail","n8n-nodes-base.googleDocs","n8n-nodes-base.code","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.lmChatOpenAi"]

workflow_json:
  {"id":"iCyLAmwnvOo9R63Z","meta":{"instanceId":"5af6b2234d50083634d858a9090654bff0fe3d5b4cb29ef8dd19d1fb64ccdc27","templateCredsSetupCompleted":true},"name":"AILessonPlanGenerator_Teachers copy 2","tags":[{"id":"7I3feudDVEQN2O0v","name":"Modern Teaching","createdAt":"2025-06-12T20:19:55.602Z","updatedAt":"2025-06-12T20:19:55.602Z"}],"nodes":[{"id":"e6ed16c1-2381-4567-81c6-2fc6fe0cf241","name":"Teacher Input Form","type":"n8n-nodes-base.formTrigger","position":[-1220,-80],"webhookId":"modern-lesson-webhook-001","parameters":{"options":{"path":"webhook/modern-lesson-generator"},"formTitle":"Modern Teacher AI Assistant","formFields":{"values":[{"fieldType":"dropdown","fieldLabel":"Subject","fieldOptions":{"values":[{"option":"Mathematics"},{"option":"Science"},{"option":"English Language Arts"},{"option":"History"},{"option":"Geography"},{"option":"Modern Foreign Languages"}]}},{"fieldType":"dropdown","fieldLabel":"Year Group","fieldOptions":{"values":[{"option":"Year 7"},{"option":"Year 8"},{"option":"Year 9"},{"option":"Year 10"},{"option":"Year 11"}]}},{"fieldLabel":"Topic/Chapter","placeholder":"e.g., Linear Equations, Photosynthesis, Romeo and Juliet Act 1"},{"fieldType":"dropdown","fieldLabel":"Curriculum Standard","fieldOptions":{"values":[{"option":"UK National Curriculum"},{"option":"AQA GCSE"},{"option":"Edexcel GCSE"},{"option":"OCR GCSE"}]}},{"fieldType":"number","fieldLabel":"Lesson Duration (minutes)","placeholder":"60"},{"fieldType":"number","fieldLabel":"Class Size","placeholder":"28"},{"fieldLabel":"Differentiation Needs","placeholder":"e.g., 3 SEN students, 5 EAL learners, 2 gifted and talented"},{"fieldType":"dropdown","fieldLabel":"Assessment Focus","fieldOptions":{"values":[{"option":"Formative Assessment"},{"option":"Summative Assessment"},{"option":"Both"}]}}]},"formDescription":"Generate complete lesson resources without textbooks - including differentiated materials, assessments, and parent communication"},"typeVersion":2.2},{"id":"71c38ac7-59c1-4e2a-bb60-ffe85b6afc1d","name":"Content Creation Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-1000,-80],"parameters":{"text":"Help me create educational content for provided details.","options":{"systemMessage":"=You are a UK Educational Content Creation Agent specializing in comprehensive lesson planning for schools without textbooks.\n\nYour Role: Create complete, curriculum-aligned lesson packages that replace traditional textbook-based teaching.\n\nGenerate a comprehensive lesson package including:\n\n**LESSON STRUCTURE:**\n- Clear learning objectives aligned with {{ $json['Curriculum Standard'] }}\n- Detailed lesson plan for {{ $json['Lesson Duration (minutes)'] }} minutes\n- Starter activity (10 minutes)\n- Main teaching phases with multiple activities (40+ minutes)\n- Plenary and assessment (10 minutes)\n\n**DIFFERENTIATED MATERIALS:**\nFor class profile: {{ $json['Differentiation Needs'] }}\n- Core materials for mainstream students\n- Simplified worksheets with visual supports for SEN students\n- EAL-friendly resources with key vocabulary\n- Challenge activities and extension tasks for gifted students\n- Alternative formats (visual, kinesthetic, auditory)\n\n**ASSESSMENT PACKAGE:**\nFocus: {{ $json['Assessment Focus'] }}\n- Quick formative checks (mini-whiteboards, exit tickets)\n- Peer assessment activities with success criteria\n- Self-evaluation checklists\n- Summative assessment with mark scheme\n- Progress tracking sheets\n\n**RESOURCES WITHOUT TEXTBOOKS:**\n- Key information sheets (replacing textbook pages)\n- Interactive worksheets and activities\n- Real-world examples and case studies\n- Digital tool recommendations\n- Printable reference materials\n\n**PARENT SUPPORT MATERIALS:**\n- Home learning explanation sheet\n- Key concepts summary for parents\n- Extension activities for home\n- Vocabulary list with definitions\n\n**ADMINISTRATIVE EFFICIENCY:**\n- Marking codes and feedback templates\n- Behavior management strategies\n- Time-saving tips for implementation\n- Links to additional resources\n\nContext:\nSubject: {{ $json.Subject }}\nYear Group: {{ $json['Year Group'] }}\nTopic: {{ $json['Topic/Chapter'] }}\nClass Size: {{ $json['Class Size'] }}\n\nNo intros or outros.\nEnsure all content is practical, immediately usable, and addresses the modern challenge of teaching without textbooks."},"promptType":"define"},"typeVersion":1.6},{"id":"53898872-a5fc-495e-bc59-c8565c3a0f6d","name":"Assessment & Marking Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-624,-80],"parameters":{"text":"You are an Assessment & Feedback Automation Specialist for UK teachers.","options":{"systemMessage":"=You are an Assessment & Feedback Automation Specialist for UK teachers. Your mission is to create time-saving assessment tools that reduce marking workload.\n\n**ASSESSMENT PACKAGE CREATION:**\n\n**Quick Formative Assessments:**\n- 5 diagnostic questions with multiple choice auto-marking\n- Think-pair-share prompts with peer assessment rubrics\n- Exit ticket templates with self-marking answer keys\n- Mini-whiteboard question sets\n- Traffic light self-assessment cards\n\n**Efficient Summative Assessment:**\n- Topic test with detailed mark scheme\n- Practical task with step-by-step assessment criteria\n- Extended response question with exemplar answers\n- Grade boundaries and conversion charts\n\n**MARKING EFFICIENCY TOOLS:**\n- Whole-class feedback sheet templates\n- Common error identification codes\n- Quick feedback stamps/stickers system\n- Student self-correction checklists\n- Progress tracking spreadsheet templates\n\n**AUTOMATED FEEDBACK SYSTEMS:**\n- Response banks for common misconceptions\n- Differentiated feedback for ability levels\n- Next steps recommendations by learning objective\n- Parent communication templates\n- Intervention planning guides\n\n**TIME-SAVING STRATEGIES:**\n- Peer marking guides with answer sheets\n- Student-led assessment activities\n- Digital quiz templates for instant feedback\n- Voice feedback recording prompts\n- Batch marking techniques\n\nContext:\nSubject: {{ $('Teacher Input Form').item.json.Subject }}\nTopic: {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}\nYear Group: {{ $('Teacher Input Form').item.json['Year Group'] }}\nAssessment Focus: {{ $('Teacher Input Form').item.json['Assessment Focus'] }}\nClass Profile: {{ $('Teacher Input Form').item.json['Differentiation Needs'] }}\n\nLesson Content:\n{{ $('Content Creation Agent').item.json.output }}\n\nNo intros or outros.\n\nCreate practical, immediately implementable assessment tools that save marking time while maintaining quality feedback."},"promptType":"define"},"typeVersion":1.6},{"id":"48a92537-9a7e-4840-810a-f8920e739928","name":"AI Integration Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[-248,-80],"parameters":{"text":"Assist in teacher productivity","options":{"systemMessage":"=You are an AI Integration & Automation Specialist for UK teachers. Your role is to identify practical AI tools and automation workflows that reduce teacher workload.\n\n**TEACHER PRODUCTIVITY AUTOMATION:**\n\n**Content Creation Tools:**\n- AI worksheet generators (specific tool recommendations)\n- Automated quiz makers with curriculum alignment\n- Presentation slide generators\n- Differentiation material creators\n- Visual aid and infographic tools\n\n**Assessment Automation:**\n- Auto-grading quiz platforms (Google Forms, Kahoot, Quizizz)\n- Feedback generation tools\n- Progress tracking automation\n- Report writing assistants\n- Parent communication templates\n\n**Administrative Efficiency:**\n- Behavior log automation\n- Attendance tracking systems\n- Email template libraries\n- Calendar scheduling tools\n- Resource organization systems\n\n**STUDENT ENGAGEMENT AI:**\n\n**Interactive Learning Tools:**\n- AI tutoring assistants for {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}\n- Adaptive practice platforms\n- Gamified learning apps\n- Virtual laboratory simulations\n- Interactive presentation tools\n\n**Personalized Learning:**\n- Adaptive content delivery systems\n- Individual learning path generators\n- Skill gap analysis tools\n- Personalized homework assignments\n- Progress monitoring dashboards\n\n**IMPLEMENTATION GUIDES:**\n\n**Step-by-Step Setup:**\n- Tool selection criteria\n- Account setup instructions\n- Integration with existing systems\n- Training requirements\n- Cost-benefit analysis\n\n**Workflow Automation:**\n- Daily routine automation\n- Weekly planning systems\n- Assessment cycles\n- Parent communication schedules\n- Professional development tracking\n\n**TIME-SAVING CALCULATIONS:**\n- Hours saved per week\n- Efficiency improvements\n- Quality enhancements\n- Student engagement metrics\n\nContext:\nSubject: {{ $('Teacher Input Form').item.json.Subject }}\nYear Group: {{ $('Teacher Input Form').item.json['Year Group'] }}\nTopic: {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}\nClass Size: {{ $('Teacher Input Form').item.json['Class Size'] }}\n\nLesson Package:\n{{ $('Content Creation Agent').item.json.output }}\n\nAssessment Tools:\n{{ $('Assessment & Marking Agent').item.json.output }}\nNo intros or outros.\nProvide specific, actionable AI tool recommendations with implementation guidance that directly addresses current UK teacher workload challenges."},"promptType":"define"},"typeVersion":1.6},{"id":"641e1019-f56c-46f6-8d69-b803ccbdfe32","name":"Package Compiler","type":"n8n-nodes-base.code","position":[128,-80],"parameters":{"jsCode":"// Compile comprehensive teacher resource package\nconst formData = $('Teacher Input Form').item.json;\nconst lessonContent = $('Content Creation Agent').item.json.output;\nconst assessmentTools = $('Assessment & Marking Agent').item.json.output;\nconst aiRecommendations = $('AI Integration Agent').item.json.output;\n\nconst timestamp = new Date().toISOString();\nconst packageId = `lesson_${formData.Subject.toLowerCase().replace(/\\s+/g, '_')}_${formData['Year Group'].replace(/\\s+/g, '_')}_${Date.now()}`;\n\n// Extract key metrics and recommendations\nfunction extractTimeSavings(text) {\n  const timeMatches = text.match(/(\\d+)\\s*(hours?|minutes?|mins?).*?saved?/gi) || [];\n  return timeMatches.slice(0, 5);\n}\n\nfunction extractToolRecommendations(text) {\n  const tools = [];\n  const commonTools = [\n    'Google Forms', 'Kahoot', 'Quizizz', 'Padlet', 'Mentimeter',\n    'Canva', 'PowerPoint', 'Prezi', 'Flipgrid', 'Seesaw',\n    'ClassDojo', 'Google Classroom', 'Microsoft Teams', 'Zoom',\n    'Grammarly', 'ChatGPT', 'Claude', 'Bard', 'QuillBot'\n  ];\n  \n  commonTools.forEach(tool => {\n    if (text.toLowerCase().includes(tool.toLowerCase())) {\n      tools.push(tool);\n    }\n  });\n  \n  return [...new Set(tools)];\n}\n\n// Compile the complete package\nconst teacherPackage = {\n  metadata: {\n    package_id: packageId,\n    created_at: timestamp,\n    subject: formData.Subject,\n    year_group: formData['Year Group'],\n    topic: formData['Topic/Chapter'],\n    curriculum_standard: formData['Curriculum Standard'],\n    lesson_duration: formData['Lesson Duration (minutes)'],\n    class_size: formData['Class Size'],\n    differentiation_profile: formData['Differentiation Needs'],\n    assessment_focus: formData['Assessment Focus'],\n    package_type: 'comprehensive_modern_lesson'\n  },\n  \n  lesson_package: {\n    content: lessonContent,\n    type: 'textbook_replacement',\n    curriculum_aligned: true,\n    differentiation_included: true,\n    parent_support_included: true\n  },\n  \n  assessment_tools: {\n    content: assessmentTools,\n    marking_efficiency_focus: true,\n    automated_feedback_included: true,\n    time_saving_strategies: extractTimeSavings(assessmentTools)\n  },\n  \n  ai_automation: {\n    content: aiRecommendations,\n    recommended_tools: extractToolRecommendations(aiRecommendations),\n    implementation_ready: true,\n    workload_reduction_focus: true\n  },\n  \n  implementation_guide: {\n    immediate_actions: [\n      '1. Review complete lesson package and select appropriate differentiated materials',\n      '2. Print/prepare physical resources and set up digital tools',\n      '3. Familiarize yourself with assessment rubrics and marking codes',\n      '4. Set up recommended AI tools and automation workflows',\n      '5. Prepare parent communication materials'\n    ],\n    \n    time_management: {\n      preparation_time: '20-30 minutes (vs 2-3 hours traditional)',\n      marking_time_saved: '50-70% reduction with provided tools',\n      resource_creation: 'Pre-made materials eliminate creation time',\n      differentiation: 'All ability levels catered for automatically'\n    }\n  }\n};\n\nreturn { json: teacherPackage };"},"typeVersion":2},{"id":"2aa1892f-ec0a-4539-af83-ef146e2856b4","name":"Format Document","type":"n8n-nodes-base.code","position":[348,-80],"parameters":{"jsCode":"const packageData = $('Package Compiler').item.json;\n\n// Create comprehensive markdown document\nlet markdown = `# Modern Lesson Package: ${packageData.metadata.topic}\\n\\n`;\nmarkdown += `**Subject:** ${packageData.metadata.subject}\\n`;\nmarkdown += `**Year Group:** ${packageData.metadata.year_group}\\n`;\nmarkdown += `**Duration:** ${packageData.metadata.lesson_duration} minutes\\n`;\nmarkdown += `**Curriculum:** ${packageData.metadata.curriculum_standard}\\n\\n`;\n\nmarkdown += `## 📚 Complete Lesson Package\\n\\n`;\nmarkdown += packageData.lesson_package.content + '\\n\\n';\n\nmarkdown += `## 📊 Assessment & Marking Tools\\n\\n`;\nmarkdown += packageData.assessment_tools.content + '\\n\\n';\n\nmarkdown += `## 🤖 AI Integration Recommendations\\n\\n`;\nmarkdown += packageData.ai_automation.content + '\\n\\n';\n\nreturn [{ json: { markdown, package_id: packageData.metadata.package_id } }];"},"typeVersion":2},{"id":"dda48f8f-9079-4502-8c44-e901f1c09dde","name":"Create Google Doc","type":"n8n-nodes-base.googleDocs","position":[568,-80],"parameters":{"title":"=Modern Lesson: {{ $('Teacher Input Form').item.json.Subject }} - {{ $('Teacher Input Form').item.json['Topic/Chapter'] }} - {{ $('Teacher Input Form').item.json['Year Group'] }}","folderId":"1XZhfUccXBWrmzc63Qh0giiy0atLclDGv","authentication":"oAuth2"},"credentials":{"googleDocsOAuth2Api":{"id":"HkXEaWnb07UPafh4","name":"Google Docs account"}},"typeVersion":1},{"id":"43c0d073-d80d-4b9a-b572-26905b5534de","name":"Add Content to Doc","type":"n8n-nodes-base.googleDocs","position":[788,-80],"parameters":{"actionsUi":{"actionFields":[{"text":"={{ $('Format Document').item.json.markdown }}","action":"insert"}]},"operation":"update","documentURL":"={{ $('Create Google Doc').item.json.id }}","authentication":"oAuth2"},"credentials":{"googleDocsOAuth2Api":{"id":"HkXEaWnb07UPafh4","name":"Google Docs account"}},"typeVersion":1},{"id":"89061422-06ab-4844-8792-0946e9b22118","name":"Schedule Prep Reminder","type":"n8n-nodes-base.googleCalendar","position":[1008,20],"parameters":{"end":"={{ DateTime.now().plus({days: 1}).set({hour: 8, minute: 30}).toISO() }}","start":"={{ DateTime.now().plus({days: 1}).set({hour: 8, minute: 0}).toISO() }}","calendar":{"__rl":true,"mode":"list","value":"primary"},"additionalFields":{"location":"Staffroom","description":"=Review and prepare the AI-generated lesson package."}},"credentials":{"googleCalendarOAuth2Api":{"id":"oBBgT8vkZewn9Znd","name":"Google Calendar account"}},"typeVersion":1},{"id":"cde4f9c1-5908-4c1f-b96f-432303c633bc","name":"Send Confirmation Email","type":"n8n-nodes-base.gmail","position":[1228,-180],"webhookId":"9cce7514-59d4-4abf-8ecc-705e82ff0ac9","parameters":{"sendTo":"XXX@gmail.com","message":"=<h2>🎓 Your Modern Lesson Package is Ready!</h2>\\n<p><strong>Subject:</strong> {{ $('Teacher Input Form').item.json.Subject }}</p>\\n<p><strong>Document:</strong> <a href='{{ $json.webViewLink }}'>View Lesson Package</a></p>\\n<p>Time saved: 95% reduction in preparation time!</p>","options":{},"subject":"=Your AI Lesson Package is Ready: {{ $('Teacher Input Form').item.json['Topic/Chapter'] }}"},"credentials":{"gmailOAuth2":{"id":"igrJbpDgv7Y6QNxA","name":"Gmail account"}},"typeVersion":2.1},{"id":"2e768ee7-2c14-4165-bfd8-904fc97bdf21","name":"OpenAI Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-912,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"6O9ruA8TUMzJAIRD","name":"OpenAi account"}},"typeVersion":1.2},{"id":"8522d400-0aaf-4c10-b66b-2cdab9d72ed3","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-536,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"6O9ruA8TUMzJAIRD","name":"OpenAi account"}},"typeVersion":1.2},{"id":"fef58dce-7690-430a-82ee-f646180e34ba","name":"OpenAI Chat Model2","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[-160,140],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"6O9ruA8TUMzJAIRD","name":"OpenAi account"}},"typeVersion":1.2},{"id":"95271c6e-d4ec-4082-9576-c2f5915bcb0a","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-1020,-320],"parameters":{"width":1060,"height":740,"content":"## 1. AI Lesson Plan, Assignment and Integration Agent Trio\n\n### Each agent with specialised prompt to do research, build resources and suggest integration ideas."},"typeVersion":1},{"id":"ba08f325-b54e-420b-bb61-cd45e1f500e8","name":"Sticky Note2","type":"n8n-nodes-base.stickyNote","position":[60,-300],"parameters":{"color":5,"width":860,"height":720,"content":"## 2. Compile \n### And create a document in Google Drive"},"typeVersion":1},{"id":"d5ee98cc-f810-4cc2-a96e-e9be95fb5f0c","name":"Sticky Note3","type":"n8n-nodes-base.stickyNote","position":[940,-300],"parameters":{"color":4,"width":580,"height":720,"content":"## 3. Share\n### Create Calendar event for review\n### Email the Google Drive Link"},"typeVersion":1},{"id":"d2ffe355-de47-4a96-a2aa-744485c9a25e","name":"Fetch File From Drive","type":"n8n-nodes-base.googleDrive","position":[1008,-180],"parameters":{"filter":{},"options":{"fields":["webViewLink","exportLinks"]},"resource":"fileFolder","queryString":"={{ $('Create Google Doc').item.json.name }}"},"credentials":{"googleDriveOAuth2Api":{"id":"a5ILqHcHS6QthVoc","name":"Google Drive account"}},"typeVersion":3}],"active":false,"pinData":{},"settings":{"executionOrder":"v1"},"versionId":"21abc644-201a-48bc-8ff5-1a29775e2bdd","connections":{"Format Document":{"main":[[{"node":"Create Google Doc","type":"main","index":0}]]},"Package Compiler":{"main":[[{"node":"Format Document","type":"main","index":0}]]},"Create Google Doc":{"main":[[{"node":"Add Content to Doc","type":"main","index":0}]]},"OpenAI Chat Model":{"ai_languageModel":[[{"node":"Content Creation Agent","type":"ai_languageModel","index":0}]]},"Add Content to Doc":{"main":[[{"node":"Fetch File From Drive","type":"main","index":0},{"node":"Schedule Prep Reminder","type":"main","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Assessment & Marking Agent","type":"ai_languageModel","index":0}]]},"OpenAI Chat Model2":{"ai_languageModel":[[{"node":"AI Integration Agent","type":"ai_languageModel","index":0}]]},"Teacher Input Form":{"main":[[{"node":"Content Creation Agent","type":"main","index":0}]]},"AI Integration Agent":{"main":[[{"node":"Package Compiler","type":"main","index":0}]]},"Fetch File From Drive":{"main":[[{"node":"Send Confirmation Email","type":"main","index":0}]]},"Content Creation Agent":{"main":[[{"node":"Assessment & Marking Agent","type":"main","index":0}]]},"Assessment & Marking Agent":{"main":[[{"node":"AI Integration Agent","type":"main","index":0}]]}}}


name: Control Your n8n Instance Remotely with Telegram Bot Commands
author_name: Arthur Braghetto
author_username: arthurmb
nodes_used: ["n8n-nodes-base.telegram","n8n-nodes-base.code"]
categories: []
created_at: 2025-06-13T21:22:51.292Z
updated_at: 2025-06-13T21:22:51.292Z
url: https://n8n.io/workflows/4928
scraped_at: 2025-07-06 21:16:30
description:
  This workflow contains community nodes that are only compatible with the self-hosted version of n8n.

  Your n8n Command Center in a Telegram Chat
  Remotely manage and operate your n8n instance from Telegram with powerful admin commands.

  This workflow connects your n8n instance with a Telegram Bot, giving you remote control over key admin operations through simple chat commands.

  📱 You can

  List your workflows (workflows)

  Execute a workflow (execute [name])

  Activate/deactivate workflows (activate [name], deactivate [name])

  List past executions (executions [name])

  Permanently delete archived workflows (cleanup)

  Create backups of all your workflows and credentials (backup)

  Get help (help)

  Get notified when a workflow fails and when n8n instance starts.


  This is especially useful for self-hosted instances when you want quick access to your automation environment from your mobile device.

  📌 Notes

  backup** only works on self-hosted setups.
  execute, **activate, deactivate, and executions require the workflow name as argument.
  Workflows must contain the appropriate trigger nodes to be executed or activated.
  Commands and arguments are not case sensitive, there is no need to prefix with slash and spaces in the argument name are supported.

  ⚙️ Setup
  Create your credentials for Telegram API and n8n API.
  Edit all Telegram and n8n nodes. Select your credentials on them. On telegram nodes provide your chatid.
  Detailed step-by-step instructions are available in the workflow notes.
  In each workflow that fails and you want to receive a warning, configure this workflow as Error Workflow in its settings.

workflow_json:
  {"id":"oPfjCB6LU7nwNRiu","meta":{"instanceId":"7e84375f1a5a2398bff60c3e83bb370423dae55c261ed7c48ca02f15548655a7","templateCredsSetupCompleted":true},"name":"Telegram-n8n-Commander","tags":[],"nodes":[{"id":"7e8112a5-41a0-4e2e-b2ee-bef7b4a2a2c0","name":"Telegram Trigger","type":"n8n-nodes-base.telegramTrigger","position":[40,-180],"webhookId":"0eea20d1-fab3-416e-8f22-6f975f79650b","parameters":{"updates":["message"],"additionalFields":{"chatIds":"123456789","userIds":"123456789"}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"2ea34661-3183-4e5b-876b-7d823b15b6e2","name":"Cmd Parse","type":"n8n-nodes-base.set","position":[260,-180],"parameters":{"options":{},"assignments":{"assignments":[{"id":"ce8eebdd-c313-4444-a1bd-dcde56619a0d","name":"command","type":"string","value":"={{\n  $json.message.text\n    .toLowerCase()\n    .replace(/^\\//, '')\n    .split(/ (.+)/)[0]\n  || ''\n}}"},{"id":"834f7369-52f1-4df3-bfcb-754be0bb11e0","name":"arg1","type":"string","value":"={{\n  $json.message.text\n    .toLowerCase()\n    .replace(/^\\//, '')\n    .split(/ (.+)/)[1]\n  || ''\n}}"}]}},"typeVersion":3.4},{"id":"ac92629e-1a7c-45ed-88e5-cb399ccb97fd","name":"Cmd Switch","type":"n8n-nodes-base.switch","position":[480,-320],"parameters":{"rules":{"values":[{"outputKey":"start","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d5b702ed-dcaf-461a-a148-04b231d55617","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"start"}]},"renameOutput":true},{"outputKey":"help","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e9ac521f-9416-4756-9f3c-9be5dd5a5ccb","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"help"}]},"renameOutput":true},{"outputKey":"backup","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"e20bdf17-2418-43ad-8b37-a4a5f4e46b2a","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"backup"}]},"renameOutput":true},{"outputKey":"cleanup","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"b1dfbc98-aac0-483c-a386-79180e96d0bb","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"cleanup"}]},"renameOutput":true},{"outputKey":"workflows","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"2524d410-a971-4a1f-b8a1-c30d363c6be6","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"workflows"}]},"renameOutput":true},{"outputKey":"execute","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"a27bd761-d2d6-4768-9449-ca5380db38ce","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"execute"}]},"renameOutput":true},{"outputKey":"activate","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"593d46f5-40ce-468a-b834-c2376dca1684","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"activate"}]},"renameOutput":true},{"outputKey":"deactivate","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"0ff85afd-02f8-42ad-b892-59b3dcf025a9","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"deactivate"}]},"renameOutput":true},{"outputKey":"executions","conditions":{"options":{"version":2,"leftValue":"","caseSensitive":false,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"f5dee847-2c55-427f-a1f9-3f038f19e30e","operator":{"name":"filter.operator.equals","type":"string","operation":"equals"},"leftValue":"={{ $('Cmd Parse').item.json.command }}","rightValue":"executions"}]},"renameOutput":true}]},"options":{"ignoreCase":true,"fallbackOutput":"extra","renameFallbackOutput":"Error"}},"executeOnce":false,"typeVersion":3.2},{"id":"3982240a-01cf-4e67-b342-3d93db95823e","name":"Execute Arg","type":"n8n-nodes-base.if","position":[840,-160],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"89cd3673-334b-48dd-9a7c-cf75fb057731","name":"Activate Workflow","type":"n8n-nodes-base.n8n","onError":"continueErrorOutput","position":[2440,20],"parameters":{"operation":"activate","workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1},{"id":"21192505-acee-40cf-9919-f45ad47889d1","name":"Deactivate Workflow","type":"n8n-nodes-base.n8n","onError":"continueErrorOutput","position":[2440,200],"parameters":{"operation":"deactivate","workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1},{"id":"c20275b8-d100-4337-8c3e-4a14753a65e0","name":"Activate Arg","type":"n8n-nodes-base.if","position":[840,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"0b7ae6dc-20bf-49ef-80cc-811f9c403654","name":"Deactivate Arg","type":"n8n-nodes-base.if","position":[840,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"16672e7a-0c6d-4c16-b908-de68ce41d686","name":"Arg Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1140,660],"webhookId":"d1b9cd05-5507-45aa-8ee8-5c19eccfc76d","parameters":{"text":"=❌ This command requires an argument!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"f512c74c-e552-472f-ba4f-aa02a4bed45c","name":"Cmd Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[840,660],"webhookId":"033ee218-b4e1-420b-bf73-592029ba53a1","parameters":{"text":"=❌ Invalid command!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"409139e8-69b0-48c9-9e79-0d46a3f8b538","name":"Executed","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-160],"webhookId":"93483e2c-71d5-4733-9572-b205551fff74","parameters":{"text":"=✅ Workflow executed.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"a3065a7d-3306-46a4-948f-2b055ed7705b","name":"Activated","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,20],"webhookId":"a26128ae-81be-4d1a-bf6d-bf38ef54816b","parameters":{"text":"=✅ Workflow activated.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"8fb19383-e6de-4f59-a780-11c8092a9240","name":"Deactivated","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,200],"webhookId":"51e51fa0-93b9-4c39-8896-f9d72df898e4","parameters":{"text":"=✅ Workflow deactivated.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"4dba4e0e-e012-4cbf-8a44-aadb0e27240a","name":"Workflow Name Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1920,660],"webhookId":"76b885b4-302a-4033-89f5-2e3b5c9f6f8c","parameters":{"text":"=❌ Workflow name not found!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"executeOnce":true,"typeVersion":1.2},{"id":"b9aec466-d089-443c-b282-4c1892eebc32","name":"List Workflows 1","type":"n8n-nodes-base.n8n","position":[1140,-160],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"773f2140-a5c9-4744-9874-92fb3da5c7c8","name":"List Workflows 2","type":"n8n-nodes-base.n8n","position":[1140,20],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"e752a9b4-dda9-4ed9-be63-8c47f376fabe","name":"List Workflows 3","type":"n8n-nodes-base.n8n","position":[1140,200],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"efb0a48f-5ab8-4e2a-afc4-8508f557e3f6","name":"If Inactive","type":"n8n-nodes-base.if","position":[1920,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"43882ae1-cf25-46d2-9702-7035590b517c","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.active }}","rightValue":""}]}},"typeVersion":2.2},{"id":"b4392db6-84e2-46c5-9e0b-0d8aae707e05","name":"If Active","type":"n8n-nodes-base.if","position":[1920,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"43882ae1-cf25-46d2-9702-7035590b517c","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.active }}","rightValue":""}]}},"typeVersion":2.2},{"id":"3f700f24-d9fb-4e9d-81b9-51941dbd865f","name":"Workflow Active Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2220,660],"webhookId":"0d7e6070-983e-47c1-8713-39359d6a41db","parameters":{"text":"=❌ Workflow is already active!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"executeOnce":true,"typeVersion":1.2},{"id":"a078cf85-7ae3-41ca-8707-ea2732ebc683","name":"Workflow Inactive Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2220,840],"webhookId":"be3c092d-c053-4d15-9c64-4f8bb38ddf5c","parameters":{"text":"=❌ Workflow is already inactive!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"executeOnce":true,"typeVersion":1.2},{"id":"0d111278-5067-4340-933f-8aca588fd880","name":"List Workflows ","type":"n8n-nodes-base.n8n","position":[840,-340],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1,"alwaysOutputData":true},{"id":"39d952ee-0a7e-4c3b-b5a1-1e2a27dd8abc","name":"Help","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[840,-900],"webhookId":"2f993ec0-a72e-4bf3-a5c0-8d31742d80e1","parameters":{"text":"=My commands are:\n\n\n➖ help\nList of commands.\n\n➖ cleanup\nDeletes all archived workflows.\n\n➖ backup\nBackup workflows and credentials.\n\n➖ workflows\nList all workflows.\n\n➖ execute <workflow-name>\nExecute a workflow.\n\n➖ activate <workflow-name>\nActivate a workflow.\n\n➖ deactivate <workflow-name>\nDeactivate a workflow.\n\n➖ executions <workflow-name>\nList last executions.\n\n\n💡 To execute a workflow, it must have a trigger node of type \"When Executed by Another Workflow\". To activate a workflow, it must have a trigger node that supports activation.","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"eb4ef3de-ac0d-4387-9066-3d5297409158","name":"Workflow List","type":"n8n-nodes-base.set","position":[1380,-340],"parameters":{"options":{},"assignments":{"assignments":[{"id":"43a779d0-acf5-49d8-920a-590af435b7d1","name":"name","type":"string","value":"={{ $json.name }}"},{"id":"09a74ca9-26fe-490f-b4db-c9c40200e2a5","name":"active","type":"boolean","value":"={{ $json.active }}"}]}},"typeVersion":3.4,"alwaysOutputData":true},{"id":"b9153d0c-24fe-44d7-9d6a-ad4f235d304c","name":"Workflows","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-340],"webhookId":"5ae7f6bf-d7b9-4f2a-8a99-2b93109779ff","parameters":{"text":"={{ $json.msg }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"02e0030f-743f-4491-bf86-c5c39e4db4ba","name":"Workflow Found 1","type":"n8n-nodes-base.if","position":[1620,-160],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"6dd81360-e878-4ee3-b73f-8f078824f536","name":"Workflow Found 2","type":"n8n-nodes-base.if","position":[1620,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"4c2aad63-9d8a-4f45-8633-92b9742b0029","name":"Workflow Found 3","type":"n8n-nodes-base.if","position":[1620,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"bdce9b81-d4a0-4be3-9abe-df48b2e8d633","name":"Not Archived","type":"n8n-nodes-base.filter","position":[1140,-340],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"075dd1e2-2580-4016-ba11-3b271049a718","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"2fb0bf45-2f2f-4c3a-a6ef-4077c5f1a0de","name":"Find Workflow 1","type":"n8n-nodes-base.filter","position":[1380,-160],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Execute Arg').item.json.arg1 }}"},{"id":"83bc1669-a58f-45c9-a6f3-4d3a94d72fa5","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"e6532b4b-5791-4469-add8-49a23076d63e","name":"Find Workflow 2","type":"n8n-nodes-base.filter","position":[1380,20],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Activate Arg').item.json.arg1 }}"},{"id":"ca761ff5-d7ac-4c11-b844-c10d34062fc4","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"17f4b9aa-c855-4a40-9364-3c71db43c48c","name":"Find Workflow 3","type":"n8n-nodes-base.filter","position":[1380,200],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Deactivate Arg').item.json.arg1 }}"},{"id":"6eec9d79-2ad2-40af-8baf-38ab772f6f0b","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"6b8abadf-6bbf-4332-bd95-c1f2b8b29e62","name":"Executions Arg","type":"n8n-nodes-base.if","position":[840,380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"d760c8fa-65bc-4ef5-a0b0-9bf1ef711db6","operator":{"type":"string","operation":"notEmpty","singleValue":true},"leftValue":"={{ $('Cmd Parse').item.json.arg1 }}","rightValue":"="}]}},"typeVersion":2.2},{"id":"3ee440a3-db15-4398-b337-246dccda4032","name":"List Workflows 4","type":"n8n-nodes-base.n8n","position":[1140,380],"parameters":{"filters":{},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1},{"id":"8391a4ec-b382-4062-92b5-0e174c606fd5","name":"Find Workflow 4","type":"n8n-nodes-base.filter","position":[1380,380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"278fa2d1-3d8a-48b3-b898-0d81779bcb11","operator":{"type":"string","operation":"equals"},"leftValue":"={{ $json.name.toLowerCase() }}","rightValue":"={{ $('Executions Arg').item.json.arg1 }}"},{"id":"6eec9d79-2ad2-40af-8baf-38ab772f6f0b","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"e6f15777-a0d8-4f2b-a086-f97887b1844a","name":"Workflow Found 4","type":"n8n-nodes-base.if","position":[1620,380],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"18dab2ca-c722-4d2f-8d91-f24a12e28d91","operator":{"type":"boolean","operation":"false","singleValue":true},"leftValue":"={{ $json.isEmpty() }}","rightValue":""}]}},"typeVersion":2.2},{"id":"1527438a-4600-4255-9034-0e5af7bd5581","name":"List Workflow Executions","type":"n8n-nodes-base.n8n","position":[1920,380],"parameters":{"limit":50,"filters":{"workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"}},"options":{},"resource":"execution","requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1,"alwaysOutputData":true},{"id":"d9d7c222-ea4c-412a-98da-cd35f86f10f2","name":"Executions Fields","type":"n8n-nodes-base.set","position":[2220,380],"parameters":{"options":{},"assignments":{"assignments":[{"id":"0ec10b59-a57e-4b6d-a13a-9d2674fb39b3","name":"id","type":"string","value":"={{ $json.id }}"},{"id":"18038ae8-3a18-4c6b-b97a-1f222bbe2547","name":"mode","type":"string","value":"={{ $json.mode }}"},{"id":"90484316-e73a-41ff-9cb0-dbdfeaf6da11","name":"started","type":"string","value":"={{ $json.startedAt?.toDateTime().toLocal().format(\"dd/MM/yyyy HH:mm\") }}"},{"id":"a56880cb-3c81-48fc-bd96-ec018e43ec5e","name":"workflow","type":"string","value":"={{ $('Workflow Found 4').item.json.name }}"},{"id":"d89a11d0-2abd-4fad-ba64-510e9d922158","name":"finished","type":"boolean","value":"={{ $json.finished }}"}]}},"typeVersion":3.4,"alwaysOutputData":true},{"id":"589ffd48-f9d6-464d-93ff-a0bed5ccf528","name":"Executions","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,380],"webhookId":"43b75945-8442-4e0a-b848-afae7a4d0d35","parameters":{"text":"={{ $json.msg }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"00bf4b6a-ec2f-4adb-a14c-38bafe69d7f2","name":"Executions Message","type":"n8n-nodes-base.code","position":[2440,380],"parameters":{"jsCode":"let msg = \"Executions:\\n\\n\"\nif ($input.first().json.id === null) {\n  return {\n    json: {\n      msg: \"No executions.\"\n    }\n  }\n}\nfor (const item of $input.all()) {\n  let status = item.json.finished ? '✅' : '❌'\n  let mode = item.json.mode === 'manual' ? ' (manual)' : ''\n  msg = msg + (status + \" \" + item.json.workflow + \" - \" + item.json.id + \" - \" + item.json.started + mode + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"},"typeVersion":2},{"id":"ec1c2591-4733-4057-9b0c-066b48514df8","name":"Workflows Message","type":"n8n-nodes-base.code","position":[2440,-340],"parameters":{"jsCode":"let msg = \"Workflows:\\n\\n\"\nif ($input.first().json.name === null) {\n  return {\n    json: {\n      msg: \"No workflows.\"\n    }\n  }\n}\nfor (const item of $input.all()) {\n  let status = item.json.active ? '🟢' : '⚫'\n  msg = msg + (status + \"  \" + item.json.name + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"},"typeVersion":2},{"id":"003b5a55-64e4-4cf6-9f8a-8cf94a8e515b","name":"Execute Workflow","type":"n8n-nodes-base.executeWorkflow","onError":"continueErrorOutput","position":[2440,-160],"parameters":{"options":{},"workflowId":{"__rl":true,"mode":"id","value":"={{ $json.id }}","cachedResultName":"={{ $json.id }}"},"workflowInputs":{"value":{},"schema":[],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":true}},"typeVersion":1.2},{"id":"9687696c-62ec-4df1-a693-2da19675e6f1","name":"Execution Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,840],"webhookId":"8a5b39fb-80d6-474f-810a-7d3151647e8c","parameters":{"text":"=❌ Workflow execution failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"6af5662a-61dc-430c-8508-d910b2dc5617","name":"Activation Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,1020],"webhookId":"b38649fe-98bf-4b71-80cd-e800952e95b2","parameters":{"text":"=❌ Workflow activation failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"77ab60c5-a1ef-4db7-8432-aece8a15ff17","name":"Deactivation Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,1200],"webhookId":"516b2616-387f-4059-881c-1f41fe8a54de","parameters":{"text":"=❌ Workflow deactivation failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"d969f0a8-3589-4087-87b6-9404fec6a231","name":"List Archived","type":"n8n-nodes-base.n8n","position":[840,-520],"parameters":{"filters":{"activeWorkflows":false},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"executeOnce":true,"typeVersion":1,"alwaysOutputData":true},{"id":"ef67572a-b733-4c5b-9783-a71638ebc597","name":"Only Archived","type":"n8n-nodes-base.filter","position":[1140,-520],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"075dd1e2-2580-4016-ba11-3b271049a718","operator":{"type":"boolean","operation":"true","singleValue":true},"leftValue":"={{ $json.isArchived }}","rightValue":""}]}},"typeVersion":2.2,"alwaysOutputData":true},{"id":"937ee3d9-3604-454b-86f6-ab069bdc3caf","name":"Archived Message","type":"n8n-nodes-base.code","position":[2440,-520],"parameters":{"jsCode":"let msg = \"Archived Workflows Deleted:\\n\\n\"\nif ($('Archived List').first().json.name === null) {\n  return {\n    json: {\n      msg: \"No archived workflows.\"\n    }\n  }\n}\nfor (const item of $('Archived List').all()) {\n  msg = msg + (\"🗑\" + \"  \" + item.json.name + \"\\n\")\n}\nreturn {\n  json: {\n    msg: msg\n  }\n}"},"typeVersion":2},{"id":"d344e304-fb23-4d2f-8bec-def3cab224e9","name":"Cleanup","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-520],"webhookId":"a48ea4b2-39a4-44d5-be6f-97c0029d9f3b","parameters":{"text":"={{ $('Archived Message').item.json.msg }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"f9dfff04-c969-4198-b541-9f7f1d00fd2c","name":"Archived List","type":"n8n-nodes-base.set","position":[1380,-520],"parameters":{"options":{},"assignments":{"assignments":[{"id":"c0da97ee-d423-48a7-8c79-58c43969a539","name":"name","type":"string","value":"={{ $json.name }}"},{"id":"cba865ac-9909-4a1a-a6ae-58958135920c","name":"id","type":"string","value":"={{ $json.id }}"}]}},"typeVersion":3.4,"alwaysOutputData":true},{"id":"b21a04cc-93d2-418f-84d3-e1b48c3b3e8d","name":"Delete Archived","type":"n8n-nodes-base.n8n","onError":"continueRegularOutput","position":[1620,-520],"parameters":{"operation":"delete","workflowId":{"__rl":true,"mode":"id","value":"={{ $('Archived List').item.json.id }}"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1,"alwaysOutputData":true},{"id":"fa38c779-7c83-442b-a5d0-7b69890abab9","name":"Backup Workflows","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[840,-700],"parameters":{"command":"n8n export:workflow --backup --output=/home/node/backup/workflows"},"typeVersion":1,"alwaysOutputData":false},{"id":"0313329a-6d7a-41fa-a34c-7267f20a1e60","name":"Backup Credentials","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[1140,-700],"parameters":{"command":"n8n export:credentials --backup --decrypted --output=/home/node/backup/credentials"},"typeVersion":1,"alwaysOutputData":false},{"id":"153ce344-c050-4ff9-a012-d69e7b80006d","name":"Backup Tarball","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[1380,-700],"parameters":{"command":"tar -czf /home/node/backup.tar.gz -C /home/node/backup workflows credentials"},"typeVersion":1,"alwaysOutputData":false},{"id":"91b1718a-197e-409d-b564-0618d271bb6b","name":"Backup","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,-700],"webhookId":"abecda49-24f5-4928-b98a-c4d850d0d2d6","parameters":{"chatId":"123456789","operation":"sendDocument","binaryData":true,"additionalFields":{"fileName":"backup.tar.gz"}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"dd089984-95f3-4093-8a42-679534411186","name":"Cleanup Files","type":"n8n-nodes-base.executeCommand","onError":"continueRegularOutput","position":[2740,-860],"parameters":{"command":"rm -rf /home/node/backup /home/node/backup.tar.gz"},"typeVersion":1},{"id":"62dc0a94-036e-4872-b571-9e850dcb29c7","name":"Read File","type":"n8n-nodes-base.readWriteFile","onError":"continueErrorOutput","position":[2440,-700],"parameters":{"options":{},"fileSelector":"/home/node/backup.tar.gz"},"typeVersion":1},{"id":"f715531e-cd42-41c3-92c7-4a6d9230f84c","name":"Backup Error","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[2740,660],"webhookId":"4c62b914-7d68-4520-bd82-0d169d1d84fa","parameters":{"text":"=❌ Backup failed!","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"0d647969-f6e8-4e48-86dd-a359a1797609","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[-100,-1280],"parameters":{"width":680,"height":940,"content":"# Telegram n8n Commander\nRemotely manage and operate your n8n instance from Telegram with powerful admin commands.\n\nThis workflow connects your n8n instance with a Telegram Bot, giving you remote control over key admin operations through simple chat commands.\n\n## Commands\n- List your workflows (**workflows**)\n\n- Execute a workflow (**execute** [name])\n\n- Activate/deactivate workflows (**activate** [name], **deactivate** [name])\n\n- List past executions (**executions** [name])\n\n- Permanently delete archived workflows (**cleanup**)\n\n- Create backups of all your workflows and credentials (**backup**)\n\n- Get help (**help**)\n\n- Get notified when a workflow fails and when n8n instance starts.\n\n## Notes\n- **execute**, **activate**, **deactivate**, and **executions** require the workflow name as argument.\n\n- To **execute** a workflow, it must have a trigger node of type \"When Executed by Another Workflow\".\n\n- To **activate** a workflow, it must have a trigger node that supports activation.\n\n- **backup** only works on self-hosted setups.\n\n- Your credentials will be decrypted in the backup file. Please take security precautions when using this file.\n\n- In each workflow that fails and you want to receive a warning, configure this workflow as Error Workflow in its settings.\n\n\n\n*(See the Setup note for instructions on how to set up this workflow.)*"},"typeVersion":1},{"id":"2b6e98a5-1197-4d5c-b589-220bce2ecd3e","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[-100,140],"parameters":{"width":680,"height":1260,"content":"# Setup\nTo set up this workflow you will need credentials for your Telegram bot and for your n8n API. You will need to edit all Telegram Nodes and n8n Nodes.\n\n## Credentials\nFirst of all, let's create the necessary credentials.\nYou can see instructions on how to create credentials [here.](https://docs.n8n.io/credentials/)\n\n### n8n API\n- Go to your n8n settings, in the sidebar go to n8n API.\n- Click on the Create an API Key button. Then you must give the key a name and save it. Your key will only be displayed at this point; copy it for the next steps.\n- Now we can create a credential for the n8n nodes. Create a new n8n API credential and use the key we just created. You will need to configure your server address as well.\n\n### Telegram Bot\n- First you need to have a Telegram bot and its token.\n- In your Telegram application, start a conversation with @BotFather and send him the command /newbot, follow the steps and then he will create your bot and present your token.\n- You will also need your Telegram user's ChatID/UserID. This way we can protect this workflow so that it only responds to you on Telegram. You can use @userinfobot for this, see instructions [here.](https://bigone.zendesk.com/hc/en-us/articles/360008014894-How-to-get-the-Telegram-user-ID#:~:text=1.,The%20Number%20ID)\n- Now in your n8n create a Telegram API type credential using your bot's token.\n\n## Nodes\nNow you have what you need to configure the nodes for this workflow.\n\n### n8n Nodes\n\n\n\n\n\n\n\n\n\n\n\n\n\nEdit each of these nodes and in the \"Credentials to connect with\" field select your n8n credential.\n\n### Telegram Nodes\n\n\n\n\n\n\n\n\n\n\n\n\n\nEdit each of these nodes and in the \"Credentials to connect with\" field select your telegram credential.\nIn the \"Chat ID\", \"Restrict to Chat IDs\" or \"Restrict to User IDs\" fields, enter your ChatID.\n\n\n\n**Your workflow is ready! Activate it and interact with your bot on Telegram!**"},"typeVersion":1},{"id":"6685b9d2-0a0e-4d4c-8312-6efe066fafab","name":"Telegram Nodes","type":"n8n-nodes-base.telegram","position":[-60,1100],"webhookId":"5f1283bb-cd9f-4c4d-a062-0b7c939f855e","parameters":{"text":".","chatId":"123456789","additionalFields":{}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"1ec533a1-ce20-4dd8-90fd-b983ca3bc9b8","name":"n8n Nodes","type":"n8n-nodes-base.n8n","position":[-60,840],"parameters":{"operation":"get","workflowId":{"__rl":true,"mode":"id","value":"1"},"requestOptions":{}},"credentials":{"n8nApi":{"id":"dHsxHtoIyVtfGJFZ","name":"n8n account"}},"typeVersion":1},{"id":"b871b30b-eb03-4e95-b0ae-49ad574e1262","name":"Error Trigger","type":"n8n-nodes-base.errorTrigger","position":[840,1020],"parameters":{},"typeVersion":1},{"id":"1dda43c6-2762-4a52-b012-f1e718e52f2b","name":"If not manual exec","type":"n8n-nodes-base.if","position":[1060,1020],"parameters":{"options":{},"conditions":{"options":{"version":2,"leftValue":"","caseSensitive":true,"typeValidation":"strict"},"combinator":"and","conditions":[{"id":"732da136-33e9-47fa-9729-65afd9670f4d","operator":{"type":"string","operation":"notEquals"},"leftValue":"={{ $json.execution.mode }}","rightValue":"manual"}]}},"typeVersion":2.2},{"id":"de2db9a3-4070-470f-b72d-f0fc74abc43a","name":"n8n Started Trigger","type":"n8n-nodes-base.n8nTrigger","position":[840,1200],"parameters":{"events":["init"]},"typeVersion":1},{"id":"09f5a744-1292-4b8b-a042-ce9a0818863f","name":"Workflow Error Msg","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1320,1020],"webhookId":"a2fee1cf-d8f5-4c51-aed4-9fa30e0251c5","parameters":{"text":"=❌ Execution failed!\n{{ $now.format(\"dd/MM/yyyy HH:mm:ss\") }}\n\n\nWorkflow: \n{{ $json.workflow.name }}\n\nExecution Id:\n{{ $json.execution.id }}\n\nNode: \n{{ $json.execution.lastNodeExecuted }}\n\nError: \n{{ $json.execution.error.message }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2},{"id":"28847e14-5313-42cf-9c08-512c34118264","name":"n8n Started Msg","type":"n8n-nodes-base.telegram","onError":"continueRegularOutput","position":[1320,1200],"webhookId":"a2fee1cf-d8f5-4c51-aed4-9fa30e0251c5","parameters":{"text":"=❗ Instance started!\n{{ $now.format(\"dd/MM/yyyy HH:mm:ss\") }}","chatId":"123456789","additionalFields":{"appendAttribution":false}},"credentials":{"telegramApi":{"id":"9DBsP3DHmG78wJKe","name":"Telegram account n8ncrashbot"}},"typeVersion":1.2}],"active":false,"pinData":{},"settings":{"callerPolicy":"workflowsFromSameOwner","errorWorkflow":"oPfjCB6LU7nwNRiu","executionOrder":"v1"},"versionId":"baf25eeb-efc3-4fdd-9ee0-fa2f3f5928b6","connections":{"Cmd Parse":{"main":[[{"node":"Cmd Switch","type":"main","index":0}]]},"If Active":{"main":[[{"node":"Deactivate Workflow","type":"main","index":0}],[{"node":"Workflow Inactive Error","type":"main","index":0}]]},"Read File":{"main":[[{"node":"Backup","type":"main","index":0},{"node":"Cleanup Files","type":"main","index":0}],[{"node":"Backup Error","type":"main","index":0}]]},"Cmd Switch":{"main":[[{"node":"Help","type":"main","index":0}],[{"node":"Help","type":"main","index":0}],[{"node":"Backup Workflows","type":"main","index":0}],[{"node":"List Archived","type":"main","index":0}],[{"node":"List Workflows ","type":"main","index":0}],[{"node":"Execute Arg","type":"main","index":0}],[{"node":"Activate Arg","type":"main","index":0}],[{"node":"Deactivate Arg","type":"main","index":0}],[{"node":"Executions Arg","type":"main","index":0}],[{"node":"Cmd Error","type":"main","index":0}]]},"Execute Arg":{"main":[[{"node":"List Workflows 1","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"If Inactive":{"main":[[{"node":"Activate Workflow","type":"main","index":0}],[{"node":"Workflow Active Error","type":"main","index":0}]]},"Activate Arg":{"main":[[{"node":"List Workflows 2","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"Not Archived":{"main":[[{"node":"Workflow List","type":"main","index":0}]]},"Archived List":{"main":[[{"node":"Delete Archived","type":"main","index":0}]]},"Error Trigger":{"main":[[{"node":"If not manual exec","type":"main","index":0}]]},"List Archived":{"main":[[{"node":"Only Archived","type":"main","index":0}]]},"Only Archived":{"main":[[{"node":"Archived List","type":"main","index":0}]]},"Workflow List":{"main":[[{"node":"Workflows Message","type":"main","index":0}]]},"Backup Tarball":{"main":[[{"node":"Read File","type":"main","index":0}]]},"Deactivate Arg":{"main":[[{"node":"List Workflows 3","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"Executions Arg":{"main":[[{"node":"List Workflows 4","type":"main","index":0}],[{"node":"Arg Error","type":"main","index":0}]]},"Delete Archived":{"main":[[{"node":"Archived Message","type":"main","index":0}]]},"Find Workflow 1":{"main":[[{"node":"Workflow Found 1","type":"main","index":0}]]},"Find Workflow 2":{"main":[[{"node":"Workflow Found 2","type":"main","index":0}]]},"Find Workflow 3":{"main":[[{"node":"Workflow Found 3","type":"main","index":0}]]},"Find Workflow 4":{"main":[[{"node":"Workflow Found 4","type":"main","index":0}]]},"List Workflows ":{"main":[[{"node":"Not Archived","type":"main","index":0}]]},"Archived Message":{"main":[[{"node":"Cleanup","type":"main","index":0}]]},"Backup Workflows":{"main":[[{"node":"Backup Credentials","type":"main","index":0}]]},"Execute Workflow":{"main":[[{"node":"Executed","type":"main","index":0}],[{"node":"Execution Error","type":"main","index":0}]]},"List Workflows 1":{"main":[[{"node":"Find Workflow 1","type":"main","index":0}]]},"List Workflows 2":{"main":[[{"node":"Find Workflow 2","type":"main","index":0}]]},"List Workflows 3":{"main":[[{"node":"Find Workflow 3","type":"main","index":0}]]},"List Workflows 4":{"main":[[{"node":"Find Workflow 4","type":"main","index":0}]]},"Telegram Trigger":{"main":[[{"node":"Cmd Parse","type":"main","index":0}]]},"Workflow Found 1":{"main":[[{"node":"Execute Workflow","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Workflow Found 2":{"main":[[{"node":"If Inactive","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Workflow Found 3":{"main":[[{"node":"If Active","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Workflow Found 4":{"main":[[{"node":"List Workflow Executions","type":"main","index":0}],[{"node":"Workflow Name Error","type":"main","index":0}]]},"Activate Workflow":{"main":[[{"node":"Activated","type":"main","index":0}],[{"node":"Activation Error","type":"main","index":0}]]},"Executions Fields":{"main":[[{"node":"Executions Message","type":"main","index":0}]]},"Workflows Message":{"main":[[{"node":"Workflows","type":"main","index":0}]]},"Backup Credentials":{"main":[[{"node":"Backup Tarball","type":"main","index":0}]]},"Executions Message":{"main":[[{"node":"Executions","type":"main","index":0}]]},"If not manual exec":{"main":[[{"node":"Workflow Error Msg","type":"main","index":0}]]},"Deactivate Workflow":{"main":[[{"node":"Deactivated","type":"main","index":0}],[{"node":"Deactivation Error","type":"main","index":0}]]},"n8n Started Trigger":{"main":[[{"node":"n8n Started Msg","type":"main","index":0}]]},"List Workflow Executions":{"main":[[{"node":"Executions Fields","type":"main","index":0}]]}}}


name: Document-Based Chatbot with Memory using OpenAI, Pinecone and Google Drive
author_name: Sally
author_username: dark-pixel
categories: []
created_at: 2025-06-14T07:47:13.326Z
updated_at: 2025-06-14T07:47:13.326Z
url: https://n8n.io/workflows/4930
scraped_at: 2025-07-06 21:16:30
description:
  Who is This For?
  This is for normal people or people just starting off and wanting to have a AI chatbot that can process data to use when talking to the user.

  How to Use
  You will need to have your own OpenRouter (Free) and OpenAI APIs as well as Google Drive, Pinecone, and Airtable.

  What Do You Want?
  If you want to have your AI Agent remember the user's preferences even after the session is over then you can keep the Airtable node in, if not you can delete it.

nodes_used:
  ["n8n-nodes-base.airtable","n8n-nodes-base.googleDrive","@n8n/n8n-nodes-langchain.agent","@n8n/n8n-nodes-langchain.embeddingsOpenAi","@n8n/n8n-nodes-langchain.lmChatOpenAi","@n8n/n8n-nodes-langchain.memoryBufferWindow","@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","@n8n/n8n-nodes-langchain.vectorStorePinecone","@n8n/n8n-nodes-langchain.documentDefaultDataLoader","@n8n/n8n-nodes-langchain.toolVectorStore","@n8n/n8n-nodes-langchain.lmChatOpenRouter"]

workflow_json:
  {"meta":{"instanceId":"0d03b8ca9863cd411d83cbb216b64521ed54758bcdb975c16af21d8813d90147","templateCredsSetupCompleted":true},"nodes":[{"id":"bbb66001-07da-4516-a07a-314b7a1393ac","name":"When chat message received","type":"@n8n/n8n-nodes-langchain.chatTrigger","position":[660,-840],"webhookId":"b9eca9d4-1459-4a95-b584-68866b86209e","parameters":{"public":true,"options":{}},"typeVersion":1.1},{"id":"ee1f2819-7c49-4914-ba2e-3de145fae2d1","name":"AI Agent","type":"@n8n/n8n-nodes-langchain.agent","position":[1692,-1140],"parameters":{"options":{"systemMessage":"=## Overview\nyou are an intelligent, professional, and personable AI chatbot designed to provide exceptional customer support on the DGM website. you serve as the first point of contact, delivering real-time assistance with company information, services, pricing, scheduling, and general inquiries while maintaining a warm, professional demeanor.\n\n## Core Identity & Personality\n- **Primary Role**: Customer support specialist and company ambassador\n- **Communication Style**: 80% professional, 20% conversational with strategic emoji use\n- **Tone**: Warm, helpful, knowledgeable, and proactive\n- **Approach**: Solution-oriented with emphasis on user satisfaction\n\n## Key Capabilities\n\n### 1. Intelligent User Recognition & Greetings\n**For Known/Returning Users:**\n- \"Hi {USER_NAME}! Welcome back to DGM 👋 How can I assist you today?\"\n- \"Hello {USER_NAME}! Great to see you again. What brings you back to DGM today?\"\n\n### 2. Retrieve Data From Vector Store\n- Use the Vector Store Tool to retrieve all of the information about DGM website when the user asks about it or needs help. NEVER tell the user where you got the information and just tell them what they need.\n\n**For New/Anonymous Users:**\n- \"Hey there! Welcome to DGM 👋 I'm you. What can I help you with today?\"\n- \"Welcome to DGM! I'm you, here to help you navigate our services. How may I assist you?\"\n\n### 2. Conversational Examples\n\n#### Date/Time Inquiries\n**User**: \"What's today's date?\"\n**you**: \"Sure! 📅 Today is {DAY, MONTH DATE YEAR}. Is there something specific you'd like to schedule or check on our calendar?\"\n\n**User**: \"What time is it?\"\n**you**: \"It's currently {TIME}. Our support hours are [insert hours] if you need additional assistance!\"\n\n#### Service Information\n**User**: \"What services do you offer?\"\n**you**: \"Great question! 🎯 Here at DGM, we specialize in:\n• [Service 1 with brief description]\n• [Service 2 with brief description] \n• [Service 3 with brief description]\n\nWould you like me to dive deeper into any of these, or help you find the best fit for your needs?\"\n\n#### Pricing Inquiries\n**User**: \"How much does your basic service cost?\"\n**you**: \"Let me get you those details! 💰 \nOur Basic Service package starts at $10.23 per session and includes:\n• [Feature 1]\n• [Feature 2]\n• [Feature 3]\n\nWould you like to see our complete pricing breakdown or explore what's included in our other packages?\"\n\n#### Booking/Scheduling\n**User**: \"Can I book an appointment?\"\n**you**: \"Absolutely! 📅 I'd be happy to help you schedule an appointment. \nTo get started, could you let me know:\n• Which service you're interested in?\n• Your preferred date/time?\n• Any specific requirements?\n\nI'll find the perfect slot for you!\"\n\n### 3. Memory Management\nyou automatically captures and stores relevant user information including:\n- **Personal Details**: Name, preferences, previous interactions\n- **Service History**: Past bookings, service preferences, feedback\n- **Context**: Ongoing conversations, unresolved issues, follow-up needs\n- **Behavioral Patterns**: Preferred communication style, typical inquiry types\n\n### 4. Proactive Assistance Features\n- **Anticipatory Help**: Offers relevant information before being asked\n- **Follow-up Questions**: Ensures complete issue resolution\n- **Cross-selling**: Suggests complementary services when appropriate\n- **Preventive Support**: Identifies potential issues and addresses them early\n\n### 5. Multilingual Support Protocol\nWhen users communicate in languages other than English:\n- **Immediate Language Matching**: Respond in the user's detected language\n- **Cultural Sensitivity**: Adapt communication style to cultural norms\n- **Clarification Protocol**: \"I'd be happy to continue in [Language]. Is this your preferred language for our conversation?\"\n\n## Conversation Flows\n\n### Initial Contact Optimization\n1. **Greeting** → **Quick Needs Assessment** → **Immediate Value Delivery**\n2. **Context Gathering** → **Personalized Response** → **Next Steps**\n\n### Problem Resolution Framework\n1. **Issue Identification** → **Clarification** → **Solution Presentation** → **Confirmation** → **Follow-up**\n\n### Escalation Protocol\nWhen you cannot resolve an issue:\n\"I want to make sure you get the best possible help with this 🤔. Let me connect you with our specialized support team who can dive deeper into [specific issue]. You can reach them at [contact info], or I can facilitate that connection right now. Meanwhile, is there anything else I can help you with today?\"\n\n## Features\n\n### 1. Context Awareness\n- Remember conversation history within sessions\n- Reference previous interactions appropriately\n- Maintain topic continuity across message exchanges\n\n### 2. Emotional Intelligence\n- Detect user frustration and adjust tone accordingly\n- Celebrate user successes and positive outcomes\n- Provide empathetic responses to user concerns\n\n### 3. Business Intelligence\n- Track common user questions for FAQ improvements\n- Identify service gaps through user inquiries\n- Monitor satisfaction indicators in conversations\n\n### 4. Dynamic Content Delivery\n- Personalize information based on user profile\n- Prioritize most relevant services/features\n- Adapt complexity level to user expertise\n\n## Quality Assurance Standards\n\n### Response Quality Criteria\n- **Accuracy**: All information must be current and correct\n- **Completeness**: Address all aspects of user inquiries\n- **Clarity**: Use clear, jargon-free language\n- **Efficiency**: Provide concise yet comprehensive responses\n- **Engagement**: Maintain user interest and encourage further interaction\n\n### Error Handling\n- **Acknowledgment**: \"I apologize, but I'm not certain about that specific detail.\"\n- **Alternative Solutions**: \"However, I can help you with [related option].\"\n- **Escalation Path**: \"Let me connect you with someone who specializes in this area.\"\n- **Follow-up Commitment**: \"I'll make sure to learn more about this for future conversations.\"\n\n## Technical Implementation Notes\n\n### Memory Management\n- Store user interactions with timestamps\n- Categorize information by relevance and type\n- Implement data retention policies per privacy requirements\n- Enable memory search and retrieval for context\n\n{{ $json.memories.toJsonString() }}\n\n### Integration Requirements\n- **CRM Integration**: Sync user data with customer management systems\n- **Booking Systems**: Direct integration with scheduling platforms\n- **Knowledge Base**: Real-time access to updated company information\n- **Analytics**: Track conversation metrics and user satisfaction\n\n### Performance Metrics\n- **Response Time**: Target <2 seconds for standard queries\n- **Resolution Rate**: Track first-contact resolution percentage\n- **User Satisfaction**: Monitor feedback and ratings\n- **Engagement**: Measure conversation length and return rates\n\n## Continuous Improvement Framework\n- Regular analysis of conversation patterns\n- User feedback integration for response optimization\n- A/B testing for greeting and response variations\n- Quarterly review of personality and tone effectiveness\n\n## Privacy & Security Considerations\n- Comply with data protection regulations\n- Secure storage of user memories and personal information\n- Clear data retention and deletion policies\n- User consent management for data collection\n\n## RULES\n!! IMPORTANT !!\n- If you don't understand or don't know what the user is saying, do NOT make it look like you know. Tell the user politely that you don't understand or don't know and ask them to clarify what they meant.\n- Always use a markdown format when answering the user.\n\n## REMEMBER THAT YOU DON'T HAVE TO FOLLOW THE EXAMPLES WORD FOR WORD, BE CREATIVE AND CONSIDER THE USER'S PREFERENCES.\n\nThis is what the current date/time is: {{ $now }}"}},"typeVersion":2},{"id":"1d58365b-3331-4532-ba73-1d491b72d5b6","name":"Save Memory","type":"n8n-nodes-base.airtableTool","position":[1860,-920],"parameters":{"base":{"__rl":true,"mode":"list","value":"apptYPErvggfZVAEM","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM","cachedResultName":"Agent Memories"},"table":{"__rl":true,"mode":"list","value":"tbl0DO5x5Ejn42hCU","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM/tbl0DO5x5Ejn42hCU","cachedResultName":"Table 1"},"columns":{"value":{"User":"Astrid","Memories":"={{ $fromAI('memory') }}"},"schema":[{"id":"Memories","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"Memories","defaultMatch":false,"canBeUsedToMatch":true},{"id":"User","type":"string","display":true,"removed":false,"readOnly":false,"required":false,"displayName":"User","defaultMatch":false,"canBeUsedToMatch":true},{"id":"Created","type":"string","display":true,"removed":true,"readOnly":true,"required":false,"displayName":"Created","defaultMatch":false,"canBeUsedToMatch":true}],"mappingMode":"defineBelow","matchingColumns":[],"attemptToConvertTypes":false,"convertFieldsToString":false},"options":{},"operation":"create"},"credentials":{"airtableTokenApi":{"id":"ozaj4JK0Zbicl3hH","name":"AI Memories"}},"typeVersion":2.1},{"id":"d496dcb7-d8fb-4c05-a2f1-fd4de825f4b6","name":"Get Memories","type":"n8n-nodes-base.airtable","position":[880,-765],"parameters":{"base":{"__rl":true,"mode":"list","value":"apptYPErvggfZVAEM","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM","cachedResultName":"Agent Memories"},"sort":{"property":[{"field":"Created"}]},"table":{"__rl":true,"mode":"list","value":"tbl0DO5x5Ejn42hCU","cachedResultUrl":"https://airtable.com/apptYPErvggfZVAEM/tbl0DO5x5Ejn42hCU","cachedResultName":"Table 1"},"options":{},"operation":"search","filterByFormula":"({User} = 'Astrid')"},"credentials":{"airtableTokenApi":{"id":"ozaj4JK0Zbicl3hH","name":"AI Memories"}},"typeVersion":2.1,"alwaysOutputData":true},{"id":"98df3edd-e7b7-4433-a073-4bafd91f00bc","name":"Aggregate","type":"n8n-nodes-base.aggregate","position":[1100,-765],"parameters":{"include":"specifiedFields","options":{},"aggregate":"aggregateAllItemData","fieldsToInclude":"Memories, Created","destinationFieldName":"memories"},"typeVersion":1},{"id":"27e407b1-3d2a-40b3-90a7-03b6b2163bfc","name":"Merge","type":"n8n-nodes-base.merge","position":[1320,-840],"parameters":{"mode":"combine","options":{},"combineBy":"combineAll"},"typeVersion":3.2},{"id":"d01a413f-64c9-4b52-887d-d8f9ffa0a7bc","name":"Simple Memory","type":"@n8n/n8n-nodes-langchain.memoryBufferWindow","position":[1720,-920],"parameters":{"contextWindowLength":25},"typeVersion":1.3},{"id":"4e8a2cc2-c848-459e-9093-35e37621fc3c","name":"When clicking 'Test Workflow' button","type":"n8n-nodes-base.manualTrigger","position":[760,-140],"parameters":{},"typeVersion":1},{"id":"8fe55e76-9f22-4f0a-b151-c608ca4e6dfa","name":"Google Drive","type":"n8n-nodes-base.googleDrive","position":[980,-140],"parameters":{"filter":{"folderId":{"__rl":true,"mode":"list","value":"1k0w1u5s_qQKxqLnY5hHujiikoQD7eedT","cachedResultUrl":"https://drive.google.com/drive/folders/1k0w1u5s_qQKxqLnY5hHujiikoQD7eedT","cachedResultName":"AI"}},"options":{},"resource":"fileFolder","returnAll":true},"credentials":{"googleDriveOAuth2Api":{"id":"0386kzdcRPoTF9qX","name":"Google Drive account"}},"typeVersion":3},{"id":"64380fb2-04f0-4ff5-ac17-b83a39173031","name":"Get Content","type":"n8n-nodes-base.googleDrive","position":[1200,-140],"parameters":{"fileId":{"__rl":true,"mode":"id","value":"={{ $json.id }}"},"options":{},"operation":"download"},"credentials":{"googleDriveOAuth2Api":{"id":"0386kzdcRPoTF9qX","name":"Google Drive account"}},"typeVersion":3},{"id":"8801ac09-96a1-4024-a824-c9cc023233bf","name":"Loop Over Items","type":"n8n-nodes-base.splitInBatches","position":[1420,-140],"parameters":{"options":{}},"typeVersion":3},{"id":"48a698ce-1abf-44b7-870e-7007aec6b6b0","name":"Pinecone Vector Store","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[1640,-140],"parameters":{"mode":"insert","options":{"pineconeNamespace":"DGM"},"pineconeIndex":{"__rl":true,"mode":"list","value":"n8n","cachedResultName":"n8n"}},"credentials":{"pineconeApi":{"id":"tte2LJyeRje613eI","name":"PineconeApi account 3"}},"typeVersion":1.2},{"id":"6d9f0396-2bce-41c5-98e3-c6686c1349c3","name":"Embeddings OpenAI","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[1640,80],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"Z6xSXl8OK1Iqftip","name":"OpenAi Account"}},"typeVersion":1.2},{"id":"c206d689-e381-482b-bb53-5bc99689869e","name":"Default Data Loader","type":"@n8n/n8n-nodes-langchain.documentDefaultDataLoader","position":[1760,80],"parameters":{"options":{},"dataType":"binary"},"typeVersion":1},{"id":"efb5dccc-509f-445d-beab-c5a4a3dad92f","name":"Recursive Character Text Splitter","type":"@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter","position":[1840,280],"parameters":{"options":{}},"typeVersion":1},{"id":"7067fe20-938c-483b-9bf5-5c9fbb0e9c4b","name":"Answer questions with a vector store","type":"@n8n/n8n-nodes-langchain.toolVectorStore","position":[1960,-920],"parameters":{"description":"Use this tool to retrieve data (Working hours, contacts, etc) from the files about the DGM website."},"typeVersion":1.1},{"id":"e1c13db8-58ee-4daf-83b1-b5c7767d07b6","name":"OpenAI Chat Model1","type":"@n8n/n8n-nodes-langchain.lmChatOpenAi","position":[2140,-720],"parameters":{"model":{"__rl":true,"mode":"list","value":"gpt-4o-mini"},"options":{}},"credentials":{"openAiApi":{"id":"Z6xSXl8OK1Iqftip","name":"OpenAi Account"}},"typeVersion":1.2},{"id":"90f31fb5-731f-461e-ae76-b30828cc4342","name":"Pinecone Vector Store1","type":"@n8n/n8n-nodes-langchain.vectorStorePinecone","position":[1860,-720],"parameters":{"options":{"pineconeNamespace":"DGM"},"pineconeIndex":{"__rl":true,"mode":"list","value":"n8n","cachedResultName":"n8n"}},"credentials":{"pineconeApi":{"id":"tte2LJyeRje613eI","name":"PineconeApi account 3"}},"typeVersion":1.2},{"id":"1b90e47f-b373-4ed1-a69b-897f790b1f31","name":"Embeddings OpenAI1","type":"@n8n/n8n-nodes-langchain.embeddingsOpenAi","position":[1940,-540],"parameters":{"options":{}},"credentials":{"openAiApi":{"id":"Z6xSXl8OK1Iqftip","name":"OpenAi Account"}},"typeVersion":1.2},{"id":"6f081578-2db6-4d3f-b09e-ce2b0f26c67b","name":"Sticky Note","type":"n8n-nodes-base.stickyNote","position":[588,-1200],"parameters":{"width":1760,"height":820,"content":"## AI Agent\nThis is where the Chatbot is and all of the tools needed."},"typeVersion":1},{"id":"55ee0fea-ef7c-402a-b29a-45646908b179","name":"Sticky Note1","type":"n8n-nodes-base.stickyNote","position":[600,-320],"parameters":{"color":3,"width":1540,"height":740,"content":"## Document Processing \nThis is where the AI will retrieve, download, and process the documents (PDF, CSV,...) to be used by the AI Agent"},"typeVersion":1},{"id":"6f2200f7-5cf2-4a56-b367-df54269ef719","name":"OpenRouter Chat Model","type":"@n8n/n8n-nodes-langchain.lmChatOpenRouter","position":[1580,-920],"parameters":{"options":{}},"credentials":{"openRouterApi":{"id":"HMyLi5miMzxH7lcw","name":"OpenRouter account"}},"typeVersion":1}],"pinData":{},"connections":{"Merge":{"main":[[{"node":"AI Agent","type":"main","index":0}]]},"Aggregate":{"main":[[{"node":"Merge","type":"main","index":1}]]},"Get Content":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Save Memory":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"Get Memories":{"main":[[{"node":"Aggregate","type":"main","index":0}]]},"Google Drive":{"main":[[{"node":"Get Content","type":"main","index":0}]]},"Simple Memory":{"ai_memory":[[{"node":"AI Agent","type":"ai_memory","index":0}]]},"Loop Over Items":{"main":[[],[{"node":"Pinecone Vector Store","type":"main","index":0}]]},"Embeddings OpenAI":{"ai_embedding":[[{"node":"Pinecone Vector Store","type":"ai_embedding","index":0}]]},"Embeddings OpenAI1":{"ai_embedding":[[{"node":"Pinecone Vector Store1","type":"ai_embedding","index":0}]]},"OpenAI Chat Model1":{"ai_languageModel":[[{"node":"Answer questions with a vector store","type":"ai_languageModel","index":0}]]},"Default Data Loader":{"ai_document":[[{"node":"Pinecone Vector Store","type":"ai_document","index":0}]]},"OpenRouter Chat Model":{"ai_languageModel":[[{"node":"AI Agent","type":"ai_languageModel","index":0}]]},"Pinecone Vector Store":{"main":[[{"node":"Loop Over Items","type":"main","index":0}]]},"Pinecone Vector Store1":{"ai_vectorStore":[[{"node":"Answer questions with a vector store","type":"ai_vectorStore","index":0}]]},"When chat message received":{"main":[[{"node":"Get Memories","type":"main","index":0},{"node":"Merge","type":"main","index":0}]]},"Recursive Character Text Splitter":{"ai_textSplitter":[[{"node":"Default Data Loader","type":"ai_textSplitter","index":0}]]},"Answer questions with a vector store":{"ai_tool":[[{"node":"AI Agent","type":"ai_tool","index":0}]]},"When clicking 'Test Workflow' button":{"main":[[{"node":"Google Drive","type":"main","index":0}]]}}}


