{
  "id": "NUFFIIXDnAoWfses",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Add, update, and fetch contacts from a Notion database using n8n",
  "tags": [
    {
      "id": "IOqTK9xv9VrD957b",
      "name": "Notion",
      "createdAt": "2026-03-24T01:47:10.492Z",
      "updatedAt": "2026-03-24T01:47:10.492Z"
    },
    {
      "id": "RqOjEiK0geGgGlAc",
      "name": "CRM",
      "createdAt": "2026-03-24T01:47:10.520Z",
      "updatedAt": "2026-03-24T01:47:10.520Z"
    }
  ],
  "nodes": [
    {
      "id": "c9e06bcb-5c0f-497c-9a4b-31f422fe893e",
      "name": "Sticky Note \u2014 Main",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -2192,
        -160
      ],
      "parameters": {
        "width": 476,
        "height": 480,
        "content": "## How it works\n1. The Manual Trigger fires with a JSON payload containing an `action` field (`create`, `update`, or `get`).\n2. The Switch node routes the request to the correct branch.\n3. **Create** \u2014 searches by email first. If the contact exists, the request is blocked. If not, a new Notion page is created.\n4. **Update** \u2014 searches by email to find the page ID automatically, then updates the matching row.\n5. **Get** \u2014 searches by email and returns the contact's full data.\n\n## Setup steps\n1. Connect your Notion account under Credentials.\n2. Open each Notion node and select your database from the list.\n3. In Notion, go to your database \u2192 `...` \u2192 Connections \u2192 add your integration.\n4. Make sure your database has these columns: `Name` (title), `Email` (email), `Phone` (phone), `Status` (select), `Notes` (text).\n5. For production use, replace the Manual Trigger with a Webhook node."
      },
      "typeVersion": 1
    },
    {
      "id": "e86f5856-122e-4d0c-9c88-61d1005dd3f8",
      "name": "Sticky Note \u2014 Create",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -512
      ],
      "parameters": {
        "color": 7,
        "width": 716,
        "height": 356,
        "content": "## Create branch\nChecks if email already exists before creating.\nBlocks duplicates automatically."
      },
      "typeVersion": 1
    },
    {
      "id": "d0e4cfa9-cda4-4727-9803-5477d45b3228",
      "name": "Sticky Note \u2014 Update",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1184,
        -128
      ],
      "parameters": {
        "color": 7,
        "width": 716,
        "height": 340,
        "content": "## Update branch\nFinds contact by email automatically.\nNo manual page ID needed."
      },
      "typeVersion": 1
    },
    {
      "id": "1ef1da76-962a-4e4c-9504-91e958ee6bc3",
      "name": "Sticky Note \u2014 Get",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1008,
        240
      ],
      "parameters": {
        "color": 7,
        "width": 364,
        "height": 276,
        "content": "## Get branch\nRetrieves a contact by email.\nReturns all Notion page properties."
      },
      "typeVersion": 1
    },
    {
      "id": "968bbc62-eb30-4bf7-a929-0d790c1e4bf8",
      "name": "Manual Trigger",
      "type": "n8n-nodes-base.manualTrigger",
      "position": [
        -1680,
        48
      ],
      "parameters": {},
      "typeVersion": 1
    },
    {
      "id": "45fca751-a90e-4ad0-a3f7-8fbaec9ef310",
      "name": "Search \u2014 Email Exists?",
      "type": "n8n-nodes-base.notion",
      "position": [
        -1120,
        -368
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "conditions": [
            {
              "key": "Email|email",
              "condition": "equals",
              "emailValue": "={{ $json.email }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_NOTION_DATABASE_ID",
          "cachedResultName": "Your Notion database name"
        },
        "filterType": "manual"
      },
      "typeVersion": 2,
      "alwaysOutputData": true
    },
    {
      "id": "ca6cdc4e-4c08-41a0-9e28-136153240ba9",
      "name": "Already Exists?",
      "type": "n8n-nodes-base.if",
      "position": [
        -896,
        -368
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "fdda1e6b-cbf3-4c51-858c-a6fe4c9253df",
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "89741cd5-db5a-407d-8440-6c62ff0fe39a",
      "name": "Block Duplicate",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -688,
        -448
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={ \"error\": \"Contact with this email already exists. Use action: update instead.\" }"
      },
      "typeVersion": 1
    },
    {
      "id": "aea1e92e-6a46-471d-9071-14a65a51ecc8",
      "name": "Search \u2014 Find by Email",
      "type": "n8n-nodes-base.notion",
      "position": [
        -1104,
        48
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "conditions": [
            {
              "key": "Email|email",
              "condition": "equals",
              "emailValue": "={{ $json.email }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_NOTION_DATABASE_ID",
          "cachedResultName": "Your Notion database name"
        },
        "filterType": "manual"
      },
      "typeVersion": 2
    },
    {
      "id": "86cbd614-e602-4c16-ac56-4907ce0e2689",
      "name": "Person Found?",
      "type": "n8n-nodes-base.if",
      "position": [
        -880,
        48
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "conditions": [
            {
              "operator": {
                "type": "string",
                "operation": "notEmpty"
              },
              "leftValue": "={{ $json.id }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "2836c871-e37a-49b1-94dd-9e7130d8a25f",
      "name": "Not Found Error",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -672,
        80
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={ \"error\": \"No contact found with that email. Use action: create instead.\" }"
      },
      "typeVersion": 1
    },
    {
      "id": "bde08172-7822-433b-adfe-dbe7cb252d2d",
      "name": "Respond",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        -288,
        48
      ],
      "parameters": {
        "options": {},
        "respondWith": "json",
        "responseBody": "={{ $json }}"
      },
      "typeVersion": 1
    },
    {
      "id": "00f3a676-3203-4750-bf26-e6c9861477d3",
      "name": "Switch1",
      "type": "n8n-nodes-base.switch",
      "position": [
        -1456,
        32
      ],
      "parameters": {
        "rules": {
          "values": [
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "f1193635-4010-4f17-96d7-d60c4a0c5db1",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.action }}",
                    "rightValue": "create"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "62f69db7-f81e-4575-b6c6-71db7578f7ff",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.action }}",
                    "rightValue": "update"
                  }
                ]
              }
            },
            {
              "conditions": {
                "options": {
                  "version": 1,
                  "leftValue": "",
                  "caseSensitive": true,
                  "typeValidation": "strict"
                },
                "combinator": "and",
                "conditions": [
                  {
                    "id": "ce5d0edb-5cff-4e21-8e82-0161acca5ee9",
                    "operator": {
                      "type": "string",
                      "operation": "equals"
                    },
                    "leftValue": "={{ $json.action }}",
                    "rightValue": "get"
                  }
                ]
              }
            }
          ]
        },
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "63a8fb78-0157-45cb-8e61-3daa98386f90",
      "name": "Notion \u2014 Create Person1",
      "type": "n8n-nodes-base.notion",
      "position": [
        -688,
        -304
      ],
      "parameters": {
        "title": "={{ $('Switch1').item.json.name }}",
        "options": {},
        "resource": "databasePage",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_NOTION_DATABASE_ID",
          "cachedResultName": "Your Notion database name"
        },
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Email|email",
              "emailValue": "={{ $('Switch1').item.json.email }}"
            },
            {
              "key": "Phone|phone_number",
              "phoneValue": "={{ $('Switch1').item.json.phone }}"
            },
            {
              "key": "Status|select",
              "selectValue": "={{ $('Switch1').item.json.status }}"
            },
            {
              "key": "Notes|rich_text",
              "textContent": "={{ $('Switch1').item.json.notes }}"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "4ffa0180-596c-4c96-a670-f5eed8b06c01",
      "name": "Notion \u2014 Update Person1",
      "type": "n8n-nodes-base.notion",
      "position": [
        -672,
        -96
      ],
      "parameters": {
        "pageId": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $json.id }}"
        },
        "options": {},
        "resource": "databasePage",
        "operation": "update",
        "propertiesUi": {
          "propertyValues": [
            {
              "key": "Name|title",
              "type": "title",
              "title": "={{ $('Manual Trigger').item.json.name }}"
            },
            {
              "key": "Email|email",
              "type": "email",
              "emailValue": "={{ $('Manual Trigger').item.json.email }}"
            },
            {
              "key": "Phone|phone_number",
              "type": "phone_number",
              "phoneValue": "={{ $('Manual Trigger').item.json.phone }}"
            },
            {
              "key": "Status|select",
              "type": "select",
              "selectValue": "={{ $('Manual Trigger').item.json.status }}"
            },
            {
              "key": "Notes|rich_text",
              "type": "rich_text",
              "textContent": "={{ $('Manual Trigger').item.json.notes }}"
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "de27e473-a6de-4fc8-ad34-d3dd59868ca2",
      "name": "Notion \u2014 Get Person1",
      "type": "n8n-nodes-base.notion",
      "position": [
        -880,
        352
      ],
      "parameters": {
        "limit": 1,
        "filters": {
          "conditions": [
            {
              "key": "Email|email",
              "condition": "equals",
              "emailValue": "={{ $json.email }}"
            }
          ]
        },
        "options": {},
        "resource": "databasePage",
        "operation": "getAll",
        "databaseId": {
          "__rl": true,
          "mode": "list",
          "value": "YOUR_NOTION_DATABASE_ID",
          "cachedResultName": "Your Notion database name"
        },
        "filterType": "manual"
      },
      "typeVersion": 2
    },
    {
      "id": "8153f3fb-6235-48b6-946f-82a27c76e466",
      "name": "Sticky Note \u2014 Switch",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1488,
        -112
      ],
      "parameters": {
        "color": 7,
        "width": 160,
        "height": 338,
        "content": "## Router\nRoutes `create`, `update`, and `get`\nto their respective branches."
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "availableInMCP": false,
    "executionOrder": "v1"
  },
  "versionId": "422c638b-3af8-4f4c-9a24-dbda0833561f",
  "connections": {
    "Switch1": {
      "main": [
        [
          {
            "node": "Search \u2014 Email Exists?",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Search \u2014 Find by Email",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notion \u2014 Get Person1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Person Found?": {
      "main": [
        [
          {
            "node": "Notion \u2014 Update Person1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Not Found Error",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Manual Trigger": {
      "main": [
        [
          {
            "node": "Switch1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Already Exists?": {
      "main": [
        [
          {
            "node": "Block Duplicate",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Notion \u2014 Create Person1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion \u2014 Get Person1": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search \u2014 Email Exists?": {
      "main": [
        [
          {
            "node": "Already Exists?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search \u2014 Find by Email": {
      "main": [
        [
          {
            "node": "Person Found?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion \u2014 Create Person1": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Notion \u2014 Update Person1": {
      "main": [
        [
          {
            "node": "Respond",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}