{
  "name": "Generate dynamic email sequences with runtime context and external data",
  "tags": [],
  "nodes": [
    {
      "id": "sticky-note-main",
      "name": "Sticky Note - Main Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        450,
        -700
      ],
      "parameters": {
        "color": 1,
        "width": 450,
        "height": 500,
        "content": "\ud83c\udfaf DYNAMIC EMAIL SEQUENCES WITH RUNTIME CONTEXT\n\nFOR: Growth teams, SDRs, outbound marketers who\nwant to reference real-time prospect information.\n\nSOLVES: Static sequences that can't reference what's\nactually happening at prospect companies right now.\nYou know they're hiring/launched/got funding but\ncan't dynamically reference these timely events.\n\nWORKS:\n1. Webhook gets lead data\n2. External source finds timely context\n3. LLM processes context data\n4. Octave generates sequences with context\n5. Sequences sent to email platform\n\nSETUP: External data source + LLM + Octave\nsequence agent + email platform credentials\n\nCUSTOMIZE: Replace AI agent with your data source\n(jobs, news, enrichment). Configure runtime context\n(WHAT data is) and instructions (HOW to use it).\nCan apply to individual emails or all emails."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-webhook",
      "name": "Sticky Note - Webhook Setup",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        40,
        -150
      ],
      "parameters": {
        "color": 2,
        "width": 190,
        "height": 100,
        "content": "\ud83d\ude80 START HERE\nReplace webhook path.\nConfigure lead source."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-research",
      "name": "Sticky Note - Context Research",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        240,
        -150
      ],
      "parameters": {
        "color": 4,
        "width": 190,
        "height": 100,
        "content": "\ud83d\udd0d CONTEXT RESEARCH\nReplace with your data source.\nJob boards, news, enrichment."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-llm",
      "name": "Sticky Note - LLM Processing",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        140,
        -300
      ],
      "parameters": {
        "color": 5,
        "width": 190,
        "height": 100,
        "content": "\ud83e\udde0 LLM PROCESSING\nAdd your LLM credentials.\nCustomize context extraction."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-octave",
      "name": "Sticky Note - Octave Runtime",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        740,
        -150
      ],
      "parameters": {
        "color": 3,
        "width": 190,
        "height": 100,
        "content": "\u26a1 RUNTIME CONTEXT\nOctave + external data.\nConfigure context & instructions."
      },
      "typeVersion": 1
    },
    {
      "id": "sticky-note-email",
      "name": "Sticky Note - Email Platform",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1040,
        -150
      ],
      "parameters": {
        "color": 6,
        "width": 190,
        "height": 100,
        "content": "\ud83d\udce7 EMAIL PLATFORM\nDynamic sequences to campaign.\nUpdate platform & variables."
      },
      "typeVersion": 1
    },
    {
      "id": "07920827-9d73-4099-8b6f-d599be97b929",
      "name": "Lead Data Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        120,
        0
      ],
      "parameters": {
        "path": "your-webhook-path-here",
        "options": {}
      },
      "typeVersion": 2
    },
    {
      "id": "4dc666e8-89dd-4647-8aeb-3880fd4aa59e",
      "name": "Research Company Context",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        320,
        0
      ],
      "parameters": {
        "text": "=Output the name of an open role that {{ $json.body.companyDomain }} is hiring for. If you can't find a role they are hiring for, make up a basic one that would make sense for them to hire for. Normalize the job title to something that would be used in an internal email (i.e \"software engineer\" instead of \"Sr. Software Engineer II\"). Output just the name of the role and nothing else, with no pretext or posttext. Do NOT make any justification if you can't find a role, just give a dummy role and nothing else. No \"I wasn't able to find...\" BS.",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "45c0b9e7-a035-4469-8a61-7e919502e715",
      "name": "LLM Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
      "position": [
        220,
        200
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "your-llm-model",
          "cachedResultName": "Your LLM Model"
        },
        "options": {}
      },
      "credentials": {
        "anthropicApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.3
    },
    {
      "id": "5a08a3b4-4a19-4112-b97c-b100db4eefd8",
      "name": "Generate Sequence with Runtime Context",
      "type": "n8n-nodes-octavehq.octave",
      "position": [
        820,
        0
      ],
      "parameters": {
        "agentOId": "your-octave-sequence-agent-id",
        "jobTitle": "={{ $('Lead Data Webhook').item.json.body.jobTitle }}",
        "firstName": "={{ $('Lead Data Webhook').item.json.body.firstName }}",
        "operation": "runSequence",
        "companyName": "={{ $('Lead Data Webhook').item.json.body.companyName }}",
        "companyDomain": "={{ $('Lead Data Webhook').item.json.body.companyDomain }}",
        "linkedInProfile": "={{ $('Lead Data Webhook').item.json.body.profileURL }}",
        "runtimeContextStep1": "=they are hiring a {{ $json.output }}",
        "runtimeInstructionsStep1": "mention the role they're hiring for and that's why you reached out"
      },
      "credentials": {
        "octaveApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "4ae4986a-547e-4d67-9d68-0774c1dc9ab7",
      "name": "Add Lead to Email Campaign",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1120,
        0
      ],
      "parameters": {
        "url": "https://api.instantly.ai/api/v2/leads",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "sendHeaders": true,
        "authentication": "genericCredentialType",
        "bodyParameters": {
          "parameters": [
            {
              "name": "campaign",
              "value": "your-campaign-id-here"
            },
            {
              "name": "email",
              "value": "={{ $('Lead Data Webhook').item.json.body.email }}"
            },
            {
              "name": "first_name",
              "value": "={{ $('Lead Data Webhook').item.json.body.firstName }}"
            },
            {
              "name": "last_name",
              "value": "={{ $('Lead Data Webhook').item.json.body.lastName }}"
            },
            {
              "name": "company_name",
              "value": "={{ $('Lead Data Webhook').item.json.body.companyName }}"
            },
            {
              "name": "custom_variables",
              "value": "={{ { \"email1\": $json.emails[0].email || \"\", \"subject1\": $json.emails[0].subject || \"\", \"email2\": $json.emails[1].email || \"\", \"subject2\": $json.emails[1].subject || \"\", \"email3\": $json.emails[2].email || \"\", \"subject3\": $json.emails[2].subject || \"\" } }}"
            }
          ]
        },
        "genericAuthType": "httpBearerAuth",
        "headerParameters": {
          "parameters": [
            {
              "name": "Content-Type",
              "value": "application/json"
            }
          ]
        }
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "connections": {
    "LLM Model": {
      "ai_languageModel": [
        [
          {
            "node": "Research Company Context",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Lead Data Webhook": {
      "main": [
        [
          {
            "node": "Research Company Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Research Company Context": {
      "main": [
        [
          {
            "node": "Generate Sequence with Runtime Context",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Generate Sequence with Runtime Context": {
      "main": [
        [
          {
            "node": "Add Lead to Email Campaign",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}