{
  "id": "C2pB17EpXAJwOcst",
  "meta": {
    "instanceId": "workflow-20188b84",
    "versionId": "1.0.0",
    "createdAt": "2025-09-29T07:07:59.207388",
    "updatedAt": "2025-09-29T07:07:59.207410",
    "owner": "n8n-user",
    "license": "MIT",
    "category": "automation",
    "status": "active",
    "priority": "high",
    "environment": "production"
  },
  "name": "OpenAI Assistant for Hubspot Chat",
  "tags": [
    "automation",
    "n8n",
    "production-ready",
    "excellent",
    "optimized"
  ],
  "nodes": [
    {
      "id": "7f11a684-911b-4fbc-ba1b-a8e7bce8e914",
      "name": "getHubspotMessage",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        280,
        580
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "56nluFhXiGjYN1EY",
          "name": "HubSpot App Token tinder"
        },
        "hubspotOAuth2Api": {
          "id": "y6819fYl4TsW9gl6",
          "name": "HubSpot account 6"
        },
        "hubspotDeveloperApi": {
          "id": "dHB9nVcnZTqf2JDX",
          "name": "HubSpot Developer account"
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "687bcbb8-38c8-4d21-a46f-186e880d003c",
      "name": "OpenAi Create Thread",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1260,
        420
      ],
      "parameters": {
        "url": "{{ $env.API_BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"messages\": [\n        {\n            \"role\": \"user\",\n            \"content\": \"{{ $('getHubspotMessage').item.json[\"text\"] }}\"\n        }\n    ]\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "8b51d465-d298-4b7a-b939-026bd51469d3",
      "name": "OpenAI Run",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1620,
        420
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"assistant_id\": \"asst_MA71Jq0SElVpdjmJa212CTFd\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "3e645c55-a236-466f-9983-2a3e91c250db",
      "name": "Get Run",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1920,
        600
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "alwaysOutputData": true,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "a69a1d1e-b932-481e-8d36-8d121c63ad4b",
      "name": "Get Last Message",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2520,
        460
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "sendHeaders": true,
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "d9758207-56d4-4180-aac7-f0ebafab1064",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2820,
        960
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "982dc86a0c1bd4c71185d39ae9f36998"
            },
            {
              "name": "src",
              "value": "={{JSON.parse($json[\"required_action\"][\"submit_tool_outputs\"][\"tool_calls\"][0][\"function\"][\"arguments\"]).src}}"
            }
          ]
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "5c6f30fd-3ac2-401c-897a-54c7e998c97b",
      "name": "Completed, Action or Inprogress",
      "type": "n8n-nodes-base.switch",
      "position": [
        2120,
        600
      ],
      "parameters": {
        "rules": {
          "rules": [
            {
              "value2": "completed"
            },
            {
              "output": 1,
              "value2": "requires_action"
            },
            {
              "output": 2,
              "value2": "in_progress",
              "operation": "=equal"
            },
            {
              "output": 3,
              "value2": "queued"
            }
          ]
        },
        "value1": "={{ $json.status }}",
        "dataType": "string"
      },
      "typeVersion": 1,
      "notes": "This switch node performs automated tasks as part of the workflow."
    },
    {
      "id": "c1bc0adf-3552-43a3-b38f-bfc76e2683cd",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "position": [
        2360,
        1000
      ],
      "webhookId": "e15c2bb6-e022-4c6d-869b-f361b1ec1259",
      "parameters": {
        "unit": "seconds"
      },
      "typeVersion": 1,
      "notes": "This wait node performs automated tasks as part of the workflow."
    },
    {
      "id": "2e0c4528-5b2b-4d3c-9b53-166ea0f2a28e",
      "name": "Wait1",
      "type": "n8n-nodes-base.wait",
      "position": [
        2340,
        760
      ],
      "webhookId": "3a175bf4-c569-431e-bc56-abed3653ce9d",
      "parameters": {
        "unit": "seconds"
      },
      "typeVersion": 1,
      "notes": "This wait node performs automated tasks as part of the workflow."
    },
    {
      "id": "f80a2cd8-6691-4186-909b-cfed95318014",
      "name": "Submit Data",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3360,
        960
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"tool_outputs\": [\n        {\n            \"tool_call_id\": \"{{ $('Select Function').item.json[\"required_action\"][\"submit_tool_outputs\"][\"tool_calls\"][0][\"id\"] }}\",\n            \"output\": \"{{$json.escapedJsonString}}\"\n        }\n    ]\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "alwaysOutputData": true,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "eb114cfd-1af2-4c8b-bfba-583453a1d7ca",
      "name": "Select Function",
      "type": "n8n-nodes-base.switch",
      "position": [
        2520,
        700
      ],
      "parameters": {
        "rules": {
          "rules": [
            {
              "value2": "getAWBbyOrder"
            },
            {
              "output": 1,
              "value2": "get_awb_history"
            }
          ]
        },
        "value1": "={{ $json.required_action.submit_tool_outputs.tool_calls[0].function.name }}",
        "dataType": "string"
      },
      "typeVersion": 1,
      "notes": "This switch node performs automated tasks as part of the workflow."
    },
    {
      "id": "4d1ad478-a9a4-4e9f-9b06-e2a9b7b2b55c",
      "name": "Code1",
      "type": "n8n-nodes-base.code",
      "position": [
        3080,
        960
      ],
      "parameters": {
        "jsCode": "const item1 = $input.all()[0]?.json;\nconst jsonString = JSON.stringify(item1);\nconst escapedJsonString = jsonString.replace(/\"/g, '\\\\\"');\n\nreturn { escapedJsonString };\n"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "39cab0c4-1d7d-41cb-a88d-00acc8e79a24",
      "name": "Wait2",
      "type": "n8n-nodes-base.wait",
      "position": [
        3720,
        1400
      ],
      "webhookId": "68ae5068-6a39-424c-b88d-019bfee78b6f",
      "parameters": {
        "unit": "seconds"
      },
      "typeVersion": 1,
      "notes": "This wait node performs automated tasks as part of the workflow."
    },
    {
      "id": "54205ed2-7c96-44b6-9637-20830300310a",
      "name": "HTTP Request1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2820,
        1180
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "options": {},
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "key",
              "value": "982dc86a0c1bd4c71185d39ae9f36998"
            },
            {
              "name": "data",
              "value": "={\"TaxCode\":\"{{JSON.parse($json[\"required_action\"][\"submit_tool_outputs\"][\"tool_calls\"][0][\"function\"][\"arguments\"]).src}}\",\"NACE\":\"info\",\"VAT\":\"\", \"RegNo\":\"\", \"Status\":\"\", \"LegalForm\":\"\", \"Name\":\"\", \"Date\":\"\", \"TownCode\":\"\", \"County\":\"\", \"City\":\"\", \"Address\":\"\", \"Administrators\":\"\", \"Shareholders\":\"\", \"Balance\":\"latest\", \"Phone\":\"\", \"Mobile\":\"\", \"Fax\":\"\", \"Email\":\"\", \"Web\":\"\", \"Geolocation\":\"\", \"Description\":\"\", \"Trademarks\":\"\", \"Subsidiaries\":\"\", \"Branches\":\"\", \"FiscalActivity\":\"\", \"Obligations\":\"\", \"Links\":\"\"}"
            }
          ]
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "862ab78d-0288-4c78-9e02-7ad4ff794a6d",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "position": [
        3060,
        1180
      ],
      "parameters": {
        "jsCode": "const item1 = $input.all()[0]?.json;\nconst jsonString = JSON.stringify(item1);\nconst escapedJsonString = jsonString.replace(/\"/g, '\\\\\"');\n\nreturn { escapedJsonString };\n"
      },
      "typeVersion": 2,
      "notes": "This code node performs automated tasks as part of the workflow."
    },
    {
      "id": "e9d1d277-107d-403c-9911-5faa4ae75671",
      "name": "Submit Data1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        3260,
        1180
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"tool_outputs\": [\n        {\n            \"tool_call_id\": \"{{ $('Select Function').item.json[\"required_action\"][\"submit_tool_outputs\"][\"tool_calls\"][0][\"id\"] }}\",\n            \"output\": \"{{$json.escapedJsonString}}\"\n        }\n    ]\n} ",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "alwaysOutputData": true,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "28e7637b-9a3b-49ba-b4c7-efd3f6cf0522",
      "name": "Wait3",
      "type": "n8n-nodes-base.wait",
      "position": [
        3460,
        1360
      ],
      "webhookId": "6d7d039c-8a4b-4178-8d31-57fb3c24ac14",
      "parameters": {
        "unit": "seconds"
      },
      "typeVersion": 1,
      "notes": "This wait node performs automated tasks as part of the workflow."
    },
    {
      "id": "2b954546-8bc6-4028-9826-37a64d2aed04",
      "name": "respondHubspotMessage1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2820,
        420
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "method": "POST",
        "options": {},
        "sendBody": true,
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "bodyParameters": {
          "parameters": [
            {
              "name": "type",
              "value": "MESSAGE"
            },
            {
              "name": "richText",
              "value": "={{ $json.data[0].content[0].text.value }}"
            },
            {
              "name": "senderActorId",
              "value": "A-5721819"
            },
            {
              "name": "channelId",
              "value": "={{ $('getHubspotMessage').item.json.channelId }}"
            },
            {
              "name": "channelAccountId",
              "value": "={{ $('getHubspotMessage').item.json.channelAccountId }}"
            },
            {
              "name": "text",
              "value": "{{ $json.data[0].content[0].text.value }}"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "hubspotAppToken": {
          "id": "56nluFhXiGjYN1EY",
          "name": "HubSpot App Token tinder"
        },
        "hubspotOAuth2Api": {
          "id": "y6819fYl4TsW9gl6",
          "name": "HubSpot account 6"
        },
        "hubspotDeveloperApi": {
          "id": "dHB9nVcnZTqf2JDX",
          "name": "HubSpot Developer account"
        }
      },
      "typeVersion": 4.1,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "6facd7e9-5cbd-4eb7-ab22-84b4fbf35885",
      "name": "If Node",
      "type": "n8n-nodes-base.if",
      "position": [
        640,
        600
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $('getHubspotMessage').item.json[\"senders\"][0][\"actorId\"] }}",
              "value2": "A-5721819",
              "operation": "notEqual"
            }
          ]
        }
      },
      "typeVersion": 1,
      "notes": "This if node performs automated tasks as part of the workflow."
    },
    {
      "id": "9410bce8-3a2d-4852-acbd-8baa7ee4964d",
      "name": "Airtable",
      "type": "n8n-nodes-base.airtable",
      "position": [
        860,
        600
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appGAPr0tOy8J0NXC",
          "cachedResultUrl": "{{ $env.WEBHOOK_URL }}",
          "cachedResultName": "Hubspot Conversations ChatGPT"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbljZ0POq35jgnKES",
          "cachedResultUrl": "{{ $env.WEBHOOK_URL }}",
          "cachedResultName": "Conversations"
        },
        "options": {},
        "operation": "search",
        "filterByFormula": "={Hubspot Thread ID}=\"{{ $json.conversationsThreadId }}\""
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "Ha1BL7JqKQIwX3H1",
          "name": "Hubspot Conversations Makeitfuture Management"
        }
      },
      "typeVersion": 2,
      "alwaysOutputData": true,
      "notes": "This airtable node performs automated tasks as part of the workflow."
    },
    {
      "id": "06449687-7521-4151-89c5-050a2768af13",
      "name": "IF1",
      "type": "n8n-nodes-base.if",
      "position": [
        1040,
        640
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $('Airtable').item.json.id }}",
              "operation": "isEmpty"
            }
          ]
        }
      },
      "typeVersion": 1,
      "notes": "This if node performs automated tasks as part of the workflow."
    },
    {
      "id": "65c3015e-760f-41e8-9d18-05492cf908c8",
      "name": "createThread",
      "type": "n8n-nodes-base.airtable",
      "position": [
        1440,
        420
      ],
      "parameters": {
        "base": {
          "__rl": true,
          "mode": "list",
          "value": "appGAPr0tOy8J0NXC",
          "cachedResultUrl": "{{ $env.WEBHOOK_URL }}",
          "cachedResultName": "Hubspot Conversations ChatGPT"
        },
        "table": {
          "__rl": true,
          "mode": "list",
          "value": "tbljZ0POq35jgnKES",
          "cachedResultUrl": "{{ $env.WEBHOOK_URL }}",
          "cachedResultName": "Conversations"
        },
        "columns": {
          "value": {
            "OpenAI Thread ID": "={{ $json[\"id\"] }}",
            "Hubspot Thread ID": "={{ $('getHubspotMessage').item.json.conversationsThreadId }}"
          },
          "schema": [
            {
              "id": "Hubspot Thread ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "Hubspot Thread ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "OpenAI Thread ID",
              "type": "string",
              "display": true,
              "removed": false,
              "readOnly": false,
              "required": false,
              "displayName": "OpenAI Thread ID",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": []
        },
        "options": {},
        "operation": "create"
      },
      "credentials": {
        "airtableTokenApi": {
          "id": "Ha1BL7JqKQIwX3H1",
          "name": "Hubspot Conversations Makeitfuture Management"
        }
      },
      "typeVersion": 2,
      "notes": "This airtable node performs automated tasks as part of the workflow."
    },
    {
      "id": "14cd4854-34fa-4a40-8bd2-cce2d9da9571",
      "name": "OpenAI Run1",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1620,
        780
      ],
      "parameters": {
        "url": "{{ $env.BASE_URL }}",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n    \"assistant_id\": \"asst_MA71Jq0SElVpdjmJa212CTFd\"\n}",
        "sendBody": true,
        "sendHeaders": true,
        "specifyBody": "json",
        "authentication": "{{ $credentials.predefinedCredentialType }}",
        "headerParameters": {
          "parameters": [
            {
              "name": "openai-beta",
              "value": "assistants=v1"
            }
          ]
        },
        "nodeCredentialType": "YOUR_CREDENTIAL_HERE"
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 4.1,
      "continueOnFail": true,
      "alwaysOutputData": false,
      "notes": "This httpRequest node performs automated tasks as part of the workflow."
    },
    {
      "id": "7c37641f-b0a4-4031-b289-3d6aed5a5bd6",
      "name": "IF2",
      "type": "n8n-nodes-base.if",
      "position": [
        60,
        600
      ],
      "parameters": {
        "conditions": {
          "string": [
            {
              "value1": "={{ $json[\"body\"][0][\"messageId\"] }}",
              "operation": "isNotEmpty"
            }
          ]
        }
      },
      "typeVersion": 1,
      "notes": "This if node performs automated tasks as part of the workflow."
    },
    {
      "id": "12744ebd-1d36-4f3c-9cbe-2ed7d18d37e3",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -200,
        440
      ],
      "parameters": {
        "width": 640.1970959824021,
        "height": 428.68258455167785,
        "content": "Watch for new message on the chatbot. \nThis can be triggered with [n8n chat widget]({{ $env.WEBHOOK_URL }} hubspot or other chat services. \n\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "9c200085-e9aa-4e11-93c2-da8184976229",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2480,
        340
      ],
      "parameters": {
        "width": 615.2010006500725,
        "height": 279.76857176586907,
        "content": "Post assistant Message back to chat service, in this case Hubspot"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "4458aafb-d280-46d0-ba54-3eb4ee746892",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        300
      ],
      "parameters": {
        "width": 636.6434938094908,
        "height": 304.69360473583896,
        "content": "Create a new Thread, save it to database and RUN"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "f13f45aa-47c9-4a76-a69c-f13f51d9434f",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        480,
        440
      ],
      "parameters": {
        "width": 328.9155262250898,
        "height": 421.64797280574976,
        "content": "UPDATE USER FILTER FOR DUPLICATION"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "ba0d0a2c-5014-44b8-a281-9d5014b78bcc",
      "name": "Sticky Note6",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        840,
        440
      ],
      "parameters": {
        "width": 328.9155262250898,
        "height": 421.64797280574976,
        "content": "Search for Thread ID in a database. \n\nThis database is maintaing references between messaging service thread id and OpenI Thread ID. "
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "3d3562b5-631f-405c-b671-6856214f167f",
      "name": "Sticky Note7",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1200,
        680
      ],
      "parameters": {
        "width": 636.6434938094908,
        "height": 304.69360473583896,
        "content": "POST a new message to existing thread."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "9ad1622c-5b42-4279-bf16-edf7bcbb5155",
      "name": "Sticky Note8",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1900,
        320
      ],
      "parameters": {
        "width": 393.4831089305742,
        "height": 629.4777449641093,
        "content": "Get Run Status:\nIf still in progress, run again. \nIf action needed go to respective action.\nIf Completed, post message."
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "e51965ef-7694-41b3-9c9a-9f78c00af3f3",
      "name": "Sticky Note9",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        2538.191410231545,
        840
      ],
      "parameters": {
        "width": 1361.867818730004,
        "height": 731.995091888263,
        "content": "Run required actions based on Assistant answer and respond to Assistant with the function answer. \n\nEach route is a function that you need to define inside your assistant configuration.\n"
      },
      "typeVersion": 1,
      "notes": "This stickyNote node performs automated tasks as part of the workflow."
    },
    {
      "id": "706fb261-724e-4c22-8def-24a320d213a2",
      "name": "OpenAI",
      "type": "n8n-nodes-base.noOp",
      "position": [
        1280,
        780
      ],
      "parameters": {
        "text": "={{ $('getHubspotMessage').item.json[\"text\"] }}",
        "prompt": "define",
        "options": {
          "baseURL": "{{ $env.API_BASE_URL }}{{ $('Airtable').item.json[\"OpenAI Thread ID\"] }}/messages"
        },
        "resource": "assistant",
        "assistantId": {
          "__rl": true,
          "mode": "list",
          "value": "asst_wVbEcnRttQ8K65DOV0fk1DJU",
          "cachedResultName": "Lista Firma Agent"
        }
      },
      "credentials": {
        "openAiApi": {
          "id": "sCh1Lrc1ZT8NVcgn",
          "name": "OpenAi Makeitfuture.eu"
        }
      },
      "typeVersion": 1.3,
      "notes": "This openAi node performs automated tasks as part of the workflow."
    },
    {
      "id": "b8f686cc-33d6-4e99-987c-d1f91864e81d",
      "name": "Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        -160,
        600
      ],
      "webhookId": "637d5b46-b35f-4943-92a2-864ddce170f4",
      "parameters": {
        "path": "hubspot-tinder",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 1,
      "notes": "This webhook node performs automated tasks as part of the workflow."
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1",
    "saveManualExecutions": true,
    "callerPolicy": "workflowsFromSameOwner",
    "errorWorkflow": null,
    "timezone": "UTC",
    "executionTimeout": 3600,
    "maxExecutions": 1000,
    "retryOnFail": true,
    "retryCount": 3,
    "retryDelay": 1000
  },
  "versionId": "d9763b45-9092-490f-85b4-926354cdeb47",
  "connections": {
    "7f11a684-911b-4fbc-ba1b-a8e7bce8e914": {
      "main": [
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-bc6d5ccf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-f377d00f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-1cbb3ec6",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-6097d0a1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-2ded90d3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-cbb69e8a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-0728a23c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-7f11a684-911b-4fbc-ba1b-a8e7bce8e914-a8d859bb",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "687bcbb8-38c8-4d21-a46f-186e880d003c": {
      "main": [
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-28688d3c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-7a60114f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-081e1969",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-0b5dac9e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-1617129c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-d36ab158",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-f334ccd1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-687bcbb8-38c8-4d21-a46f-186e880d003c-dc355251",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8b51d465-d298-4b7a-b939-026bd51469d3": {
      "main": [
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-94c03b9e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-3d4cd3ce",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-5c89c515",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-fe69f5d2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-c796af5f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-8c84c20a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-2e37628b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-8b51d465-d298-4b7a-b939-026bd51469d3-cdec5cbc",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "3e645c55-a236-466f-9983-2a3e91c250db": {
      "main": [
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-250b0d3a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-6c678a3e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-1e4bf304",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-04942136",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-488f780e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-8800d132",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-fd5a4f4d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-3e645c55-a236-466f-9983-2a3e91c250db-35ba12cf",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "a69a1d1e-b932-481e-8d36-8d121c63ad4b": {
      "main": [
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-03b40f29",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-939ef37d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-03f8495e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-73f9099f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-2f7d83a6",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-2ae15f23",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-c78bef4e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-a69a1d1e-b932-481e-8d36-8d121c63ad4b-3a5d02d9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "d9758207-56d4-4180-aac7-f0ebafab1064": {
      "main": [
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-8336ba57",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-27265615",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-fe9baa83",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-4f67c3e4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-eab3555d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-4a42c188",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-8d2cda43",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-d9758207-56d4-4180-aac7-f0ebafab1064-9a299369",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "f80a2cd8-6691-4186-909b-cfed95318014": {
      "main": [
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-22dc7a00",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-8053df96",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-a712b390",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-4657037c",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-79f76837",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-9983799b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-d2f74e4a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-f80a2cd8-6691-4186-909b-cfed95318014-ea7bd9b5",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "54205ed2-7c96-44b6-9637-20830300310a": {
      "main": [
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-e4545cf3",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-12ce09dd",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-084d3679",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-4a67a8e9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-96217412",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-2d9d0626",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-6aa5ff53",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-54205ed2-7c96-44b6-9637-20830300310a-eda25680",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "e9d1d277-107d-403c-9911-5faa4ae75671": {
      "main": [
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-0b04ccc0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-22d7c538",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-a51d7e07",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-7dff9645",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-925317e4",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-88540a9e",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-865ab4b0",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-e9d1d277-107d-403c-9911-5faa4ae75671-2b93a3d9",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "2b954546-8bc6-4028-9826-37a64d2aed04": {
      "main": [
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-8d456e3f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-15f63eb9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-c4b60e20",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-77eeb2a9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-b68c8a78",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-c47253ad",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-9ac6f447",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-2b954546-8bc6-4028-9826-37a64d2aed04-937499e7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "14cd4854-34fa-4a40-8bd2-cce2d9da9571": {
      "main": [
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-4822b36a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-310f727a",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-384b7992",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-b8010e8b",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-6d8291f9",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-69abb8e2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-6c0ea9ad",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-14cd4854-34fa-4a40-8bd2-cce2d9da9571-dfb1be9e",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "b8f686cc-33d6-4e99-987c-d1f91864e81d": {
      "main": [
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-5f8d7297",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-b40fdfcf",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-cc6e248f",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-0f1a210d",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-9b3580d2",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-20a88a99",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-01b2b8bd",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "error-handler-b8f686cc-33d6-4e99-987c-d1f91864e81d-5ca854f3",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "706fb261-724e-4c22-8def-24a320d213a2": {
      "main": [
        [
          {
            "node": "error-handler-706fb261-724e-4c22-8def-24a320d213a2-9a4806a7",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "description": "Automated workflow: OpenAI Assistant for Hubspot Chat. This workflow integrates 10 different services: webhook, stickyNote, httpRequest, wait, airtable. It contains 59 nodes and follows best practices for error handling and security.",
  "notes": "Excellent quality workflow: OpenAI Assistant for Hubspot Chat. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."
}