{"id":"1","name":"Dialpad to Syncro","nodes":[{"name":"GetCustomer","type":"n8n-nodes-base.httpRequest","position":[350,180],"parameters":{"url":"{{ $env.BASE_URL }}","options":{},"authentication":"{{ $credentials.headerAuth }}"},"credentials":{"httpHeaderAuth":"Syncro"},"typeVersion":1,"id":"node-f5b13dff"},{"name":"Webhook","type":"n8n-nodes-base.webhook","position":[-60,180],"webhookId":"ec452bb5-58d9-4e0d-9cd2-c6df1c2cd957","parameters":{"path":"moezdialpad","options":{},"httpMethod":"POST","responseData":"allEntries","responseMode":"lastNode"},"typeVersion":1,"id":"node-0bb08106"},{"name":"CreateTicket","type":"n8n-nodes-base.httpRequest","position":[1190,110],"parameters":{"url":"{{ $env.BASE_URL }}","options":{"bodyContentType":"json"},"requestMethod":"POST","authentication":"{{ $credentials.headerAuth }}","bodyParametersUi":{"parameter":[{"name":"customer_id","value":"={{$node[\"Contacts\"].json[\"contacts\"][0][\"customer_id\"]}}"},{"name":"subject","value":"=Phone call from {{$node[\"Function\"].json[\"contacts\"][0][\"firstname\"]}} {{$node[\"Function\"].json[\"contacts\"][0][\"lastname\"]}} ({{$node[\"Webhook\"].json[\"body\"][\"contact\"][\"phone\"]}})"},{"name":"status","value":"In Progress"},{"name":"contact_id","value":"={{$node[\"Contacts\"].json[\"contacts\"][0][\"id\"]}}"},{"name":"user_id","value":"={{$node[\"EnvVariables\"].parameter[\"values\"][\"string\"][1][\"value\"]}}"}]}},"credentials":{"httpHeaderAuth":"Syncro"},"typeVersion":1,"id":"node-c38f5016"},{"name":"GetTicket","type":"n8n-nodes-base.httpRequest","position":[860,40],"parameters":{"url":"{{ $env.BASE_URL }}","options":{},"authentication":"{{ $credentials.headerAuth }}"},"credentials":{"httpHeaderAuth":"Syncro"},"typeVersion":1,"id":"node-52ac5a10"},{"name":"IFMoreThanOne","type":"n8n-nodes-base.if","position":[1000,40],"parameters":{"conditions":{"number":[{"value1":"={{$node[\"GetTicket\"].json[\"tickets\"].length}}","value2":1,"operation":"equal"}],"boolean":[{"value1":"={{$json[\"tickets\"]}}","value2":true}]},"combineOperation":"any"},"typeVersion":1,"id":"node-e64444d1"},{"name":"Google Sheets","type":"n8n-nodes-base.googleSheets","position":[1480,-40],"parameters":{"range":"A:B","options":{"valueInputMode":"USER_ENTERED"},"sheetId":"xxx","operation":"append"},"credentials":{"googleApi":"Google"},"typeVersion":1,"id":"node-d0a757a5"},{"name":"ForGoogle","type":"n8n-nodes-base.set","position":[1340,-40],"parameters":{"values":{"string":[{"name":"Call","value":"={{$node[\"Webhook\"].json[\"body\"][\"call_id\"]}}"},{"name":"Ticket","value":"={{$node[\"GetTicket\"].json[\"tickets\"][0][\"id\"]}}"}]},"options":{},"keepOnlySet":true},"typeVersion":1,"id":"node-10e52904"},{"name":"UpdateTicket","type":"n8n-nodes-base.httpRequest","position":[1190,-40],"parameters":{"url":"{{ $env.BASE_URL }}","options":{},"requestMethod":"POST","authentication":"{{ $credentials.headerAuth }}","bodyParametersUi":{"parameter":[{"name":"subject","value":"=Phone call from {{$node[\"GetCustomer\"].json[\"results\"][0][\"table\"][\"_source\"][\"table\"][\"firstname\"]}} {{$node[\"GetCustomer\"].json[\"results\"][0][\"table\"][\"_source\"][\"table\"][\"lastname\"]}} ({{$node[\"Webhook\"].json[\"body\"][\"contact\"][\"phone\"]}})"},{"name":"body","value":"={{$node[\"GetCustomer\"].json[\"results\"][0][\"table\"][\"_source\"][\"table\"][\"firstname\"]}} {{$node[\"GetCustomer\"].json[\"results\"][0][\"table\"][\"_source\"][\"table\"][\"lastname\"]}} called."},{"name":"hidden","value":"true"},{"name":"user_id","value":"={{$node[\"EnvVariables\"].parameter[\"values\"][\"string\"][1][\"value\"]}}"}]}},"credentials":{"httpHeaderAuth":"Syncro"},"typeVersion":1,"id":"node-b476b3f4"},{"name":"ForGoogle1","type":"n8n-nodes-base.set","position":[1340,110],"parameters":{"values":{"string":[{"name":"Call","value":"={{$node[\"Webhook\"].json[\"body\"][\"call_id\"]}}"},{"name":"Ticket","value":"={{$node[\"CreateTicket\"].json[\"ticket\"][\"id\"]}}"}]},"options":{},"keepOnlySet":true},"typeVersion":1,"id":"node-3f81313e"},{"name":"Google Sheets1","type":"n8n-nodes-base.googleSheets","position":[1480,110],"parameters":{"range":"A:B","options":{"valueInputMode":"USER_ENTERED"},"sheetId":"xxx","operation":"append"},"credentials":{"googleApi":"Google"},"typeVersion":1,"id":"node-c8e80dec"},{"name":"NoOp","type":"n8n-nodes-base.noOp","position":[830,220],"parameters":{},"typeVersion":1,"id":"node-23a17242"},{"name":"Contacts","type":"n8n-nodes-base.function","position":[510,180],"parameters":{"functionCode":"const { json: { results } } = items[0];\n\nconst getData = (results, type) => results.filter(r => r.table._index === type).map(x => ({\n   id: x.table._id,\n   firstname: x.table._source.table.firstname,\n   lastname: x.table._source.table.lastname,\n   customer_id: x.table._source.table.customer_id,\n   email: x.table._source.table.email,\n   business_name: x.table._source.table.business_name,\n   phones: x.table._source.table.phones\n }));\n \nreturn [ { json: { contacts: getData(results, 'contacts') } } ];\n"},"typeVersion":1,"alwaysOutputData":false,"id":"node-a8580e72"},{"name":"IFContacts","type":"n8n-nodes-base.if","position":[670,180],"parameters":{"conditions":{"number":[{"value1":"={{$node[\"Contacts\"].json[\"contacts\"].length}}","value2":1,"operation":"equal"}],"string":[],"boolean":[]}},"typeVersion":1,"id":"node-3b0fe79c"},{"name":"Customers","type":"n8n-nodes-base.function","position":[510,370],"parameters":{"functionCode":"const { json: { results } } = items[0];\n\nconst getData = (results, type) => results.filter(r => r.table._index === type).map(x => ({\n   id: x.table._id,\n   firstname: x.table._source.table.firstname,\n   lastname: x.table._source.table.lastname,\n   customer_id: x.table._source.table.customer_id,\n   email: x.table._source.table.email,\n   business_name: x.table._source.table.business_name,\n   phones: x.table._source.table.phones\n }));\n \nreturn [ { json: { customers: getData(results, 'customers') } } ];\n"},"typeVersion":1,"id":"node-edc3523e"},{"name":"IFCustomers","type":"n8n-nodes-base.if","position":[670,370],"parameters":{"conditions":{"number":[{"value1":"={{$node[\"Customers\"].json[\"customers\"].length}}","value2":1,"operation":"equal"}],"string":[],"boolean":[]}},"typeVersion":1,"id":"node-7145305b"},{"name":"NoOp1","type":"n8n-nodes-base.noOp","position":[810,520],"parameters":{},"typeVersion":1,"id":"node-92bac8d9"},{"name":"CreateTicketForCustomer","type":"n8n-nodes-base.httpRequest","position":[860,360],"parameters":{"url":"{{ $env.BASE_URL }}","options":{"bodyContentType":"json"},"requestMethod":"POST","authentication":"{{ $credentials.headerAuth }}","bodyParametersUi":{"parameter":[{"name":"customer_id","value":"={{$node[\"Customers\"].json[\"customers\"][0][\"id\"]}}"},{"name":"subject","value":"=Phone call from {{$node[\"Customers\"].json[\"customers\"][0][\"business_name\"]}} ({{$node[\"Webhook\"].json[\"body\"][\"contact\"][\"phone\"]}})"},{"name":"status","value":"In Progress"},{"name":"user_id","value":"={{$node[\"EnvVariables\"].parameter[\"values\"][\"string\"][1][\"value\"]}}"}]}},"credentials":{"httpHeaderAuth":"Syncro"},"typeVersion":1,"id":"node-0a40a3a7"},{"name":"ForGoogle2","type":"n8n-nodes-base.set","position":[1040,360],"parameters":{"values":{"string":[{"name":"Call","value":"={{$node[\"Webhook\"].json[\"body\"][\"call_id\"]}}"},{"name":"Ticket","value":"={{$node[\"CreateTicketForCustomer\"].json[\"ticket\"][\"id\"]}}"}]},"options":{},"keepOnlySet":true},"typeVersion":1,"id":"node-7aa1ffc7"},{"name":"Google Sheets2","type":"n8n-nodes-base.googleSheets","position":[1210,360],"parameters":{"range":"A:B","options":{"valueInputMode":"USER_ENTERED"},"sheetId":"xxx","operation":"append"},"credentials":{"googleApi":"Google"},"typeVersion":1,"id":"node-64332e9a"},{"name":"EnvVariables","type":"n8n-nodes-base.set","position":[210,180],"parameters":{"values":{"string":[{"name":"syncro_baseurl","value":"https://subdomain.syncromsp.com"},{"name":"user_id","value":"1234"}]},"options":{}},"typeVersion":1,"id":"node-46ae413c"},{"name":"IF","type":"n8n-nodes-base.if","position":[70,180],"parameters":{"conditions":{"string":[{"value1":"={{$node[\"Webhook\"].json[\"body\"][\"direction\"]}}","value2":"inbound"}]}},"typeVersion":1,"id":"node-0eb9beeb"},{"name":"NoOp2","type":"n8n-nodes-base.noOp","position":[70,370],"parameters":{},"typeVersion":1,"id":"node-d6727297"},{"id":"error-ab0202a9","name":"Error Handler","type":"n8n-nodes-base.stopAndError","typeVersion":1,"position":[1000,400],"parameters":{"message":"Workflow execution error","options":{}}}],"active":true,"settings":{"executionOrder":"v1","saveManualExecutions":true,"callerPolicy":"workflowsFromSameOwner","errorWorkflow":null,"timezone":"UTC","executionTimeout":3600,"maxExecutions":1000,"retryOnFail":true,"retryCount":3},"connections":{},"meta":{"instanceId":"workflow-bc070010","versionId":"1.0.0","createdAt":"2025-09-29T07:07:45.788720","updatedAt":"2025-09-29T07:07:45.788806","owner":"n8n-user","license":"MIT","category":"automation","status":"active","priority":"high","environment":"production"},"description":"Production-ready workflow: Dialpad to Syncro. This workflow has been optimized for production use with comprehensive error handling, security, and documentation."}