{
  "name": "Post de discourser",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {}
          ]
        }
      },
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        -220,
        -40
      ],
      "id": "dc748156-0590-44bb-80c2-4db5849b22d3",
      "name": "Schedule Trigger"
    },
    {
      "parameters": {
        "url": "=https://discourse.scitech.com.co/search.json?q=after:{{ $json.after }} before:{{ $json.before }}&order=latest_topic&page=1 ",
        "sendHeaders": true,
        "headerParameters": {
          "parameters": [
            {
              "name": "Api-Key",
              "value": "={{ $json['Api-Key'] }}"
            },
            {
              "name": "Api-Username",
              "value": "={{ $json['Api-Username'] }}"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        120,
        -40
      ],
      "id": "da5eafc2-291b-4a8e-a7eb-29cf7be61ae9",
      "name": "HTTP Request"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "f3cb3eb3-31ba-4089-ad2d-37a7b204bd08",
              "name": "after",
              "value": "={{ \n  new Date(new Date($json[\"timestamp\"]).getTime() - (24 * 60 * 60 * 1000))\n    .toISOString()\n    .split(\"T\")[0]\n}}\n\n",
              "type": "string"
            },
            {
              "id": "487e7639-e191-4ef8-aa2a-7ded2b857da8",
              "name": "before",
              "value": "={{ \n  new Date($json[\"timestamp\"]).toISOString().split(\"T\")[0]\n}}\n",
              "type": "string"
            },
            {
              "id": "2c48e5f1-786d-4343-a97e-064f9181131f",
              "name": "Api-Key",
              "value": "d32336430dca563a93419718343f41da1b20c1e4d4a5f4e2f224a7687eef8625",
              "type": "string"
            },
            {
              "id": "2ccb0a86-af47-4209-bd73-ab3a4aa026f3",
              "name": "Api-Username",
              "value": "brayanmezac",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        -60,
        -40
      ],
      "id": "07593c3a-be22-4d1f-bde7-4da2f7922a8e",
      "name": "Edit Fields"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 2
          },
          "conditions": [
            {
              "id": "185da42f-3e26-43e4-ada7-a8c75ea88087",
              "leftValue": "={{ $json[\"posts\"].length }}",
              "rightValue": 0,
              "operator": {
                "type": "number",
                "operation": "gt"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        280,
        -40
      ],
      "id": "1044f812-6982-4482-9c36-9f983c64dae1",
      "name": "If"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "394948f8-a1ec-48a1-849a-1563e715323a",
              "name": "document",
              "value": "=Autor: {{$json[\"name\"]}}\nUsername: {{$json[\"username\"]}}\nFecha: {{$json[\"created_at\"]}}\nMensaje: {{$json[\"blurb\"]}}\nTopic ID: {{$json[\"topic_id\"]}}\nPost Number: {{$json[\"post_number\"]}}\nLikes: {{$json[\"like_count\"]}}\n",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        720,
        80
      ],
      "id": "1c39bcd2-aa67-48b7-8ce1-b0aa35953978",
      "name": "Edit Fields1",
      "alwaysOutputData": false,
      "executeOnce": false
    },
    {
      "parameters": {},
      "type": "n8n-nodes-base.noOp",
      "typeVersion": 1,
      "position": [
        500,
        140
      ],
      "id": "9976f324-1b9f-4e9d-830a-79567d70954f",
      "name": "No Operation, do nothing"
    },
    {
      "parameters": {
        "mode": "insert",
        "tableName": {
          "__rl": true,
          "value": "documents",
          "mode": "list",
          "cachedResultName": "documents"
        },
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.vectorStoreSupabase",
      "typeVersion": 1.2,
      "position": [
        920,
        -40
      ],
      "id": "6eb13ee7-4fb7-4ec5-bbdb-06f5b06831ed",
      "name": "Supabase Vector Store",
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.embeddingsOpenAi",
      "typeVersion": 1.2,
      "position": [
        880,
        200
      ],
      "id": "d8caa488-ca38-4329-b506-284bd30ca701",
      "name": "Embeddings OpenAI",
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.documentDefaultDataLoader",
      "typeVersion": 1,
      "position": [
        1040,
        180
      ],
      "id": "3ea74075-64bd-460d-8e85-564887a86862",
      "name": "Default Data Loader"
    },
    {
      "parameters": {
        "chunkOverlap": 200,
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.textSplitterRecursiveCharacterTextSplitter",
      "typeVersion": 1,
      "position": [
        1040,
        340
      ],
      "id": "0ea04f8d-9b83-40c2-9bfe-54b8da21e0a6",
      "name": "Recursive Character Text Splitter"
    },
    {
      "parameters": {
        "jsCode": "return items[0].json.posts.map(post => {\n  return {\n    json: post\n  };\n});\n"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        460,
        -40
      ],
      "id": "c214e2d7-2425-4673-9e7e-a426ca048c2a",
      "name": "Code"
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Edit Fields",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "No Operation, do nothing",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Edit Fields1": {
      "main": [
        []
      ]
    },
    "Embeddings OpenAI": {
      "ai_embedding": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_embedding",
            "index": 0
          }
        ]
      ]
    },
    "Recursive Character Text Splitter": {
      "ai_textSplitter": [
        [
          {
            "node": "Default Data Loader",
            "type": "ai_textSplitter",
            "index": 0
          }
        ]
      ]
    },
    "Default Data Loader": {
      "ai_document": [
        [
          {
            "node": "Supabase Vector Store",
            "type": "ai_document",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Edit Fields1",
            "type": "main",
            "index": 0
          },
          {
            "node": "Supabase Vector Store",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "ce80fb72-da67-426f-bea7-64edb667080c",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "id": "qqY7EFmT8MRswCif",
  "tags": []
}