Ok, I think I know understand what you want to do. Check the example below:
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
180,
290
]
},
{
"parameters": {
"url": "https://5ea797ea052c31e95a2806ff7e3c62d5.m.pipedream.net",
"options": {}
},
"name": "HTTP Request2",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
480,
290
]
},
{
"parameters": {
"functionCode": "const results = [];\n\nconst customers = items[0].json.customers\n\nfor (const { contacts } of customers) {\n for (const contact of contacts) {\n results.push({ json: contact })\n }\n}\n\nreturn results;"
},
"name": "Function1",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
940,
290
],
"notesInFlow": true,
"notes": "Get all contacts"
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"Function1\"].json[\"phone\"].match(/\\d+/g)[0]}}",
"value2": "={{$item(0).$node[\"HTTP Request2\"].json[\"body\"][\"external_number\"].match(/\\d+/g)[0]}}"
},
{
"value1": "={{$node[\"Function1\"].json[\"mobile\"].match(/\\d+/g)[0]}}",
"value2": "={{$item(0).$node[\"HTTP Request2\"].json[\"body\"][\"external_number\"].match(/\\d+/g)[0]}}"
}
]
},
"combineOperation": "any"
},
"name": "IF",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1170,
290
]
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1450,
420
]
},
{
"parameters": {
"functionCode": "const results = [];\n\nconst customers = items[0].json.customers\n\nfor (const customer of customers) {\n console.log(customer)\n if (customer.contacts.length === 0) {\n results.push({ json: customer })\n }\n}\n\nreturn results;"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
1040,
570
],
"notesInFlow": true,
"notes": "Get customers without a contact"
},
{
"parameters": {
"functionCode": "return [\n {\n json: {\n customers: [\n {\n \"id\": 123456789,\n \"firstname\": \"M\",\n \"lastname\": \"C\",\n \"fullname\": \"MC\",\n \"business_name\": \"Not So Clever Admin\",\n \"email\": \"[email protected]\",\n \"phone\": \"12345556922\",\n \"mobile\": \"12345556922\",\n \"created_at\": \"2018-07-19T21:04:30.161-06:00\",\n \"updated_at\": \"2020-09-09T20:49:26.594-06:00\",\n \"pdf_url\": null,\n \"address\": null,\n \"address_2\": null,\n \"city\": null,\n \"state\": null,\n \"zip\": null,\n \"latitude\": null,\n \"longitude\": null,\n \"notes\": null,\n \"get_sms\": true,\n \"opt_out\": false,\n \"disabled\": false,\n \"no_email\": false,\n \"location_name\": null,\n \"location_id\": null,\n \"properties\": {\n \"Jumpcloud\": \"\",\n \"Splashtop\": \"\",\n \"ATTENTION: \": \"\",\n \"AutoElevate\": \"0\",\n \"Cylance Name\": \"\",\n \"Invoice Name\": \"\",\n \"Acronis Token\": \"\",\n \"DNSFilter Key\": \"\",\n \"Huntress Name\": \"\",\n \"Remote Access\": \"0\",\n \"Comet Backup PW\": \"\",\n \"Comet Backup UN\": \"\",\n \"Solarwinds Backup\": \"\",\n \"ITSP Activation Code\": \"\",\n \"Local Admin Password\": \"\",\n \"notification_billing\": \"1\",\n \"notification_reports\": \"1\",\n \"Cloud Backup Password\": \"\",\n \"Cloud Backup Username\": \"\",\n \"TIMESHEET APPROVED BY:\": \"\",\n \"notification_marketing\": \"1\"\n },\n \"online_profile_url\": \"\",\n \"tax_rate_id\": null,\n \"notification_email\": \"\",\n \"invoice_cc_emails\": \"\",\n \"invoice_term_id\": null,\n \"referred_by\": null,\n \"ref_customer_id\": null,\n \"business_and_full_name\": \"Not So Clever Admin - M C\",\n \"business_then_name\": \"Not So Clever Admin\",\n \"contacts\": [\n {\n \"id\": 111111,\n \"name\": \"Ben\",\n \"address1\": \"\",\n \"address2\": \"\",\n \"city\": \"\",\n \"state\": \"\",\n \"zip\": \"\",\n \"email\": \"[email protected]\",\n \"phone\": \"\",\n \"mobile\": \"\",\n \"latitude\": null,\n \"longitude\": null,\n \"customer_id\": 123456789,\n \"account_id\": 666,\n \"notes\": \"\",\n \"created_at\": \"2020-01-26T10:47:58.467-07:00\",\n \"updated_at\": \"2020-01-26T10:48:07.234-07:00\",\n \"vendor_id\": null,\n \"properties\": {},\n \"opt_out\": false,\n \"extension\": \"\",\n \"processed_phone\": \"\",\n \"processed_mobile\": \"\",\n \"ticket_matching_emails\": null\n },\n {\n \"id\": 222222,\n \"name\": \"M C\",\n \"address1\": \"\",\n \"address2\": null,\n \"city\": \"\",\n \"state\": \"\",\n \"zip\": \"\",\n \"email\": \"[email protected]\",\n \"phone\": \"+12345556666\",\n \"mobile\": \"+12345556667\",\n \"latitude\": null,\n \"longitude\": null,\n \"customer_id\": 123456789,\n \"account_id\": 666,\n \"notes\": null,\n \"created_at\": \"2020-05-14T13:25:40.835-06:00\",\n \"updated_at\": \"2020-05-14T13:25:40.835-06:00\",\n \"vendor_id\": null,\n \"properties\": {},\n \"opt_out\": false,\n \"extension\": null,\n \"processed_phone\": \"14031111234\",\n \"processed_mobile\": \"14032221234\",\n \"ticket_matching_emails\": null\n },\n {\n \"id\": 333333,\n \"name\": \"M C\",\n \"address1\": \"\",\n \"address2\": null,\n \"city\": \"\",\n \"state\": \"\",\n \"zip\": \"\",\n \"email\": \"[email protected]\",\n \"phone\": \"+14431111234\",\n \"mobile\": null,\n \"latitude\": null,\n \"longitude\": null,\n \"customer_id\": 123456789,\n \"account_id\": 666,\n \"notes\": null,\n \"created_at\": \"2020-01-27T17:02:12.005-07:00\",\n \"updated_at\": \"2020-01-30T22:04:58.166-07:00\",\n \"vendor_id\": null,\n \"properties\": {},\n \"opt_out\": false,\n \"extension\": null,\n \"processed_phone\": \"\",\n \"processed_mobile\": null,\n \"ticket_matching_emails\": null\n },\n {\n \"id\": 444444,\n \"name\": \"M T\",\n \"address1\": \"\",\n \"address2\": null,\n \"city\": \"\",\n \"state\": \"\",\n \"zip\": \"\",\n \"email\": \"[email protected]\",\n \"phone\": \"+1 (555) 666-7777\",\n \"mobile\": \"15557776666\",\n \"latitude\": null,\n \"longitude\": null,\n \"customer_id\": 123456789,\n \"account_id\": 666,\n \"notes\": null,\n \"created_at\": \"2020-05-14T13:25:11.213-06:00\",\n \"updated_at\": \"2020-05-14T13:25:11.213-06:00\",\n \"vendor_id\": null,\n \"properties\": {},\n \"opt_out\": false,\n \"extension\": null,\n \"processed_phone\": \"\",\n \"processed_mobile\": \"\",\n \"ticket_matching_emails\": null\n },\n {\n \"id\": 555555,\n \"name\": \"T I\",\n \"address1\": null,\n \"address2\": null,\n \"city\": null,\n \"state\": null,\n \"zip\": null,\n \"email\": \"[email protected]\",\n \"phone\": \"+14567890200\",\n \"mobile\": \"+14567782663\",\n \"latitude\": null,\n \"longitude\": null,\n \"customer_id\": 123456789,\n \"account_id\": 666,\n \"notes\": null,\n \"created_at\": \"2020-05-14T13:25:49.367-06:00\",\n \"updated_at\": \"2020-05-14T13:25:49.367-06:00\",\n \"vendor_id\": null,\n \"properties\": {},\n \"opt_out\": false,\n \"extension\": null,\n \"processed_phone\": \"\",\n \"processed_mobile\": \"\",\n \"ticket_matching_emails\": null\n }\n ]\n },\n {\n \"id\": 12345678909,\n \"firstname\": \"M\",\n \"lastname\": \"C\",\n \"fullname\": \"MC\",\n \"business_name\": \"Not So Clever Admin\",\n \"email\": \"[email protected]\",\n \"phone\": \"12312345556922\",\n \"mobile\": \"123121345556922\",\n \"created_at\": \"2018-07-19T21:04:30.161-06:00\",\n \"updated_at\": \"2020-09-09T20:49:26.594-06:00\",\n \"pdf_url\": null,\n \"address\": null,\n \"address_2\": null,\n \"city\": null,\n \"state\": null,\n \"zip\": null,\n \"latitude\": null,\n \"longitude\": null,\n \"notes\": null,\n \"get_sms\": true,\n \"opt_out\": false,\n \"disabled\": false,\n \"no_email\": false,\n \"location_name\": null,\n \"location_id\": null,\n \"properties\": {\n \"Jumpcloud\": \"\",\n \"Splashtop\": \"\",\n \"ATTENTION: \": \"\",\n \"AutoElevate\": \"0\",\n \"Cylance Name\": \"\",\n \"Invoice Name\": \"\",\n \"Acronis Token\": \"\",\n \"DNSFilter Key\": \"\",\n \"Huntress Name\": \"\",\n \"Remote Access\": \"0\",\n \"Comet Backup PW\": \"\",\n \"Comet Backup UN\": \"\",\n \"Solarwinds Backup\": \"\",\n \"ITSP Activation Code\": \"\",\n \"Local Admin Password\": \"\",\n \"notification_billing\": \"1\",\n \"notification_reports\": \"1\",\n \"Cloud Backup Password\": \"\",\n \"Cloud Backup Username\": \"\",\n \"TIMESHEET APPROVED BY:\": \"\",\n \"notification_marketing\": \"1\"\n },\n \"online_profile_url\": \"\",\n \"tax_rate_id\": null,\n \"notification_email\": \"\",\n \"invoice_cc_emails\": \"\",\n \"invoice_term_id\": null,\n \"referred_by\": null,\n \"ref_customer_id\": null,\n \"business_and_full_name\": \"Not So Clever Admin - M C\",\n \"business_then_name\": \"Not So Clever Admin\",\n \"contacts\": [\n \n ]\n }\n]\n },\n }\n]"
},
"name": "Function2",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
690,
290
],
"notesInFlow": true,
"notes": "Mockup get customers"
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "HTTP Request2",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request2": {
"main": [
[
{
"node": "Function2",
"type": "main",
"index": 0
}
]
]
},
"Function1": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
null,
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Function2": {
"main": [
[
{
"node": "Function1",
"type": "main",
"index": 0
},
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
}
}
}