
This is a script for n8n to import godaddy domains into Autotask as a Config Item. You can import the JSON in to n8n and change the relevant GoDaddy and Autotask creds and this will work nicely for you
Installation and usage
This is a script for n8n to import godaddy domains into Autotask as a Config Item. You can import the JSON in to n8n and change the relevant GoDaddy and Autotask creds and this will work nicely for you
Source codetext
{
"name": "GoDaddy Domains to Autotaskv2",
"nodes": [
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
128,
-160
],
"id": "ae3479e9-b82f-4b4b-88df-fe6abd4c5132",
"name": "When clicking 'Execute workflow'"
},
{
"parameters": {
"url": "https://api.godaddy.com/v1/domains?limit=1000",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Authorization",
"value": "sso-key e5NAkUe1wLD3_iYNPB9CxjGShbKzd2T2fX:QAZfsgEXQz67yLfnvpfV7X"
},
{
"name": "Accept",
"value": "application/json"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
352,
-160
],
"id": "09167dd5-2144-4750-8c22-dcb32356c055",
"name": "GoDaddy Get Domain Information"
},
{
"parameters": {
"jsCode": "const out = [];\n\nfunction toAutotaskDateTime(val) {\n if (!val) return null;\n const match = String(val).match(/^(\\d{4}-\\d{2}-\\d{2})/);\n if (match) return `${match[1]}T00:00:00`;\n const d = new Date(val);\n if (isNaN(d.getTime())) return null;\n const yyyy = d.getUTCFullYear();\n const mm = String(d.getUTCMonth() + 1).padStart(2, '0');\n const dd = String(d.getUTCDate()).padStart(2, '0');\n return `${yyyy}-${mm}-${dd}T00:00:00`;\n}\n\nfor (const item of $input.all()) {\n const domains = Array.isArray(item.json) ? item.json : [item.json];\n \n for (const d of domains) {\n const domain = d.domain || d.domainName || '';\n const expires = d.expires || d.expiresAt || d.expirationDate || null;\n // Extract domain name without TLD for searching\n const domainSearch = domain.replace(/\\.(com|co\\.uk|uk|net|org|io|info|biz|me|tv|cloud|dev|app|online|site|shop|store|blog|tech)$/i, '');\n \n out.push({\n json: {\n Domain: domain,\n DomainSearch: domainSearch,\n Status: d.status || '',\n ExpiresAt: expires,\n warrantyExpirationDate: toAutotaskDateTime(expires)\n }\n });\n }\n}\n\nreturn out;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
560,
-160
],
"id": "b7ee3004-99e8-498d-b8ec-2c244cfe442c",
"name": "Parse Domains",
"alwaysOutputData": true
},
{
"parameters": {
"url": "=https://webservices2.autotask.net/ATServicesRest/v1.0/Companies/query?search={\"filter\":[{\"op\":\"contains\",\"field\":\"webAddress\",\"value\":\"{{ $json.DomainSearch }}\"}]}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Username",
"value": "cy6syqbxl5m6fxc@SONDELASANDBOX.COM"
},
{
"name": "Secret",
"value": "eW*3G@8b1Nd~q$Y2P9#pyH6@$"
},
{
"name": "ApiIntegrationCode",
"value": "SWLTFAJIOJFHWWYYI6ODTB6W3AS"
}
]
},
"options": {
"batching": {
"batch": {
"batchSize": 1
}
},
"response": {
"response": {
"responseFormat": "json"
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
768,
-32
],
"id": "731e9632-f7d2-4b0d-ab2e-5c390a8ecabb",
"name": "Search Autotask Companies"
},
{
"parameters": {
"mode": "combine",
"combineBy": "combineByPosition",
"options": {}
},
"type": "n8n-nodes-base.merge",
"typeVersion": 3,
"position": [
976,
-160
],
"id": "71466295-7a38-4d0c-8d82-3dd9e56f70b6",
"name": "Merge Domain + Company"
},
{
"parameters": {
"jsCode": "const out = [];\n\nfor (const item of $input.all()) {\n const domain = item.json.Domain || '';\n const expires = item.json.warrantyExpirationDate || null;\n \n // Get company ID from search results, default to 0 if not found\n let companyID = 0;\n if (item.json.items && item.json.items.length > 0) {\n companyID = item.json.items[0].id;\n }\n \n out.push({\n json: {\n body: JSON.stringify({\n id: 0,\n companyID: companyID,\n isActive: true,\n productID: 29684167,\n referenceNumber: domain,\n referenceTitle: domain,\n warrantyExpirationDate: expires\n }),\n Domain: domain,\n CompanyID: companyID\n }\n });\n}\n\nreturn out;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1184,
-160
],
"id": "c8721b1c-fe87-46ae-bd7e-e8b5591bacd8",
"name": "Build Config Item Payload"
},
{
"parameters": {
"method": "POST",
"url": "https://webservices2.autotask.net/ATServicesRest/v1.0/ConfigurationItems",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Username",
"value": "cy6syqbxl5m6fxc@SONDELASANDBOX.COM"
},
{
"name": "Secret",
"value": "eW*3G@8b1Nd~q$Y2P9#pyH6@$"
},
{
"name": "ApiIntegrationCode",
"value": "SWLTFAJIOJFHWWYYI6ODTB6W3AS"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ $json.body }}",
"options": {
"batching": {
"batch": {
"batchSize": 1
}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1808,
-160
],
"id": "752af4fb-45cf-4a73-a077-67d9a9ec1527",
"name": "Add to Autotask configurations"
},
{
"parameters": {
"url": "=https://webservices2.autotask.net/ATServicesRest/v1.0/ConfigurationItems/query?search={\"filter\":[{\"op\":\"eq\",\"field\":\"referenceNumber\",\"value\":\"{{ $json.Domain }}\"}]}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Username",
"value": "cy6syqbxl5m6fxc@SONDELASANDBOX.COM"
},
{
"name": "Secret",
"value": "eW*3G@8b1Nd~q$Y2P9#pyH6@$"
},
{
"name": "ApiIntegrationCode",
"value": "SWLTFAJIOJFHWWYYI6ODTB6W3AS"
}
]
},
"options": {
"batching": {
"batch": {
"batchSize": 2
}
},
"response": {
"response": {}
}
}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
1392,
-160
],
"id": "7866784f-85d6-4ba5-9685-c54a8a87f96d",
"name": "Check if Config already exists"
},
{
"parameters": {
"jsCode": "const out = [];\n\n// Get the original data from Build Config Item Payload node\nconst originalItems = $('Build Config Item Payload').all();\n\nfor (let i = 0; i < $input.all().length; i++) {\n const item = $input.all()[i];\n const original = originalItems[i];\n \n // If no existing config item found, include it with original body\n if (!item.json.items || item.json.items.length === 0) {\n out.push({\n json: {\n body: original.json.body,\n Domain: original.json.Domain,\n CompanyID: original.json.CompanyID\n }\n });\n }\n}\n\nreturn out;"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1600,
-160
],
"id": "dc96ae0a-71b9-4faa-b9d9-226e38e7bf2b",
"name": "Code"
},
{
"parameters": {
"toRecipients": "chris@sondelaconsulting.com",
"subject": "=GoDaddy to Autotask Sync: {{ $json.count }} domain(s) processed",
"bodyContent": "=\n- **Subject:** `GoDaddy to Autotask Sync: {{ $json.count }} domain(s) processed`\n\nSummary:\n{{ $json.summary }}\n\nDomains created:\n{{ $json.domainList }}",
"additionalFields": {}
},
"type": "n8n-nodes-base.microsoftOutlook",
"typeVersion": 2,
"position": [
2224,
-160
],
"id": "61ae0804-52c1-49e2-8c92-8b8b5a340a71",
"name": "Send a message",
"webhookId": "5cfe7d49-c78b-4010-8d81-e3f10476d33c",
"credentials": {
"microsoftOutlookOAuth2Api": {
"id": "jiYYqykzadFFkZbs",
"name": "Microsoft Outlook account"
}
}
},
{
"parameters": {
"jsCode": "const items = $input.all();\nconst count = items.length;\n\n// Get domains from the filter node\nlet domainList = '';\n\ntry {\n const originalItems = $('Build Config Item Payload').all();\n domainList = originalItems.map(item => item.json.Domain || 'Unknown').join('\\n');\n} catch {\n // If that fails, try to parse from current items\n domainList = items.map(item => {\n if (item.json.item && item.json.item.referenceNumber) {\n return item.json.item.referenceNumber;\n }\n return 'Unknown';\n }).join('\\n');\n}\n\nreturn [{\n json: {\n count: count,\n domainList: domainList,\n summary: count > 0 \n ? `${count} new domain configuration item(s) created in Autotask.`\n : 'No new domain configuration items were created.'\n }\n}];\n"
},
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2016,
-160
],
"id": "290df344-7989-43f5-b785-832adbb101f3",
"name": "Count domains and send to outlook"
},
{
"parameters": {
"content": "## Email Step- Can be ignored\n",
"height": 288,
"width": 384
},
"type": "n8n-nodes-base.stickyNote",
"position": [
1968,
-240
],
"typeVersion": 1,
"id": "0adb3df8-d7ca-47d5-8de6-30b9d1a000c9",
"name": "Sticky Note"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
2432,
-160
],
"id": "d24968ea-4fe6-4fa1-b8d3-bb73d97bc5f9",
"name": "HTTP Request"
}
],
"pinData": {},
"connections": {
"When clicking 'Execute workflow'": {
"main": [
[
{
"node": "GoDaddy Get Domain Information",
"type": "main",
"index": 0
}
]
]
},
"GoDaddy Get Domain Information": {
"main": [
[
{
"node": "Parse Domains",
"type": "main",
"index": 0
}
]
]
},
"Parse Domains": {
"main": [
[
{
"node": "Merge Domain + Company",
"type": "main",
"index": 0
},
{
"node": "Search Autotask Companies",
"type": "main",
"index": 0
}
]
]
},
"Search Autotask Companies": {
"main": [
[
{
"node": "Merge Domain + Company",
"type": "main",
"index": 1
}
]
]
},
"Merge Domain + Company": {
"main": [
[
{
"node": "Build Config Item Payload",
"type": "main",
"index": 0
}
]
]
},
"Build Config Item Payload": {
"main": [
[
{
"node": "Check if Config already exists",
"type": "main",
"index": 0
}
]
]
},
"Check if Config already exists": {
"main": [
[
{
"node": "Code",
"type": "main",
"index": 0
}
]
]
},
"Code": {
"main": [
[
{
"node": "Add to Autotask configurations",
"type": "main",
"index": 0
}
]
]
},
"Add to Autotask configurations": {
"main": [
[
{
"node": "Count domains and send to outlook",
"type": "main",
"index": 0
}
]
]
},
"Count domains and send to outlook": {
"main": [
[
{
"node": "Send a message",
"type": "main",
"index": 0
}
]
]
},
"Send a message": {
"main": [
[
{
"node": "HTTP Request",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "b7f23f31-3283-41b3-a905-b7c6a9373f3c",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "76e55a96355eaabf905150db4479d22fc6d68159645d31d3024ed1b323cdfcd0"
},
"id": "AzqafmEWyIOQvJ93",
"tags": []
}