Two iterator loops before HTTP Request --> Stuck big time

Hey all,

I’m trying to iterate through a list of domains and job positions that are stored in a Google Sheet to fetch matching email addresses from the Snov.io API.

Cutting to the chase - I’m trying to run what is essentially a nested loop.

My first loop is an array of domains. For each domain, I want to pass in an array of job positions that should return results from a HTTP request.

To clarify the request looks like this:

{
“domain”: “cleancommit.io”,
“type”: “personal”,
“limit”: 3,
“lastId”: “0”,
“positions”: [
“Marketing Manager”,
“IT Rep”,
“Customer Service Person”
]
}

I’ve spent the past two days trying to get the API to accept an array for positions and it just won’t happen, so I now need to figure out how to iterate through the list of domains AND the list of positions.

I’ve got the first set of bundles firing off okay, but I’m struggling to figure out how I can force each bundle to iterate again for the list of positions.

My diagram below shows what I’m shooting for.

I’ve tried different combinations of iterators and aggregators, playing with the repeater, parsing strings as JSON, combining the Google Sheets arrays, setting the arrays manually into variables and just about everything else I can think of.

Would love some suggestions!

Thanks a ton in advance :slight_smile:

Can you show the input and output for each module you’ve got there? Mostly module 1,5 and 3 (the number in the square box - if you aren’t sure what I mean)

And what’ you got mapped in your last step

Yeah for sure.

Module 1 - Fetching the bearer token (with key hidden)
Input

[
    {
        "ca": null,
        "qs": [
            {
                "name": "grant_type",
                "value": "client_credentials"
            },
            {
                "name": "client_id",
                "value": "xxxxxxxxxxx"
            },
            {
                "name": "client_secret",
                "value": "xxxxxxxxxxx"
            }
        ],
        "url": "https://api.snov.io/v1/oauth/access_token",
        "gzip": true,
        "method": "post",
        "headers": [],
        "timeout": null,
        "useMtls": false,
        "bodyType": null,
        "serializeUrl": false,
        "shareCookies": false,
        "parseResponse": true,
        "followRedirect": true,
        "useQuerystring": false,
        "followAllRedirects": false,
        "rejectUnauthorized": true
    }
]

Output

[
    {
        "statusCode": 200,
        "headers": [
            {
                "name": "date",
                "value": "Fri, 25 Oct 2024 09:57:58 GMT"
            },
            {
                "name": "content-type",
                "value": "application/json"
            },
            {
                "name": "transfer-encoding",
                "value": "chunked"
            },
            {
                "name": "connection",
                "value": "keep-alive"
            },
            {
                "name": "server",
                "value": "nginx/1.26.2"
            },
            {
                "name": "x-powered-by",
                "value": "PHP/8.1.30"
            },
            {
                "name": "cache-control",
                "value": "no-cache, private"
            },
            {
                "name": "set-cookie",
                "value": "snov_io=Ow1AcmUqtHAVyb5OoSGEsq7Ptqg8VEB3HkCfCpm4; path=/; secure; httponly"
            },
            {
                "name": "x-xss-protection",
                "value": "1; mode=block"
            },
            {
                "name": "x-content-type-options",
                "value": "nosniff"
            },
            {
                "name": "access-control-allow-origin",
                "value": "*"
            },
            {
                "name": "access-control-allow-headers",
                "value": "*"
            },
            {
                "name": "access-control-allow-methods",
                "value": "POST, GET, OPTIONS, PUT, DELETE, PATCH"
            },
            {
                "name": "content-encoding",
                "value": "gzip"
            }
        ],
        "cookieHeaders": [
            "snov_io=Ow1AcmUqtHAVyb5OoSGEsq7Ptqg8VEB3HkCfCpm4; path=/; secure; httponly"
        ],
        "data": {
            "success": true,
            "access_token": "xxxxxxxxxx",
            "token_type": "Bearer",
            "expires_in": 3600
        },
        "fileSize": 1107
    }
]

Module 5 - Initalizing params
Input

[
    {
        "scope": "roundtrip",
        "variables": [
            {
                "name": "type",
                "value": "personal"
            },
            {
                "name": "limit",
                "value": "3"
            },
            {
                "name": "lastId",
                "value": "0"
            },
            {
                "name": "access_token",
                "value": "xxxxxxxx"
            },
            {
                "name": "currentRow",
                "value": "3"
            }
        ]
    }
]

Output

[
    {
        "type": "personal",
        "limit": "3",
        "lastId": "0",
        "access_token": "xxxxxxxx",
        "currentRow": "3"
    }
]

Module 3 - Making the request to Snov (there are 5 bundles passed to this module, so I’m just copying one of them)
Input

