{
  "active": false,
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "HTTP Request",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "HTTP Request": {
      "main": [
        [
          {
            "node": "Filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter": {
      "main": [
        [
          {
            "node": "Filter1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Code": {
      "main": [
        [
          {
            "node": "Crypto",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Crypto": {
      "main": [
        [
          {
            "node": "Supabase",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "If": {
      "main": [
        [],
        [
          {
            "node": "Supabase1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Supabase1": {
      "main": [
        [
          {
            "node": "Brevo",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter1": {
      "main": [
        [
          {
            "node": "Code",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "createdAt": "2024-06-08T19:22:19.788Z",
  "id": "Oxk4wtVZwmFRyyMM",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "vfs",
  "nodes": [
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "id": "19793aa3-0fed-4e13-800b-1bd3b7719c76",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        220,
        260
      ]
    },
    {
      "parameters": {
        "url": "https://api.schengenvisaappointments.com/api/visa-list/",
        "options": {}
      },
      "id": "ca8f59b8-e852-40d8-8b23-7c22718409c6",
      "name": "HTTP Request",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        260
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "9603d120-ddf9-4168-ba97-e723a620d048",
              "leftValue": "={{ $json.appointment_date }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "exists",
                "singleValue": true
              }
            },
            {
              "id": "0d3ff5da-b402-4f89-8b76-0001afa53275",
              "leftValue": "={{ $json.source_country }}",
              "rightValue": "United Arab Emirates",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "0082d6f2-a7bb-40e1-8ab2-6def9993fe80",
      "name": "Filter",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [
        660,
        260
      ]
    },
    {
      "parameters": {
        "jsCode": "// Initialize the email body variable\nlet emailBody = '';\n\n// Get the input data from the previous node\nconst inputJsonData = items[0].json;\n\n// Loop through each entry in the input JSON data\nitems.forEach((item) => {\n  const data = item.json;\n  emailBody += `Source Country: ${data.source_country}\\n`;\n  emailBody += `Mission Country: ${data.mission_country}\\n`;\n  emailBody += `Appointment Date: ${data.appointment_date}\\n`;\n  emailBody += `Center: ${data.center_name}\\n`;\n  emailBody += `Visa Category: ${data.visa_category}\\n`;\n  emailBody += `Visa Sub Category: ${data.visa_subcategory}\\n`;\n  emailBody += `Book Now: ${data.book_now_link}\\n\\n`;\n});\n\n// Return the email body as a single string variable in the items array\nreturn [{json: { emailBody }}];"
      },
      "id": "3ab1e61b-ad16-4ae8-ab9e-01af32117db8",
      "name": "Code",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1060,
        260
      ]
    },
    {
      "parameters": {
        "value": "={{ $json.emailBody }}",
        "dataPropertyName": "hashed_data"
      },
      "id": "56828fd4-7985-44cd-939e-aa6de41716ad",
      "name": "Crypto",
      "type": "n8n-nodes-base.crypto",
      "typeVersion": 1,
      "position": [
        220,
        520
      ]
    },
    {
      "parameters": {
        "operation": "get",
        "tableId": "visa_hash",
        "filters": {
          "conditions": [
            {
              "keyName": "id",
              "keyValue": "1"
            }
          ]
        }
      },
      "id": "1fbe37f6-c55d-4138-81fe-398f6dff6ec0",
      "name": "Supabase",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        440,
        520
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "d7a01887-83e9-40b3-9a31-86826c09bff6",
              "leftValue": "={{ $json.hash }}",
              "rightValue": "={{ $('Crypto').item.json.hashed_data }}",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "d97e4238-5ec2-4e3f-a6db-6b071c86e327",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        660,
        520
      ]
    },
    {
      "parameters": {
        "operation": "update",
        "tableId": "visa_hash",
        "filters": {
          "conditions": [
            {
              "keyName": "id",
              "condition": "eq",
              "keyValue": "1"
            }
          ]
        },
        "fieldsUi": {
          "fieldValues": [
            {
              "fieldId": "hash",
              "fieldValue": "={{ $('Crypto').item.json.hashed_data }}"
            }
          ]
        }
      },
      "id": "85e81495-256c-4fd6-80d6-66bd68d183fb",
      "name": "Supabase1",
      "type": "n8n-nodes-base.supabase",
      "typeVersion": 1,
      "position": [
        880,
        520
      ],
      "credentials": {
        "supabaseApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "subject": "New Appointments",
        "textContent": "={{ $('Code').item.json.emailBody }}",
        "sender": "mertmr@gmail.com",
        "receipients": "mertmr@gmail.com, e.havvacelik@gmail.com",
        "additionalFields": {}
      },
      "id": "6a65df21-2fbd-4823-a935-214409b7b309",
      "name": "Brevo",
      "type": "n8n-nodes-base.sendInBlue",
      "typeVersion": 1,
      "position": [
        1100,
        520
      ],
      "credentials": {
        "sendInBlueApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict"
          },
          "conditions": [
            {
              "id": "8540e656-8e41-4753-8259-3b027cc5e0e4",
              "leftValue": "={{ $json.mission_country }}",
              "rightValue": "Netherlands",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            },
            {
              "id": "fb993c1d-0dfa-4cc3-8915-bfe50bdf319c",
              "leftValue": "={{ $json.mission_country }}",
              "rightValue": "France",
              "operator": {
                "type": "string",
                "operation": "equals",
                "name": "filter.operator.equals"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "id": "2a541cd1-fcca-4721-a96d-9e797ff19b28",
      "name": "Filter1",
      "type": "n8n-nodes-base.filter",
      "typeVersion": 2,
      "position": [
        860,
        260
      ]
    }
  ],
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": {
    "node:Schedule Trigger": {
      "recurrencyRules": []
    }
  },
  "tags": [],
  "triggerCount": 1,
  "updatedAt": "2024-07-22T08:36:03.000Z",
  "versionId": "9a7b1298-367f-4baa-83d8-0b15c19ad915"
}