{
  "name": "Update Hubspot engagement by parsing inbox mail with AI",
  "nodes": [
    {
      "id": "9f2dc93f-bae5-4419-8411-d2fff4b31f5e",
      "name": "Creates an email engagement",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        916,
        -260
      ]
    },
    {
      "id": "0a56ec28-afc6-40a9-bf42-4d8742e48eb4",
      "name": "OpenAI Chat Model",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        -140,
        -40
      ]
    },
    {
      "id": "8e53aeb6-7d84-4739-b482-b8cd844b89ac",
      "name": "Search for the contact via email",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        256,
        -260
      ]
    },
    {
      "id": "19e54445-d0cb-40f2-a11f-5e4cb22ad7ec",
      "name": "Parse the mail with AI",
      "type": "@n8n/n8n-nodes-langchain.chainLlm",
      "position": [
        -120,
        -260
      ]
    },
    {
      "id": "8b257214-0001-46aa-84df-cad844e3130b",
      "name": "When an email is received",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        -340,
        -260
      ]
    },
    {
      "id": "32820b69-3918-4951-9ddc-45bdbcb60aca",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -400
      ],
      "parameters": {
        "width": 280,
        "height": 300,
        "content": "## Set receiving email account\n- Ddefaults to an IMAP account node, but you can put a gmail account or any  email trigger"
      }
    },
    {
      "id": "adbed044-08ae-4744-9b0c-09a225860267",
      "name": "Set the output Json",
      "type": "@n8n/n8n-nodes-langchain.outputParserStructured",
      "position": [
        80,
        -40
      ]
    },
    {
      "id": "e58575ee-6ac8-4de1-b4db-8525146efd74",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -140,
        -400
      ],
      "parameters": {
        "width": 320,
        "height": 300,
        "content": "## Upgrade the prompt!\nThis is a very simple prompt but oit does the job. Improve it and send it to me!"
      }
    },
    {
      "id": "23465910-0a89-45f7-9bbf-fb17abadc5de",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        200,
        -400
      ],
      "parameters": {
        "width": 840,
        "height": 400,
        "content": "## Hubspot integration\n- Search for the contact in hubspot\n- If it is present creates an egagement\n- It it is not, creates it and adds an engagement"
      }
    },
    {
      "id": "f5573c22-85f3-4eda-ba5a-172567827991",
      "name": "contact exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        476,
        -260
      ]
    },
    {
      "id": "914f2e6b-7a5f-4c9c-bd3b-4bfb2693728d",
      "name": "Edit Fields",
      "type": "n8n-nodes-base.set",
      "position": [
        696,
        -360
      ]
    },
    {
      "id": "4c8fa2d1-e3b4-4323-bdc8-3a4e2bbc706d",
      "name": "Creates contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        696,
        -160
      ]
    },
    {
      "id": "5f94ba18-49db-4bc0-9f0a-16a9d05ca6b0",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -440,
        -620
      ],
      "parameters": {
        "width": 460,
        "height": 200,
        "content": "## Contact me\n- If you need any modification to this workflow\n- if you need some help with this workflow\n- Or if you need any workflow in n8n, Make, or Langchain / Langgraph\n\nWrite to me: [thomas@poll"
      }
    }
  ],
  "connections": {
    "Edit Fields": {
      "main": [
        [
          {
            "node": "Creates an email engagement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Creates contact": {
      "main": [
        [
          {
            "node": "Creates an email engagement",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "contact exists?": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Creates contact",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat Model": {
      "ai_languageModel": [
        [
          {
            "node": "Parse the mail with AI",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Set the output Json": {
      "ai_outputParser": [
        [
          {
            "node": "Parse the mail with AI",
            "type": "ai_outputParser",
            "index": 0
          }
        ]
      ]
    },
    "Parse the mail with AI": {
      "main": [
        [
          {
            "node": "Search for the contact via email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When an email is received": {
      "main": [
        [
          {
            "node": "Parse the mail with AI",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search for the contact via email": {
      "main": [
        [
          {
            "node": "contact exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}