{
  "id": "pdXKsWas8IGtFKmV",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Generate and send MadKudu Account Brief into Outreach",
  "tags": [],
  "nodes": [
    {
      "id": "12db4d8d-66f9-4b64-bba2-36d92d7ce98a",
      "name": "When clicking \u2018Execute workflow\u2019",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -928,
        448
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "b6e9968b-0868-443b-a3b0-66888798c23d",
      "name": "MadKudu MCP",
      "type": "@n8n/n8n-nodes-langchain.mcpClientTool",
      "position": [
        -112,
        624
      ],
      "parameters": {
        "sseEndpoint": "=https://mcp.madkudu.com/{{$vars.madkudu_api_key}}/sse"
      },
      "typeVersion": 1
    },
    {
      "id": "b7526bd1-f0ce-4c61-9462-5facd6b0b979",
      "name": "AI Agent - Research Accounts",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        -304,
        448
      ],
      "parameters": {
        "text": "=For each account, with their   {{ $json.Website }}, use MadKudu MCP to generate an account brief (madkudu-account-brief-instructions tool)\n\n",
        "options": {},
        "promptType": "define"
      },
      "typeVersion": 2.1
    },
    {
      "id": "0821e180-6755-4812-ae59-c942eb0bcd85",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -368,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 416,
        "height": 576,
        "content": "## 2. Generate Account Brief with MadKudu MCP\nThis step uses your MadKudu MCP + OpenAI to auto-write a summary.\n\nThrough MadKudu MCP, the agent researches recent company news online,   key information from your CRM, engaged contacts, job openings ... (from your integrations connected to MadKudu) and converts it into plain-English brief tailored to sales. \"Intro, Why, Why now, Why us, Risks\" according to Madkudu instructions \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "a861fcc8-441b-47ea-a277-29d2121b17be",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        80,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 480,
        "height": 576,
        "content": "## 3. Send Brief to Outreach Account custom field\n- First node looks up the Outreach account using the domain\n- Second node writes the brief to a custom field (like custom49) **Edit the custom field ID in the JSON Body!** to not overwrite an existing field\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "501732af-73d5-4091-a839-34d2950817b5",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -720,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 320,
        "height": 576,
        "content": "## 1.Select Accounts to Generate a Brief for\nUse your own Salesforce filters to choose which accounts to generate the brief for.\nExample: MadKudu Customer Fit score > 90 and MadKudu Likelihood to Buy score > 90\n\n**Keep the limit at 1 to test the flow first** then remove the limit when you are ready\n"
      },
      "typeVersion": 1
    },
    {
      "id": "6eac43bc-1cd7-4cbb-9f39-49229cb257b0",
      "name": "Get accounts",
      "type": "n8n-nodes-base.salesforce",
      "position": [
        -592,
        448
      ],
      "parameters": {
        "limit": 1,
        "options": {
          "fields": "id, name, website, ownerid, numberofemployees",
          "conditionsUi": {
            "conditionValues": [
              {
                "field": "mk_customer_fit_score__c",
                "value": "90",
                "operation": ">="
              },
              {
                "field": "mk_likelihood_to_buy_score__c",
                "value": "90",
                "operation": ">="
              }
            ]
          }
        },
        "resource": "account",
        "operation": "getAll"
      },
      "credentials": {
        "salesforceOAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "2a208e7e-f03f-445f-8e5a-7253cf69a029",
      "name": "OpenAI Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -304,
        624
      ],
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-4.1-mini",
          "cachedResultName": "gpt-4.1-mini"
        },
        "options": {}
      },
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "dc2301bc-f773-428d-8897-bc5a82cea65b",
      "name": "Get Outreach Account ID",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        144,
        448
      ],
      "parameters": {
        "url": "=https://api.outreach.io/api/v2/accounts?filter[domain]={{ $('Get accounts').item.json.Website }}",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "88b773bf-f3ab-4a93-a31d-b1433cca9a16",
      "name": "Send Brief to Outreach Account custom field",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        352,
        448
      ],
      "parameters": {
        "url": "=https://api.outreach.io/api/v2/accounts/{{ JSON.parse($(\"Get Outreach Account ID\").item.json.data).data[0].id }}",
        "body": "={   \"data\": {     \n     \"type\": \"account\",     \n      \"id\": {{ JSON.parse($('Get Outreach Account ID').item.json.data).data[0].id }},     \n      \"attributes\": {       \n           \"custom49\": {{ JSON.stringify($('AI Agent - Research Accounts').item.json.output) }}    \n      }   \n   } \n}",
        "method": "PATCH",
        "options": {},
        "sendBody": true,
        "contentType": "raw",
        "authentication": "genericCredentialType",
        "rawContentType": "JSON",
        "genericAuthType": "oAuth2Api"
      },
      "credentials": {
        "oAuth2Api": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "d2a2002c-5fd3-4a74-b7b1-fbf4b7ee4b03",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1552,
        160
      ],
      "parameters": {
        "width": 336,
        "height": 784,
        "content": "# Try it Out!\nThis workflow generates an Account Brief with MadKudu MCP for Salesforce accounts you selected and sends the brief to an Outreach Account custom field so you can leverage it with Outreach Revenue Agent\n\nIt automatically researches the account with all information MadKudu has from your data and external signals and syncs a clean, AI-written summary into a custom field inside Outreach \u2014 giving sales reps more context before reaching out.\n\nThis helps your team stay relevant without digging through CRM, dashboards or websites manually.\n\n##  How It Works\n1. Choose accounts to generates the brief for in Salesforce based on your own filters\n\n2. Generate a summary with AI\nThe agent pulls instructions and context from MadKudu MCP and crafts the account brief.\n\n3. Sync to Outreach\nThe brief is written into a custom field (e.g. custom49) on the matching Outreach account.\n\n## Need help?\nCheck out [n8n docs](https://docs.n8n.io/) or [MadKudu MCP docs](https://developers.madkudu.com/madkudu-mcp/what-is-madkudu-mcp)  or ask [product@madkudu.com](product@madkudu.com)\n\nHappy hacking!\n\n"
      },
      "typeVersion": 1
    },
    {
      "id": "75e03e9c-0f13-4d41-8d0a-8e2ffdf584eb",
      "name": "Sticky Note4",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        544
      ],
      "parameters": {
        "content": "## **Edit the custom field ID (custom49) in the JSON Body of the last node!** "
      },
      "typeVersion": 1
    },
    {
      "id": "9d9017f2-8a19-434a-bcf4-5ba8d620a2fd",
      "name": "Sticky Note5",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1088,
        160
      ],
      "parameters": {
        "color": 7,
        "width": 352,
        "height": 560,
        "content": "## Start the Workflow Manually\nThis trigger runs the workflow when you click \"Execute Workflow\" in n8n.\n\nFor production use, you could:\n\nSwap with a Schedule Trigger to run daily/weekly"
      },
      "typeVersion": 1
    },
    {
      "id": "9627ce55-b787-40b3-8b1f-8ee561d70802",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        176,
        768
      ],
      "parameters": {
        "width": 608,
        "height": 272,
        "content": "#### \ud83d\udd11 How to connect Outreach\n1. In n8n, add a new Oauth2 API credential and copy the callback URL \n2. Now go to **[Outreach developer portal](https://developers.outreach.io/apps/)**\n2. Click \u201cAdd\u201d to create a new app \n3. In **Feature selection** add **Outreach API (OAuth)** \n4. In **API Access (Oauth)** set the redirect URI to the n8n callback \n5. Select the following scopes  accounts.read, accounts.write \n6. Save in Outreach\n7. Now enter the Outreach **Application ID** into n8n **Client Id** and the Outreach **Application Secret** into n8n **Client secret**\n8. Save in n8n and connect via Oauth your Outreach Account"
      },
      "typeVersion": 1
    },
    {
      "id": "50e0cc48-dd54-40b5-abbe-c1293ee8429d",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -304,
        768
      ],
      "parameters": {
        "width": 432,
        "content": "#### \ud83d\udd11 How to connect MadKudu MCP \nIn n8n, add a new **[Variable](https://docs.n8n.io/code/variables/)** to store your **[MadKudu API key](https://developers.madkudu.com/getting-started/quickstart)** . \nName it **madkudu_api_key** it's automatically inserting the API in the SSE URL of the MCP Tool"
      },
      "typeVersion": 1
    },
    {
      "id": "8d9c627d-0e31-4c65-84f4-52a75ce5541c",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -688,
        640
      ],
      "parameters": {
        "content": "## **Edit the Salesforce filter rules and Limit!** "
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "39a2fc96-5f89-4f9e-b663-9f3fa5992fa4",
  "connections": {
    "MadKudu MCP": {
      "ai_tool": [
        [
          {
            "node": "AI Agent - Research Accounts",
            "type": "ai_tool",
            "index": 0
          }
        ]
      ]
    },
    "Get accounts": {
      "main": [
        [
          {
            "node": "AI Agent - Research Accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Model": {
      "ai_languageModel": [
        [
          {
            "node": "AI Agent - Research Accounts",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Get Outreach Account ID": {
      "main": [
        [
          {
            "node": "Send Brief to Outreach Account custom field",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "AI Agent - Research Accounts": {
      "main": [
        [
          {
            "node": "Get Outreach Account ID",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When clicking \u2018Execute workflow\u2019": {
      "main": [
        [
          {
            "node": "Get accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}