{ "name": "LGM — Sync each message to Attio (find or create person + log the message)", "nodes": [ { "parameters": {}, "id": "trigger", "name": "LGM Trigger (message)", "type": "@lagrowthmachine/n8n-nodes-lagrowthmachine.laGrowthMachineTrigger", "typeVersion": 1, "position": [0, 320], "credentials": { "laGrowthMachineApi": { "id": "REPLACE_ME", "name": "La Growth Machine account" } } }, { "parameters": { "method": "POST", "url": "https://api.attio.com/v2/objects/people/records/query", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ filter: { $or: [ { email_addresses: $json.lead.email }, { name: { full_name: ($json.lead.firstName + ' ' + $json.lead.lastName) } }, { linkedin: $json.lead.linkedin } ] }, limit: 1 }) }}", "options": {} }, "id": "find", "name": "Attio: find person", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [240, 320], "credentials": { "httpHeaderAuth": { "id": "REPLACE_ME", "name": "Attio API (Header Auth)" } } }, { "parameters": { "conditions": { "options": { "caseSensitive": true, "typeValidation": "loose", "version": 2 }, "combinator": "and", "conditions": [ { "id": "c1", "leftValue": "={{ $json.data.length }}", "rightValue": 0, "operator": { "type": "number", "operation": "gt" } } ] } }, "id": "exists", "name": "Person exists?", "type": "n8n-nodes-base.if", "typeVersion": 2, "position": [480, 320] }, { "parameters": { "assignments": { "assignments": [ { "id": "r1", "name": "record_id", "value": "={{ $json.data[0].id.record_id }}", "type": "string" } ] }, "options": {} }, "id": "use-existing", "name": "Use existing record", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [720, 200] }, { "parameters": { "method": "POST", "url": "https://api.attio.com/v2/objects/people/records", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ data: { values: { name: [{ first_name: $('LGM Trigger (message)').item.json.lead.firstName, last_name: $('LGM Trigger (message)').item.json.lead.lastName, full_name: ($('LGM Trigger (message)').item.json.lead.firstName + ' ' + $('LGM Trigger (message)').item.json.lead.lastName) }], email_addresses: [$('LGM Trigger (message)').item.json.lead.email], job_title: $('LGM Trigger (message)').item.json.lead.jobTitle } } }) }}", "options": {} }, "id": "create", "name": "Attio: create person", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [720, 440], "credentials": { "httpHeaderAuth": { "id": "REPLACE_ME", "name": "Attio API (Header Auth)" } } }, { "parameters": { "assignments": { "assignments": [ { "id": "r2", "name": "record_id", "value": "={{ $json.data.id.record_id }}", "type": "string" } ] }, "options": {} }, "id": "use-new", "name": "Use new record", "type": "n8n-nodes-base.set", "typeVersion": 3.4, "position": [960, 440] }, { "parameters": { "method": "PATCH", "url": "=https://api.attio.com/v2/objects/people/records/{{ $json.record_id }}", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ data: { values: { job_title: $('LGM Trigger (message)').item.json.lead.jobTitle, description: $('LGM Trigger (message)').item.json.lead.shortBio } } }) }}", "options": {} }, "id": "update", "name": "Attio: update person", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1200, 320], "credentials": { "httpHeaderAuth": { "id": "REPLACE_ME", "name": "Attio API (Header Auth)" } } }, { "parameters": { "method": "POST", "url": "https://api.attio.com/v2/notes", "authentication": "genericCredentialType", "genericAuthType": "httpHeaderAuth", "sendBody": true, "specifyBody": "json", "jsonBody": "={{ JSON.stringify({ data: { parent_object: 'people', parent_record_id: $json.data.id.record_id, title: ($('LGM Trigger (message)').item.json.messageChannel + ' message ' + ($('LGM Trigger (message)').item.json.received ? 'received' : 'sent') + ' on ' + $now.toFormat('yyyy-MM-dd HH:mm')), format: 'plaintext', content: $('LGM Trigger (message)').item.json.messageBody } }) }}", "options": {} }, "id": "note-attio", "name": "Attio: add dated note", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [1440, 320], "credentials": { "httpHeaderAuth": { "id": "REPLACE_ME", "name": "Attio API (Header Auth)" } } }, { "parameters": { "content": "## LGM message → Attio\n\nOn every inbox message (sent or received):\n1. **Find the person** in Attio with one query that matches by email, or full name, or LinkedIn URL.\n2. If none matches, **create** the person.\n3. **Update** the person with the latest info from LGM.\n4. **Log the message** as a dated note (Attio has no default message object, so a note is the clean fit).\n\n**Configure**\n- Add an **Attio API (Header Auth)** credential: header `Authorization`, value `Bearer `.\n- Attribute slugs (`job_title`, `linkedin`, `email_addresses`, `description`) vary by workspace. Adjust the JSON bodies to match yours, and drop the `linkedin` filter if you don't have that attribute.", "height": 380, "width": 480 }, "id": "note", "name": "Setup", "type": "n8n-nodes-base.stickyNote", "typeVersion": 1, "position": [0, -120] } ], "connections": { "LGM Trigger (message)": { "main": [[{ "node": "Attio: find person", "type": "main", "index": 0 }]] }, "Attio: find person": { "main": [[{ "node": "Person exists?", "type": "main", "index": 0 }]] }, "Person exists?": { "main": [ [{ "node": "Use existing record", "type": "main", "index": 0 }], [{ "node": "Attio: create person", "type": "main", "index": 0 }] ] }, "Use existing record": { "main": [[{ "node": "Attio: update person", "type": "main", "index": 0 }]] }, "Attio: create person": { "main": [[{ "node": "Use new record", "type": "main", "index": 0 }]] }, "Use new record": { "main": [[{ "node": "Attio: update person", "type": "main", "index": 0 }]] }, "Attio: update person": { "main": [[{ "node": "Attio: add dated note", "type": "main", "index": 0 }]] } }, "settings": { "executionOrder": "v1" }, "meta": { "templateCredsSetupCompleted": false } }