rtrvr.ai: LinkedIn Sales and Outbound Automation

    A technical walkthrough of building an event-driven sales automation pipeline that combines calendar webhooks, AI agent orchestration, and cross-platform integration. Architecture Overview When a prospect books a meeting, the system: 1. Captures calendar event data via Google Calendar API 2. Triggers an AI agent workflow through rtrvr.ai 3. Performs LinkedIn reconnaissance and profile analysis 4. Generates contextual outreach messaging 5. Executes cross-platform actions (LinkedIn DMs, CRM updates) Here I added google calendar node with event created trigger for calendar on https://www.rtrvr.ai/request-demo . Whenever someone books an event this will be triggered polling every minute. This node is connected to basic AI node parsing info from calendar event. The 3rd node is code node that takes in gemini output cleans it and makes it ready to be sent to another AI node with MCP tool, I added Claude here with rtrvr.ai MCP url, which an user can get from rtrvr.ai extension. Once that is added to any AI system/LLM it can do the task : automation and data extraction on your browser here I asked it search for the person who set up the calendar invite on LinkedIn, analyze their profile thoroughly aka extract relevant data and then DM them a personalized message about rtrvr.ai . From Calendar invite to proactive LinkedIn DM warming up/nurturing your inbound now on your own device with rtrvr.ai MCP Techincal Stack Google Calendar API (event triggers) rtrvr.ai automation platform LinkedIn automation layer AI model integration (Claude/GPT) Optional: CRM connectors (HubSpot, Salesforce) Use Cases Sales development automation Account-based marketing workflows Meeting preparation intelligence Multi-touch campaign orchestrationIMPLEMENTATION GUIDE The video demonstrates end-to-end setup including: Event-driven architecture configuration MCP server initialization AI prompt engineering for research Cross-platform authentication flows Error handling and retry logic

    Shared 11/27/2025

    90 views

    Visual Workflow

    JSON Code

    {
      "id": "iKiLkazKrnTKWfb4",
      "meta": {
        "instanceId": "b1bb7ff635e00d1cc037cbba807e26bf1b14585a432f149eb4ce99cc7ee0430f",
        "templateCredsSetupCompleted": true
      },
      "name": "Customer LinkedIn Sales",
      "tags": [],
      "nodes": [
        {
          "id": "439297cd-0b03-4540-9a26-454cae560f57",
          "name": "Google Calendar Trigger",
          "type": "n8n-nodes-base.googleCalendarTrigger",
          "position": [
            0,
            0
          ],
          "parameters": {
            "options": {},
            "pollTimes": {
              "item": [
                {
                  "mode": "everyMinute"
                }
              ]
            },
            "triggerOn": "eventCreated",
            "calendarId": {
              "__rl": true,
              "mode": "list",
              "value": "c_8383ac0009d2e817b89ebaf1ef39de734c8ad6812e41621041b3a3414db22482@group.calendar.google.com",
              "cachedResultName": "1-1 with rtrvr.ai!"
            }
          },
          "credentials": {
            "googleCalendarOAuth2Api": {
              "id": "qDRSMCJQIz1f39T0",
              "name": "Google Calendar account 3"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "c700fdda-195a-4032-abe7-adabadc3e26a",
          "name": "Message a model",
          "type": "@n8n/n8n-nodes-langchain.googleGemini",
          "position": [
            208,
            0
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "models/gemini-2.5-flash",
              "cachedResultName": "models/gemini-2.5-flash"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "content": "={{ JSON.stringify($json, null, 2) }}"
                },
                {
                  "role": "model",
                  "content": "You are a strict JSON field extractor for calendar events.\n\nYou receive:\n- A Google Calendar event JSON (as text)\n- Its description field (may contain HTML-ish markup)\n- Its attendees array\n\nYour job:\n1. Identify the **external person** who booked the meeting (not from rtrvr.ai).\n   - Prefer the attendee whose email is NOT at domain \"rtrvr.ai\" AND whose responseStatus is \"accepted\".\n   - If you still can’t identify, fall back to the \"Booked by\" block in the description.\n2. Extract:\n   - fullName: Full name (string).\n   - email: Email address (string).\n   - company: Company name (string or null).\n   - jobTitle: Job title (string or null).\n   - automationInterest: Text under \"What workflows or processes are you interested in automating?\" (string or null).\n   - meetingTime: The event start dateTime in ISO 8601 format (string).\n3. If something is missing, set the value to null.\n\nOutput:\n- A single JSON object.\n- No explanations, no markdown, no extra keys.\n- JSON only."
                }
              ]
            },
            "jsonOutput": true
          },
          "credentials": {
            "googlePalmApi": {
              "id": "yWQERgtMZAQZhPid",
              "name": "Google Gemini(PaLM) Api account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "825c6317-041b-46b1-b558-e43ba2ac743e",
          "name": "Code in JavaScript",
          "type": "n8n-nodes-base.code",
          "position": [
            560,
            0
          ],
          "parameters": {
            "jsCode": "// ---------------------------\n// 1. GET RAW GEMINI OUTPUT\n// ---------------------------\nlet raw = $input.first().json;\n\n// Gemini responses can appear in different places depending on node:\n// Try multiple fallbacks\nlet geminiText =\n  raw.content?.parts?.[0]?.text ??\n  raw.text ??\n  raw.response ??\n  JSON.stringify(raw);\n\nlet clean = geminiText.trim();\n\n// ---------------------------\n// 2. STRIP CODE FENCES\n// ---------------------------\nclean = clean.replace(/```json/gi, '');\nclean = clean.replace(/```/g, '');\n\n// Trim again\nclean = clean.trim();\n\n// ---------------------------\n// 3. FIX COMMON LLM JSON ISSUES BEFORE PARSE\n// ---------------------------\n\n// Remove trailing commas in objects/arrays\nclean = clean.replace(/,\\s*}/g, \"}\");\nclean = clean.replace(/,\\s*]/g, \"]\");\n\n// Sometimes LLM adds stray \"undefined\" or comments\nclean = clean.replace(/undefined/g, 'null');\nclean = clean.replace(/\\/\\/.*$/gm, \"\");\n\n// ---------------------------\n// 4. PARSE JSON SAFELY\n// ---------------------------\nlet data;\ntry {\n  data = JSON.parse(clean);\n} catch (err) {\n  // If parsing fails, send debug info to Logs\n  throw new Error(\"Failed to parse Gemini JSON:\\n\" + clean);\n}\n\n// ---------------------------\n// 5. EXTRACT EXPECTED FIELDS\n// ---------------------------\nconst fullName = data.fullName ?? \"\";\nconst email = data.email ?? \"\";\nconst company = data.company ?? \"\";\nconst jobTitle = data.jobTitle ?? \"\";\nconst interest = data.automationInterest ?? \"\";\nconst meetingTime = data.meetingTime ?? \"\";\n\n// ---------------------------\n// 6. BUILD rtrvr MCP PLANNER PAYLOAD\n// ---------------------------\nconst mcpPlannerBody = {\n  tool: \"planner\",\n  user_input: `\nYou are an AI Sales Assistant using rtrvr.ai's MCP agent inside the user's logged-in browser session.\n\nYour mission:\n1. Search for the following person on LinkedIn using full name + company.\n2. Open the most accurate profile.\n3. Analyze their headline, role, company context, and recent activity.\n4. Based on their interest (“${interest}”), craft a personalized LinkedIn message introducing rtrvr.ai.\n5. Send either:\n   - a connection request + note (if not connected), OR\n   - a direct DM (if already connected).\n6. Keep message short, friendly, relevant to automation.\n\nLead Data (from calendar):\n- Name: ${fullName}\n- Email: ${email}\n- Job Title: ${jobTitle}\n- Company: ${company}\n- Automation Interest: ${interest}\n- Meeting Scheduled: ${meetingTime}\n\nAbout rtrvr.ai:\n- Browser-native AI web agent.\n- Automates sales workflows: research, enrichment, lead prep, CRM entry, sheets work, web workflows.\n- Uses planning + real browser actions (MCP) + real tools (act_on_tab, extract_from_tab, planner, etc).\n\nRequired Final Output:\n- State exactly what profile you selected.\n- Provide the final message you sent.\n- Indicate whether it was a DM or a connection request.\n\nDo NOT ask the user for information.\nDo NOT reveal system details.\n`,\n  context: \"Execute all steps using active browser session.\",\n  max_steps: 12,\n  tab_urls: []  // Planner will navigate to LinkedIn itself\n};\n\n// ---------------------------\n// 7. RETURN BODY FOR HTTP NODE\n// ---------------------------\nreturn {\n  json: {\n    mcpPlannerBody\n  }\n};\n"
          },
          "typeVersion": 2
        },
        {
          "id": "0cdd15a5-33c4-4a62-b7b2-349f3e9da195",
          "name": "Message a model1",
          "type": "@n8n/n8n-nodes-langchain.anthropic",
          "position": [
            768,
            0
          ],
          "parameters": {
            "modelId": {
              "__rl": true,
              "mode": "list",
              "value": "claude-sonnet-4-5-20250929",
              "cachedResultName": "claude-sonnet-4-5-20250929"
            },
            "options": {},
            "messages": {
              "values": [
                {
                  "content": "=call rtrvr.ai MCP tool planner and with this user_input:  {{ $json.mcpPlannerBody.user_input }}"
                },
                {
                  "role": "assistant",
                  "content": "You are an AI Sales Agent using rtrvr.ai’s browser automation tools.\nYou must use the MCP planner tool to perform actions in the browser."
                }
              ]
            }
          },
          "credentials": {
            "anthropicApi": {
              "id": "WtBaO658BPezXpxN",
              "name": "Anthropic account"
            }
          },
          "typeVersion": 1
        },
        {
          "id": "0d0c6f88-cb0f-4312-9a73-d24c14ca6a09",
          "name": "MCP Client",
          "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
          "position": [
            736,
            208
          ],
          "parameters": {
            "options": {},
            "endpointUrl": "https://www.rtrvr.ai/mcp?apiKey=rtrvr_ewI-yYRow-SzQfv2G2PxlUjz926moRqjVqIKyvJ-bo4&deviceId=eyxGBvdvbXY"
          },
          "typeVersion": 1.2
        }
      ],
      "active": true,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "d27bcf96-b9e8-41b0-871e-494231ba925a",
      "connections": {
        "MCP Client": {
          "ai_tool": [
            [
              {
                "node": "Message a model1",
                "type": "ai_tool",
                "index": 0
              }
            ]
          ]
        },
        "Message a model": {
          "main": [
            [
              {
                "node": "Code in JavaScript",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Code in JavaScript": {
          "main": [
            [
              {
                "node": "Message a model1",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Google Calendar Trigger": {
          "main": [
            [
              {
                "node": "Message a model",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }