Hi everyone,
I’ve been stuck on this for hours and could really use some guidance.
I’m trying to build an AI agent that generates a draft invoice based on a simple voice prompt.
With the API I’m using, once the (empty) invoice is created, a route is called to add articles in the form of a structured array—each lines
object representing an article. Here’s an example of the request body:
{
"lines": [
{
"unitPrice": "{unitPrice}",
"quantity": "{quantity}",
"quantityUnit": "unit",
"designation": "{designation}",
"type": "sale_of_goods",
"vatCode": "FR_2000",
"isDeliveryOfGoods": true
}
]
}
As you can see, I’ve replaced some values with placeholders ({}
) that the model should fill in. The goal is to be able to say something like “Add 40 books and 10 hats to the invoice”, and have the model populate the appropriate values.
The problem is: while the data is correctly filled, the agent ends up calling the route twice, each time with a single article, instead of calling it once with both articles in the same payload.
I’ve tried generating a proper JSON with both objects using CodeTool and feeding it into the HTTP Request, but I can’t figure out how to make it work—or even if it’s possible at all.
Here’s the link to the workflow:
- n8n version: 1.83.2
- Database (default: SQLite): In-memory
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Cloud
- Operating system: macOS