{ "nodes": [ { "name": "On clicking 'execute'", "type": "n8n-nodes-base.manualTrigger", "position": [ 250, 300 ], "parameters": {}, "typeVersion": 1, "id": "keap-contact-reader-trigger" }, { "id": "keap-contact-reader-read", "name": "Read first Keap contacts page", "type": "n8n-nodes-base.httpRequest", "typeVersion": 4.2, "position": [ 520, 300 ], "parameters": { "method": "GET", "url": "https://api.infusionsoft.com/crm/rest/v1/contacts", "authentication": "genericCredentialType", "genericAuthType": "oAuth2Api", "sendQuery": true, "queryParameters": { "parameters": [ { "name": "limit", "value": 100 } ] }, "options": { "timeout": 30000, "redirect": { "redirect": { "followRedirects": false } }, "response": { "response": { "responseFormat": "json", "neverError": false } } } } }, { "id": "keap-contact-reader-extract", "name": "Extract complete contact records", "type": "n8n-nodes-base.code", "typeVersion": 2, "position": [ 740, 300 ], "parameters": { "mode": "runOnceForAllItems", "jsCode": "function readKeapContacts(page) {\n if (!page || typeof page !== 'object' || Array.isArray(page) || !Array.isArray(page.contacts) || !page.contacts.every((contact) => contact && typeof contact === 'object' && !Array.isArray(contact))) {\n throw new Error('Keap did not return a contacts page');\n }\n return { contacts: page.contacts, page, count: page.contacts.length };\n}\nasync function keapContacts({ body }) {\n return readKeapContacts(body);\n}\n\nreturn readKeapContacts($input.first().json).contacts.map((json) => ({ json, pairedItem: { item: 0 } }));" } } ], "connections": { "On clicking 'execute'": { "main": [ [ { "node": "Read first Keap contacts page", "type": "main", "index": 0 } ] ] }, "Read first Keap contacts page": { "main": [ [ { "node": "Extract complete contact records", "type": "main", "index": 0 } ] ] } }, "name": "Keap Contact Reader", "settings": { "executionOrder": "v1" }, "active": false, "pinData": {} }