I’m pretty new to n8n and programming stuff, so this is probably a basic question. I can’t figure out how to connect a Function node to an HTTP Request node when it’s inside an AI Agent workflow.
What I’m trying to do is call the Google Places API to find new restaurants around my area. The API returns a bunch of data, but I want to filter it to only show places with ratings above 4.0 and limit the results to just the first 10 entries. I’ve read that I need to use a Function node to process the HTTP response data, but I’m having trouble making the connection work in this setup.
Has anyone dealt with this before? I’m not sure if there’s something special about connecting nodes within the AI Agent context that I’m missing.
hey! yeah, ai workflows can be a bit confusing. first off, make sure your http node is set to return all data. then in the function node, you can do return items[0].json.results.filter(place => place.rating >= 4.0).slice(0, 10) to get the top-rated spots. it connects like u would expect!
The problem is that AI Agent workflows handle data flow differently than regular n8n workflows. When you put an HTTP Request node inside an AI Agent, configure the output parsing in the HTTP node before it hits your Function node. Google Places API responses are tricky - use $input.all()[0].json.results in your Function node instead of just items. Also check that your HTTP Request node has the right authentication headers for Google Places API. Auth failures often look like node linking problems. Your filtering logic should work once the data flows correctly between nodes.