{
  "name": "NexHello n8n webhook - From business card to Google Sheets - Template",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "nexhello-template",
        "authentication": "headerAuth",
        "responseMode": "responseNode",
        "options": {}
      },
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2.1,
      "position": [
        -1008,
        304
      ],
      "id": "4e9d9f7e-c759-4421-b003-d2746b319f40",
      "name": "Receive NexHello.com Contact",
      "webhookId": "50083be4-9355-4afc-b380-86f28934dcbb",
      "credentials": {
        "httpHeaderAuth": {
          "id": "",
          "name": ""
        }
      }
    },
    {
      "parameters": {
        "jsCode": "const inputItems = $input.all();\n\nfunction safe(value) {\n  return value ?? '';\n}\n\nfunction sheetSafe(value) {\n  const text = String(value ?? '');\n\n  if (!text) {\n    return '';\n  }\n\n  // add ' to not mistake it as a formula field\n  if (/^[=+\\-@]/.test(text)) {\n    return `'${text}`;\n  }\n\n  return text;\n}\n\nreturn inputItems.map(item => {\n\n  const body =\n    item.json?.body ??\n    item.json ??\n    {};\n\n  const contact =\n    body.data?.contact &&\n    typeof body.data.contact === 'object'\n      ? body.data.contact\n      : {};\n\n  return {\n    json: {\n      contact_id:\n        safe(contact.id),\n\n      first_name:\n        sheetSafe(contact.first_name),\n\n      last_name:\n        sheetSafe(contact.last_name),\n\n      full_name:\n        sheetSafe(contact.full_name),\n\n      company:\n        sheetSafe(contact.company),\n\n      job_title:\n        sheetSafe(contact.job_title),\n\n      about_this_person:\n        sheetSafe(contact.about_this_person),\n\n      email:\n        sheetSafe(contact.email),\n\n      phone:\n        sheetSafe(contact.phone),\n\n      website:\n        sheetSafe(contact.website),\n\n      linkedin:\n        sheetSafe(contact.linkedin),\n\n      address:\n        sheetSafe(contact.address),\n\n      event:\n        safe(body.event),\n\n      event_id:\n        safe(body.event_id),\n\n      occurred_at:\n        safe(body.occurred_at),\n\n      sent_at:\n        safe(body.sent_at),\n\n      user_id:\n        safe(body.delivery?.user_id),\n\n      idempotency_key:\n        safe(body.delivery?.idempotency_key),\n    }\n  };\n});"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        -448,
        224
      ],
      "id": "144e4eba-a3a0-4a06-9cba-8c11e9187969",
      "name": "Prepare Contact Basic Info"
    },
    {
      "parameters": {
        "operation": "appendOrUpdate",
        "documentId": {
          "__rl": true,
          "value": "",
          "mode": "list",
          "cachedResultName": "",
          "cachedResultUrl": ""
        },
        "sheetName": {
          "__rl": true,
          "value": "",
          "mode": "list",
          "cachedResultName": "",
          "cachedResultUrl": ""
        },
        "columns": {
          "mappingMode": "autoMapInputData",
          "value": {},
          "matchingColumns": [
            "contact_id"
          ],
          "schema": [
            {
              "id": "contact_id",
              "displayName": "contact_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "first_name",
              "displayName": "first_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "last_name",
              "displayName": "last_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "full_name",
              "displayName": "full_name",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "company",
              "displayName": "company",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "job_title",
              "displayName": "job_title",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "about_this_person",
              "displayName": "about_this_person",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "email",
              "displayName": "email",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "phone",
              "displayName": "phone",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "website",
              "displayName": "website",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "linkedin",
              "displayName": "linkedin",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "address",
              "displayName": "address",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "event",
              "displayName": "event",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "event_id",
              "displayName": "event_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "occurred_at",
              "displayName": "occurred_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "sent_at",
              "displayName": "sent_at",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "user_id",
              "displayName": "user_id",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            },
            {
              "id": "idempotency_key",
              "displayName": "idempotency_key",
              "required": false,
              "defaultMatch": false,
              "display": true,
              "type": "string",
              "canBeUsedToMatch": true,
              "removed": false
            }
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {
          "locationDefine": {
            "values": {}
          },
          "handlingExtraData": "insertInNewColumn",
          "useAppend": true
        }
      },
      "type": "n8n-nodes-base.googleSheets",
      "typeVersion": 4.7,
      "position": [
        48,
        144
      ],
      "id": "ef87e8b2-bd81-4e62-9c92-ea610ec45035",
      "name": "Save Contact to Google Sheets",
      "retryOnFail": true,
      "credentials": {
        "googleSheetsOAuth2Api": {
          "id": "",
          "name": ""
        }
      },
      "onError": "continueErrorOutput"
    },
    {
      "parameters": {
        "content": "## 1 - Google Sheet Setup - START HERE\n\n\n1. Create a new Google Sheet for your contacts. \n2. Open “Save Contact to Google Sheets”.  \n3. Connect your own Google account.  \n4. Select your created spreadsheet and the Leads sheet.\n5. Send a test contact and confirm the row was created.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n![Google Sheet Settings](https://www.nexhello.com/assets/integration/n8n-google-sheet-settings.png)\n\n",
        "height": 1200,
        "width": 452,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -64,
        -96
      ],
      "typeVersion": 1,
      "id": "59c0bd55-fb06-493d-956f-f3b6fd52b11c",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## 2 - Setup Webhook and NexHello App - DO THIS SECOND\n\n\n1. Configure the Webhook node URL, path and authentication.  \n2. Publish or activate this workflow.  \n3. Copy the Production Webhook URL.  \n4. In NexHello: Settings -> Manage connection.  \n5. Enter the webhook URL and authentication details.  \n6. Test the connection.  \n7. Send a contact using “Send to your system”.",
        "height": 496,
        "width": 464,
        "color": 5
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -1200,
        0
      ],
      "typeVersion": 1,
      "id": "c061f39c-b3f1-4c45-9e78-b9d5793e4647",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "c850d67a-6a0a-42b7-8f33-5cdf98ad2100",
              "leftValue": "={{ $json.body?.data?.contact?.id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "5ce5c737-e7ae-41ee-8842-3e3a0a8ff034",
              "leftValue": "={{ $json.body?.data?.contact?.full_name }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -672,
        304
      ],
      "id": "d6e11982-5226-4025-a214-8c8e6d8cbef1",
      "name": "NexHello Real Request?"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"response\": \"Test completed successfully\"\n}",
        "options": {}
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        -448,
        416
      ],
      "id": "e3cd2cd9-8d65-4e09-8e75-0371d0dddcd6",
      "name": "Test Response"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"response\": \"Information stored successfully\"\n}",
        "options": {
          "responseCode": 200
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        432,
        96
      ],
      "id": "4623ee04-dec5-4b2e-bc67-10ef1a0a5dbe",
      "name": "Success Response"
    },
    {
      "parameters": {
        "respondWith": "json",
        "responseBody": "{\n  \"response\": \"Save unsuccessful. Please try again!\"\n}",
        "options": {
          "responseCode": 422
        }
      },
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1.5,
      "position": [
        432,
        304
      ],
      "id": "74f1b48d-f66b-46cc-b454-a1979be1a17d",
      "name": "Error Response"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "strict",
            "version": 3
          },
          "conditions": [
            {
              "id": "4e530ae4-3870-4a90-95ae-67ebcac5bd66",
              "leftValue": "={{ $json.contact_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "27920795-ff0e-4277-9f63-4353fb35a1ff",
              "leftValue": "={{ $json.last_name }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "4169e003-b9fc-4f96-a7ad-f7f55d0d31b8",
              "leftValue": "={{ $json.user_id }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "28687f23-1f50-43dc-bbb5-ecdd3f5f3264",
              "leftValue": "={{ $json.idempotency_key }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.3,
      "position": [
        -224,
        224
      ],
      "id": "f9befce9-ed21-417b-9881-73536d0ce795",
      "name": "Valid Contact Data?"
    },
    {
      "parameters": {
        "content": "## START HERE\n\n\nComplete the setup in this order:\n1. Google Sheets Setup →\n2. Webhook + NexHello Setup ←\n3. Then send a test contact\n\n\n\n[Need help adapting this workflow to your business?](https://www.nexhello.com/integrations/consulting/?utm_source=n8n-google-sheet-workflow)",
        "height": 256,
        "width": 384,
        "color": 4
      },
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -576,
        -112
      ],
      "typeVersion": 1,
      "id": "4af71e0c-d3d0-4649-8202-18320d416819",
      "name": "Sticky Note2"
    }
  ],
  "pinData": {},
  "connections": {
    "Receive NexHello.com Contact": {
      "main": [
        [
          {
            "node": "NexHello Real Request?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Contact Basic Info": {
      "main": [
        [
          {
            "node": "Valid Contact Data?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Save Contact to Google Sheets": {
      "main": [
        [
          {
            "node": "Success Response",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "NexHello Real Request?": {
      "main": [
        [
          {
            "node": "Prepare Contact Basic Info",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Test Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Valid Contact Data?": {
      "main": [
        [
          {
            "node": "Save Contact to Google Sheets",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Error Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate"
  },
  "versionId": "4d36aa2e-ed8e-4e9a-94d5-80bda1961c46",
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "id": "SqXVSlTVFa2ybdB3",
  "tags": []
}
