Getting all of an API response

Hello all. My bot is calling an API endpoint, which returns some search results in a json packet. It works fine via curl / postman:

curl -X POST -H "x-api-key: $LAMBDA_ENVIRONMENT_SECRET_LAMBDA_API_KEY" -H "content-type: application/text" \
https://ldaj5gtfffs3jnksz6ctcseybe0raqqu.lambda-url.us-east-1.on.aws/ \
-d '{
  "query": "Tell me about the sources of lasers",
  "limit": 4
}'

{"results":[{"manual_date":"20191121","models":["bizhub C360i","bizhub C300i".......


However if I call this via an api block in voiceflow, the output always gets rendered to [Object Object]
The api block is configured to capture the output like this:

Capture Response:
response
APPLY TO {manual_results}

manual_results is ALWAYS set to [Object Object], which is obviously Java trying to output an object to a string..... fair enough... so I wrote a function which stringify's the Object:


export default async function main(args) {
    // Extracting input variables
    const knowledge = JSON.stringify(args.inputVars.knowledge);
    return .... knowledge.... etc..
   ....
}


But that doesnt work because its input is literally '[Object Object]', (as the API step is outputting) so it outputs the same.

I have also tried having the function make the API call, but it crashes my browser, making me wonder if functions run client side.... which wouldnt work for me anyway because it would expose the API key....

Does anyone have any suggestions of how to get full json responses from API blocks?

EDIT: Yes Im doing RAG in another system, and sadly VF's knowledge base is not man enough for the size of the documents in question, hence the API call.
Screenshot_2024-04-16_at_06.35.25.png
Was this page helpful?