[
    {
        "ca": null,
        "qs": [
            {
                "name": "access_token",
                "value": "xxxxxxx"
            },
            {
                "name": "type",
                "value": "personal"
            },
            {
                "name": "limit",
                "value": "3"
            },
            {
                "name": "lastId",
                "value": "0"
            },
            {
                "name": "domain",
                "value": "www.loopearplugs.com"
            },
            {
                "name": "position",
                "value": null
            }
        ],
        "url": "https://api.snov.io/v2/domain-emails-with-info",
        "gzip": true,
        "method": "get",
        "headers": [],
        "timeout": 30,
        "useMtls": false,
        "authPass": null,
        "authUser": null,
        "bodyType": null,
        "serializeUrl": true,
        "shareCookies": true,
        "parseResponse": true,
        "followRedirect": true,
        "useQuerystring": false,
        "followAllRedirects": true,
        "rejectUnauthorized": true
    }
]

Output

[
    {
        "statusCode": 200,
        "headers": [
            {
                "name": "date",
                "value": "Fri, 25 Oct 2024 09:58:00 GMT"
            },
            {
                "name": "content-type",
                "value": "application/json"
            },
            {
                "name": "transfer-encoding",
                "value": "chunked"
            },
            {
                "name": "connection",
                "value": "keep-alive"
            },
            {
                "name": "server",
                "value": "nginx/1.26.2"
            },
            {
                "name": "x-powered-by",
                "value": "PHP/8.1.30"
            },
            {
                "name": "cache-control",
                "value": "no-cache, private"
            },
            {
                "name": "set-cookie",
                "value": "snov_io=BYF8CMm1M4MPYyhi4PbxPZPR6vXEwhSWBXA6Mtzh; path=/; secure; httponly"
            },
            {
                "name": "x-xss-protection",
                "value": "1; mode=block"
            },
            {
                "name": "x-content-type-options",
                "value": "nosniff"
            },
            {
                "name": "access-control-allow-origin",
                "value": "*"
            },
            {
                "name": "access-control-allow-headers",
                "value": "*"
            },
            {
                "name": "access-control-allow-methods",
                "value": "POST, GET, OPTIONS, PUT, DELETE, PATCH"
            },
            {
                "name": "content-encoding",
                "value": "gzip"
            }
        ],
        "cookieHeaders": [
            "snov_io=BYF8CMm1M4MPYyhi4PbxPZPR6vXEwhSWBXA6Mtzh; path=/; secure; httponly"
        ],
        "data": {
            "success": true,
            "meta": {
                "domain": "loopearplugs.com",
                "webmail": false,
                "result": 3,
                "last_id": 4,
                "limit": 3,
                "company_name": "Loop Earplugs"
            },
            "data": [
                {
                    "email": "ellen@loopearplugs.com",
                    "type": "prospect",
                    "status": "verified",
                    "position": "Marketing Manager",
                    "first_name": "Ellen",
                    "last_name": "Kruijzen",
                    "company_name": "Loop Earplugs",
                    "source_page": "https://www.linkedin.com/in/ellenkruijzen/"
                },
                {
                    "email": "dimitri@loopearplugs.com",
                    "type": "prospect",
                    "status": "verified",
                    "position": "Co-Founder",
                    "first_name": "Dimitri",
                    "last_name": "O",
                    "company_name": "Loop Earplugs",
                    "source_page": "https://www.linkedin.com/in/odimitri/"
                },
                {
                    "email": "info@loopearplugs.com",
                    "type": "prospect",
                    "status": "verified",
                    "position": "Marketing Manager",
                    "first_name": "Ellen",
                    "last_name": "Kruijzen",
                    "company_name": "Loop Earplugs",
                    "source_page": "https://www.linkedin.com/in/ellenkruijzen/"
                }
            ],
            "domain": "loopearplugs.com",
            "webmail": false,
            "result": 3,
            "lastId": 4,
            "limit": 3,
            "companyName": "Loop Earplugs",
            "emails": [
                {
                    "type": "prospect",
                    "status": "verified",
                    "email": "ellen@loopearplugs.com",
                    "position": "Marketing Manager",
                    "firstName": "Ellen",
                    "lastName": "Kruijzen",
                    "companyName": "Loop Earplugs",
                    "sourcePage": "https://www.linkedin.com/in/ellenkruijzen/"
                },
                {
                    "type": "prospect",
                    "status": "verified",
                    "email": "dimitri@loopearplugs.com",
                    "position": "Co-Founder",
                    "firstName": "Dimitri",
                    "lastName": "O",
                    "companyName": "Loop Earplugs",
                    "sourcePage": "https://www.linkedin.com/in/odimitri/"
                },
                {
                    "type": "prospect",
                    "status": "verified",
                    "email": "info@loopearplugs.com",
                    "position": "Marketing Manager",
                    "firstName": "Ellen",
                    "lastName": "Kruijzen",
                    "companyName": "Loop Earplugs",
                    "sourcePage": "https://www.linkedin.com/in/ellenkruijzen/"
                }
            ]
        },
        "fileSize": 1673
    }
]