Check the example below:
{
"nodes": [
{
"parameters": {},
"name": "Start",
"type": "n8n-nodes-base.start",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"url": "https://5ea797ea052c31e95a2806ff7e3c62d5.m.pipedream.net",
"options": {}
},
"name": "HTTP Request2",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
480,
300
]
},
{
"parameters": {
"conditions": {
"string": [
{
"value1": "={{$node[\"Function\"].json[\"phone\"].match(/\\d+/g)[0]}}",
"value2": "={{$item(0).$node[\"HTTP Request2\"].json[\"body\"][\"external_number\"].match(/\\d+/g)[0]}}"
},
{
"value1": "={{$node[\"Function\"].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": [
1140,
300
]
},
{
"parameters": {},
"name": "NoOp",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
1490,
170
]
},
{
"parameters": {
"functionCode": "return [\n {\n json: {\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]\n"
},
"name": "Function2",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
720,
300
],
"notesInFlow": true,
"notes": "Mockup get customers"
},
{
"parameters": {
"functionCode": "return items[0].json.contacts.map(contact => ({ json: contact }));\n\n"
},
"name": "Function",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
940,
300
]
}
],
"connections": {
"Start": {
"main": [
[
{
"node": "HTTP Request2",
"type": "main",
"index": 0
}
]
]
},
"HTTP Request2": {
"main": [
[
{
"node": "Function2",
"type": "main",
"index": 0
}
]
]
},
"IF": {
"main": [
[
{
"node": "NoOp",
"type": "main",
"index": 0
}
]
]
},
"Function2": {
"main": [
[
{
"node": "Function",
"type": "main",
"index": 0
}
]
]
},
"Function": {
"main": [
[
{
"node": "IF",
"type": "main",
"index": 0
}
]
]
}
}
}