{
  "id": "VDgE95nJMznJZSVD",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "Feedspace Testimonials to HubSpot CRM Contacts",
  "tags": [],
  "nodes": [
    {
      "id": "f286ed24-523f-4bdd-812e-c5b79574164a",
      "name": "\ud83d\udccb Workflow Overview",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -240,
        32
      ],
      "parameters": {
        "width": 452,
        "height": 656,
        "content": "## \ud83d\udccb Feedspace Testimonials to HubSpot CRM Contacts\n@[youtube](AtR84TFFiSI)\n\n### Who is this for?\nBusinesses using **Feedspace** to collect testimonials (text, video, or audio) who want to automatically sync customer feedback to **HubSpot CRM**.\n\n### What does it do?\n- Receives testimonials from Feedspace via webhook\n- Creates or updates contacts in HubSpot\n- Attaches detailed testimonial notes to contacts\n- Supports text, video, and audio testimonials\n\n### How it works\n1. **Webhook** receives testimonial data from Feedspace\n2. **Code node** extracts and normalizes data\n3. **IF node** validates email presence\n4. **HubSpot node** upserts contact (create or update)\n5. **HTTP Request** creates associated note with testimonial\n\n### Setup Required\n1. Configure your HubSpot App Token credentials\n2. Copy the webhook URL and add it to Feedspace integrations\n3. Activate the workflow"
      },
      "typeVersion": 1
    },
    {
      "id": "ffc86bc6-2eaa-4155-adab-3fb14342d6fc",
      "name": "\ud83d\udd17 Trigger Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        272,
        240
      ],
      "parameters": {
        "color": 3,
        "width": 664,
        "height": 472,
        "content": "### \ud83d\udd17 Webhook Trigger and Data processing"
      },
      "typeVersion": 1
    },
    {
      "id": "02ca54f4-d839-478e-8900-2394e8a8cd01",
      "name": "\ud83c\udfe2 HubSpot Section",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        1008,
        224
      ],
      "parameters": {
        "color": 6,
        "width": 924,
        "height": 480,
        "content": "### \ud83c\udfe2 HubSpot Integration"
      },
      "typeVersion": 1
    },
    {
      "id": "41478a9c-456d-4c2b-be54-d12e00f2484d",
      "name": "Receive Testimonial",
      "type": "n8n-nodes-base.webhook",
      "position": [
        304,
        352
      ],
      "parameters": {
        "path": "1418f55e-c2c0-4ea4-b93c-a33890e2fa1d",
        "options": {},
        "httpMethod": "POST",
        "responseMode": "responseNode"
      },
      "typeVersion": 2
    },
    {
      "id": "59879048-dc1b-41a3-941d-862bd5267a82",
      "name": "Extract Testimonial Data",
      "type": "n8n-nodes-base.code",
      "position": [
        528,
        352
      ],
      "parameters": {
        "jsCode": "const input = $input.first().json;\n\n// Data is inside body for webhook\nconst body = input.body || input;\nconst data = body.data || {};\nconst response = data.response || {};\n\nconst name = response.Name || 'Unknown';\nconst nameParts = name.split(' ');\n\nreturn [{\n  json: {\n    feedType: body.type || '',\n    email: body.reviewer_email || response.Email || '',\n    name: name,\n    firstName: nameParts[0] || 'Unknown',\n    lastName: nameParts.slice(1).join(' ') || '',\n    phone: response.contact_number || '',\n    position: response.position || '',\n    organization: response.organization_name || '',\n    photo: response.photo || '',\n    rating: response.value || '',\n    ratingType: response.type || '',\n    comment: response.comment || response.other_text || '',\n    videoUrl: data.video_url || '',\n    audioUrl: data.audio_url || '',\n    thumbnailUrl: data.thumbnail_url || '',\n    feedId: data.feed_id || '',\n    feedUrl: data.feed_url || '',\n    formName: data.feed_form?.name || '',\n    formUrl: data.feed_form?.url || '',\n    projectName: data.project?.name || '',\n    projectLogo: data.project?.logo || '',\n    createdAt: data.created_at || '',\n    consent: response.consent || false,\n    liveMode: data.live_mode || false\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "6d46af04-24c6-44ae-a555-1e2933b1f77a",
      "name": "Has Email?",
      "type": "n8n-nodes-base.if",
      "position": [
        752,
        352
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 1,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "email-check",
              "operator": {
                "type": "string",
                "operation": "isNotEmpty"
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": ""
            },
            {
              "id": "3f2f73ca-74f2-4d62-8360-53fb21dc5f27",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              },
              "leftValue": "={{ $json.email }}",
              "rightValue": ""
            }
          ]
        }
      },
      "typeVersion": 2
    },
    {
      "id": "79364248-7a69-41c5-ad2e-ea378168fb94",
      "name": "Upsert Contact",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        1056,
        352
      ],
      "parameters": {
        "email": "={{ $json.email }}",
        "options": {},
        "authentication": "appToken",
        "additionalFields": {
          "jobTitle": "={{ $json.position }}",
          "lastName": "={{ $json.lastName }}",
          "firstName": "={{ $json.firstName }}"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "0776d87e-db20-4aab-8c2f-3d9c7004129b",
      "name": "Prepare Note Content",
      "type": "n8n-nodes-base.set",
      "position": [
        1264,
        352
      ],
      "parameters": {
        "mode": "raw",
        "options": {},
        "jsonOutput": "={\n  \"contactId\": \"{{ $json.vid }}\",\n  \"noteBody\": \"\ud83d\udcdd FEEDSPACE TESTIMONIAL\\n\\n\ud83d\udccb Type: {{ $('Extract Testimonial Data').item.json.feedType }}\\n\ud83c\udff7\ufe0f Form: {{ $('Extract Testimonial Data').item.json.formName }}\\n\ud83c\udfe2 Project: {{ $('Extract Testimonial Data').item.json.projectName }}\\n{{ $('Extract Testimonial Data').item.json.rating ? '\u2b50 Rating: ' + $('Extract Testimonial Data').item.json.rating + '/5' : '' }}\\n\\n\ud83d\udcac FEEDBACK:\\n{{ $('Extract Testimonial Data').item.json.comment }}\\n{{ $('Extract Testimonial Data').item.json.videoUrl ? '\ud83c\udfa5 Video: ' + $('Extract Testimonial Data').item.json.videoUrl : '' }}{{ $('Extract Testimonial Data').item.json.audioUrl ? '\ud83c\udf99\ufe0f Audio: ' + $('Extract Testimonial Data').item.json.audioUrl : '' }}\\n\\n\ud83d\udd17 View: {{ $('Extract Testimonial Data').item.json.feedUrl }}\\n\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\",\n  \"timestamp\": {{ Date.now() }}\n}"
      },
      "typeVersion": 3.4
    },
    {
      "id": "94f336e1-4710-479d-8a7e-da76276b87ad",
      "name": "Create Testimonial Note",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1488,
        352
      ],
      "parameters": {
        "url": "https://api.hubapi.com/crm/v3/objects/notes",
        "method": "POST",
        "options": {},
        "jsonBody": "={\n  \"properties\": {\n    \"hs_note_body\": {{ JSON.stringify($json.noteBody) }},\n    \"hs_timestamp\": {{ $json.timestamp }}\n  },\n  \"associations\": [\n    {\n      \"to\": {\n        \"id\": {{ $json.contactId }}\n      },\n      \"types\": [\n        {\n          \"associationCategory\": \"HUBSPOT_DEFINED\",\n          \"associationTypeId\": 202\n        }\n      ]\n    }\n  ]\n}",
        "sendBody": true,
        "specifyBody": "json",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotAppToken"
      },
      "credentials": {
        "hubspotAppToken": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "9f01f971-7369-4ff4-9237-24a04bc67a77",
      "name": "Respond - No Email",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        768,
        560
      ],
      "parameters": {
        "options": {
          "responseCode": 400,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        },
        "respondWith": "text",
        "responseBody": "={{ JSON.stringify({ success: false, error: 'No email provided in testimonial' }) }}"
      },
      "typeVersion": 1.1
    },
    {
      "id": "16d06732-bbd2-45a7-ae1b-a80edc2f9a5d",
      "name": "Respond - Success",
      "type": "n8n-nodes-base.respondToWebhook",
      "position": [
        1712,
        352
      ],
      "parameters": {
        "options": {
          "responseCode": 200,
          "responseHeaders": {
            "entries": [
              {
                "name": "Content-Type",
                "value": "application/json"
              }
            ]
          }
        },
        "respondWith": "text",
        "responseBody": "={{ JSON.stringify({ success: true, contactId: $('Upsert Contact').item.json.vid, noteId: $json.id, message: 'Testimonial added to HubSpot' }) }}"
      },
      "typeVersion": 1.1
    }
  ],
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "cc3208a5-de40-4495-8577-6b6b5e3b0ebb",
  "connections": {
    "Has Email?": {
      "main": [
        [
          {
            "node": "Upsert Contact",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Respond - No Email",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert Contact": {
      "main": [
        [
          {
            "node": "Prepare Note Content",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Receive Testimonial": {
      "main": [
        [
          {
            "node": "Extract Testimonial Data",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Prepare Note Content": {
      "main": [
        [
          {
            "node": "Create Testimonial Note",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create Testimonial Note": {
      "main": [
        [
          {
            "node": "Respond - Success",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Extract Testimonial Data": {
      "main": [
        [
          {
            "node": "Has Email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}