Hello all!,
I wanted to see if I could get some help with a workflow loop issue I am having.
I currently have 3 stages in my workflow.
Stage 1 is pulling all the access tokens in my Retool DB:
Query:
select access_token from finance
Response:
{
"data": [
{
"access_token": "access-development-12345"
},
{
"access_token": "access-development-67890"
},
{
"access_token": "access-development-56789"
}
]
}
Stage 2 is looping through each access token and running a POST API query:
Query:
POST https://api.testing.com and the body has the "{{value.access_token}}" from query1
Response:
{
"data": [
{
"accounts": [
{
"account_id": "1o3vmxa",
"balances": {
"available": 75.42,
"current": 27.69,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "7948",
"name": "Detroit",
"official_name": "Detroit",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "P4y1aqAyQ",
"balances": {
"available": 24.66,
"current": 32.41,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "8378",
"name": "Mud",
"official_name": "Mud",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "qLNJg93",
"balances": {
"available": 69.48,
"current": 69.48,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "8386",
"name": "Crush",
"official_name": "Crush",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "BDbKO0",
"balances": {
"available": 16.15,
"current": 33.8,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "9231",
"name": "MD",
"official_name": "MD",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "3oKmNzJ",
"balances": {
"available": 56.48,
"current": 98.68,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "9274",
"name": "KY",
"official_name": "KY",
"subtype": "checking",
"type": "depository"
}
],
"item": {
"available_products": [
"balance",
"signal"
],
"billed_products": [
"transactions"
],
"consent_expiration_time": "2024-12-25T04:24:08Z",
"error": null,
"institution_id": "ins_1",
"item_id": "P4y1aqA",
"products": [
"transactions"
],
"update_type": "background",
"webhook": ""
},
"request_id": "Knwx0"
},
{
"accounts": [
{
"account_id": "o8qme6",
"balances": {
"available": 33.1,
"current": 33.1,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "3633",
"name": "Business Checking Plus",
"official_name": "Business Checking Plus",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "ZwBZV5",
"balances": {
"available": 16.15,
"current": 33.8,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "9231",
"name": "Analysis Business Checking",
"official_name": "Analysis Business Checking",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "5bxZKz",
"balances": {
"available": 56.48,
"current": 98.68,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "9274",
"name": "Analysis Business Checking",
"official_name": "Analysis Business Checking",
"subtype": "checking",
"type": "depository"
}
],
"item": {
"available_products": [
"balance",
"signal"
],
"billed_products": [
"transactions"
],
"consent_expiration_time": "2024-12-25T04:26:10Z",
"error": null,
"institution_id": "ins_1",
"item_id": "pZ3BeL8",
"products": [
"transactions"
],
"update_type": "background",
"webhook": ""
},
"request_id": "CZgzl"
},
{
"accounts": [
{
"account_id": "rLmQrK73",
"balances": {
"available": 20.33,
"current": 20.33,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "0094",
"name": "CAPITAL",
"official_name": "COMMERCIAL ANALYSIS CHECKING",
"subtype": "checking",
"type": "depository"
},
{
"account_id": "BaR7xEN",
"balances": {
"available": 80.61,
"current": 80.61,
"iso_currency_code": "USD",
"limit": null,
"unofficial_currency_code": null
},
"mask": "0250",
"name": "CM",
"official_name": "COMMERCIAL CHECKING",
"subtype": "checking",
"type": "depository"
}
],
"item": {
"available_products": [
"balance",
"signal"
],
"billed_products": [
"transactions"
],
"consent_expiration_time": null,
"error": null,
"institution_id": "ins_129601",
"item_id": "aYZ4dXb",
"products": [
"transactions"
],
"update_type": "background",
"webhook": ""
},
"request_id": "cXpr"
}
]
}
Stage 3 is where I want to insert into my Retool DB with the responses from stage 2.
I am needing to insert the account_id, available, current, mask and name. I assume I need to use the loop function again to 1-by-1 insert all the records from stage 2 response but I am not sure how to do that and If I should use the value and index keys or do I need to use some JS?
I attached a screenshot of the last stage of the workflow and I need to know what to insert in the key value pairs to get the date inserted.
Any help would be appreciated.
Thanks,