{
  "id": "1PsfrGmuCPYsCgOZ",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "\ud83d\udcc7 Business Card OCR \u2192 Notion Database",
  "tags": [],
  "nodes": [
    {
      "id": "e33714b7-d749-4238-9d3c-e2d353639e8f",
      "name": "On form submission",
      "type": "n8n-nodes-base.formTrigger",
      "position": [
        -112,
        0
      ],
      "parameters": {
        "options": {},
        "formTitle": "business_card",
        "formFields": {
          "values": [
            {
              "fieldType": "file",
              "fieldLabel": "business_card",
              "multipleFiles": false,
              "requiredField": true,
              "acceptFileTypes": ".jpg,.png,.jpeg"
            },
            {
              "fieldLabel": "category",
              "requiredField": true
            }
          ]
        }
      },
      "typeVersion": 2.3
    },
    {
      "id": "def20233-fd45-4cdb-b3d9-2aa08888da99",
      "name": "Analyze image",
      "type": "@n8n/n8n-nodes-langchain.googleGemini",
      "position": [
        144,
        0
      ],
      "parameters": {
        "text": "{\n  \"Name\": \"Jung Hyun Park\",\n  \"Position\": \"Head of Development\",\n  \"Phone\": \"021231234\",\n  \"Mobile\": \"0101231234\",\n  \"Email\": \"user@example.com\",\n  \"Company\": \"TOV\",\n  \"Address\": \"6F, Donga Building, 212, Yeoksam-ro, Gangnam-gu, Seoul\",\n  \"Website\": \"www.tov.com\"\n}\n",
        "modelId": {
          "__rl": true,
          "mode": "list",
          "value": "models/gemini-1.5-flash-latest",
          "cachedResultName": "models/gemini-1.5-flash-latest"
        },
        "options": {},
        "resource": "image",
        "inputType": "binary",
        "operation": "analyze",
        "binaryPropertyName": "business_card"
      },
      "credentials": {
        "googlePalmApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "afb9f7bc-2a41-4e89-bac8-7cd69068be5c",
      "name": "Create a database page",
      "type": "n8n-nodes-base.notion",
      "position": [
        560,
        0
      ],
      "parameters": {
        "title": "={{ $json.Name }}",
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "27763dbe-4d07-80e1-8056-ef87cb74ded0",
          "cachedResultUrl": "https://www.notion.so/27763dbe4d0780e18056ef87cb74ded0",
          "cachedResultName": "\uace0\uac1d \uba85\ud568 \uae30\ub85d"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "\uc5f0\ub77d\ucc98|phone_number",
              "phoneValue": "={{ $json.Phone }}"
            },
            {
              "key": "\uc774\ub984|title",
              "title": "={{ $json.Name }}"
            },
            {
              "key": "\uc774\uba54\uc77c|email",
              "emailValue": "={{ $json.Email }}"
            },
            {
              "key": "\uc8fc\uc18c|rich_text",
              "textContent": "={{ $json.Address }}"
            },
            {
              "key": "\ud68c\uc0ac\uba85|rich_text",
              "textContent": "={{ $json.Company }}"
            },
            {
              "key": "\ud734\ub300\ud3f0|phone_number",
              "phoneValue": "={{ $json.Mobile }}"
            },
            {
              "key": "\ud648\ud398\uc774\uc9c0|rich_text",
              "textContent": "={{ $json.Website }}"
            }
          ]
        }
      },
      "credentials": {
        "notionApi": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 2.2
    },
    {
      "id": "11fceae0-cfb6-4632-8f0f-f4268473a9ab",
      "name": "Parse to Json",
      "type": "n8n-nodes-base.code",
      "position": [
        352,
        0
      ],
      "parameters": {
        "jsCode": "const rawText = $input.first().json.content.parts[0].text\n\nconst result = safeJsonToObject(rawText)\n\n\nreturn [result];\n\nfunction safeJsonToObject(jsonString) {\n  \n  const trimmed = jsonString.trim();\n\n  \n  const cleaned = trimmed\n    .replace(/^```json\\s*/i, '') \n    .replace(/```$/i, '');       \n\n  \n  try {\n    return JSON.parse(cleaned);\n  } catch (err) {\n    \n    return null; \n  }\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "e254add7-e9e9-4c24-a3d6-c8ad29ad8925",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -976,
        -160
      ],
      "parameters": {
        "width": 800,
        "height": 592,
        "content": "# \ud83d\udcc7 Business Card OCR \u2192 Notion Database\n\nThis workflow automates the process of extracting key information from a **business card image** and storing it into a **Notion database**.\n\n### \u2699\ufe0f Workflow Steps\n1. **Form Submission**: Upload a business card image (`.jpg`, `.png`, `.jpeg`) and select a category.  \n2. **Gemini Vision Analysis**: The uploaded image is processed by Google Gemini to extract text information (Name, Position, Phone, Email, etc.).  \n3. **Parse JSON**: Extracted text is cleaned and parsed into structured JSON.  \n4. **Save to Notion**: The parsed contact details are stored in your Notion database (`Customer Business Cards`).\n\n### \ud83d\udccc Example Extracted Data\n```json\n{\n  \"Name\": \"Jin Park\",\n  \"Position\": \"Head of Development\",\n  \"Phone\": \"021231234\",\n  \"Mobile\": \"0101231234\",\n  \"Email\": \"abc@dc.com\",\n  \"Company\": \"\",\n  \"Address\": \"6F, Donga Building, 212, Yeoksam-ro, Gangnam-gu, Seoul\",\n  \"Website\": \"www.tov.com\"\n}\n"
      },
      "typeVersion": 1
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "1301ad51-63e9-4fef-b1a6-3135d2374508",
  "connections": {
    "Analyze image": {
      "main": [
        [
          {
            "node": "Parse to Json",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Parse to Json": {
      "main": [
        [
          {
            "node": "Create a database page",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "On form submission": {
      "main": [
        [
          {
            "node": "Analyze image",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}