AI Agent HTTP Tools (Passing Params In JSON

Describe the problem/error/question

I’m using an AI Agent with HTTP tools. The agent generates the params.
I’m trying to pass an Array of strings. [“Id”] however on testing I noticed the request would only be accepted if structured {{ [“ID”] }} and would only then recognize it as an array.

I updated the description of my HTTP AI Tool, but after 6 tests it cannot find a way to format it as JSON so that the param will be accepted.

What is the error message (if any)?

The error message is There was an error: “Request failed with status code 400”

Please share your workflow

{
“nodes”: [
{
“parameters”: {
“options”: {
“systemMessage”: “You are a helpful airbnb assistant. You can look up with HTTP requests details on customer inquiries, reservations and messages.”
}
},
“type”: “@n8n/n8n-nodes-langchain.agent”,
“typeVersion”: 1.7,
“position”: [
-180,
-720
],
“id”: “b5f954f4-d05a-47c4-90ca-30481ef5ddc6”,
“name”: “AI Agent1”
},
{
“parameters”: {
“chatId”: “6628085877”,
“text”: “={{ $json.output }}”,
“additionalFields”: {}
},
“type”: “n8n-nodes-base.telegram”,
“typeVersion”: 1.2,
“position”: [
240,
-720
],
“id”: “78acffbd-42f2-40de-8663-8756ff88276b”,
“name”: “Telegram”,
“webhookId”: “5b621e74-8db8-4144-bfec-93eb8bba627d”,
“credentials”: {
“telegramApi”: {
“id”: “SDHAvgyE0txhRBWn”,
“name”: “Telegram account”
}
}
},
{
“parameters”: {
“model”: {
“_rl": true,
“mode”: “list”,
“value”: “gpt-4o-mini”
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
-360,
-440
],
“id”: “a5232dad-625e-47af-a183-fbf8b359e90f”,
“name”: “OpenAI Chat Model1”,
“credentials”: {
“openAiApi”: {
“id”: “05HBYW1SZlBycNuI”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“inputText”: “={{ $json.chatInput }}”,
“categories”: {
“categories”: [
{
“category”: “Guest Inquiry”
},
{
“category”: “Reservation”
},
{
“category”: “Inventory”,
“description”: "Any items needed inside a rental or airbnb listing (clean sheets, towels, toilet paper, soap, etc) "
},
{
“category”: “Random”
}
]
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.textClassifier”,
“typeVersion”: 1,
“position”: [
-840,
-520
],
“id”: “4bcf5bd3-5f55-4c96-a20d-46fe18376bdd”,
“name”: “Text Classifier1”
},
{
“parameters”: {
“model”: {
rl": true,
“mode”: “list”,
“value”: “gpt-4o-mini”
},
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.lmChatOpenAi”,
“typeVersion”: 1.2,
“position”: [
-840,
-320
],
“id”: “6d43c757-129f-41ab-bc68-47eccebac81e”,
“name”: “OpenAI Chat Model2”,
“credentials”: {
“openAiApi”: {
“id”: “05HBYW1SZlBycNuI”,
“name”: “OpenAi account”
}
}
},
{
“parameters”: {
“options”: {}
},
“type”: “@n8n/n8n-nodes-langchain.chatTrigger”,
“typeVersion”: 1.1,
“position”: [
-1220,
-240
],
“id”: “d5317790-00f9-4c57-96dc-79b4d8f181ea”,
“name”: “When chat message received”,
“webhookId”: “54c2cc85-4964-47d4-8233-75cf05789be0”
},
{
“parameters”: {
“toolDescription”: “Gets customer inquiries based on property, The param is a JSON array of property IDs and must be formatted as a JSON string. \nUse JSON.stringify to convert the array into a JSON format like this: {{ JSON.stringify(["propertyID"]) }}.\n”,
“url”: “https://public.api.hospitable.com/v2/inquiries”,
“sendQuery”: true,
“parametersQuery”: {
“values”: [
{
“name”: “properties”
}
]
},
“sendHeaders”: true,
“parametersHeaders”: {
“values”: [
{
“name”: “Authorization”,
“valueProvider”: “fieldValue”,
“value”: "Bearer iJKV1QiLCJhbGciOiJWNiM2RhN2ViZDhiN2E1Y2ViNDhjYzk0ODRjOTljNzNmZTg3MTRkNGYxNDdmODMzOGJiYTQ5ZGE0ZGZhKmqDZ36LH1hgDbmaLVdFOh8sufUGq6XYbEzHD0oXdUZtwrg8IfgYgEK2KZBjboK3ywAYokLErzCHdWF-b-ekGywdU8ocMkLd5iAi17UW84zNg_XsbZc1fcW8d-5HjOgawgWbfYA0zbaMGAmVPS6kQbqb_33mRIWCc5hp0YY1GE983kdP6_x0wy_RVclyfN_sO9SU7Rte5bV6VLUpw_Kn2XMqoRAanRXjmYVS9ebz1Dr61r99hLHKFrAS0Z_N_cThCS818No76P_9crzDd7LWFsslb-lUaz-ZdZ3CNAoEcPq7jhUwLuSf3yaHzvAlsYvHuZThgOoNswGAa-eXo2PQrzvwsQJVmtH-Nnk7DnJFtsJMEPUZ7-P97i6Aw9id7bdxYHEOgCDx7y2Ljxlk4ijDwMFnxetxQO3TkAUiXmZyEyl0tFBhEu-kdpWuIVAZ3u85_YdDlbwQKvdVAHw
-EBCvVdc7YzAlEPnrrwiEbUOBhWgOyn9x-me83dXzoje9h2ndIy64vLikvcqVS73aBhDWR9iJ4uBOlmBHlY-xw3oJNyY0lJqgzvPpXapfgrM"
}
]
}
},
“type”: “@n8n/n8n-nodes-langchain.toolHttpRequest”,
“typeVersion”: 1.1,
“position”: [
100,
-360
],
“id”: “fcb65428-906f-4ce0-a036-030e51043576”,
“name”: “Inqueries”
},
{
“parameters”: {
“toolDescription”: "Get A List Of All The Properties and there ID’s you need property ID’s as params to use your other HTTP tools. You Will Need The Property ID’s To look up reservations, inquiries and messages. ",
“url”: “https://public.api.hospitable.com/v2/properties”,
“sendHeaders”: true,
“parametersHeaders”: {
“values”: [
{
“name”: “Authorization”,
“valueProvider”: “fieldValue”,
“value”: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI5YTYyNGRmMC0xMmYxLTQ0OGUtYjg4NC00MzY3ODBNAKlcBMVOXjmYVS9ebz1Dr61r99hLHKFrAS0Z_N_cThCS818No76P_9crzDd7LWFsslb-lUaz-ZdZ3CNAoEcPq7jhUwLuSf3yaHzvAlsYvHuZThgOoNswGAa-eXo2PQrzvwsQJVmtH-Nnk7DnJFtsJMEPUZ7-P97i6Aw9id7bdxYHEOgCDx7y2Ljxlk4ijDwMFnxetxQO3TkAUiXmZyEyl0tFBhEu-kdpWuIVAZ3u85_YdDlbwQKvdVAHw
-EBCvVdc7YzAlEPnrrwiEbUOBhWgOyn9x-me83dXzoje9h2ndIy64vLikvcqVS73aBhDWR9iJ4uBOlmBHlY-xw3oJNyY0lJqgzvPpXapfgrM”
}
]
}
},
“type”: “@n8n/n8n-nodes-langchain.toolHttpRequest”,
“typeVersion”: 1.1,
“position”: [
-160,
-340
],
“id”: “8f3222bf-75d1-4495-9226-2a4c862416b9”,
“name”: “Properties”
},
{
“parameters”: {
“toolDescription”: “Gets reservations (parameter takes in property ID as array of strings)”,
“url”: “https://public.api.hospitable.com/v2/reservations”,
“sendQuery”: true,
“parametersQuery”: {
“values”: [
{
“name”: “properties”
},
{
“name”: “include”,
“valueProvider”: “fieldValue”,
“value”: “financials, guest, properties, listings”
}
]
},
“sendHeaders”: true,
“parametersHeaders”: {
“values”: [
{
“name”: “Authorization”,
“valueProvider”: “fieldValue”,
“value”: "Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJhdWQiOiI5YTYyNGRmMC0xMmYxLTQ0OGUtYjg4NC00MzY3ODBhNWQzY2QiLCJqdGkiOiIyOWJmNjRiM2NmYWNiM2RhN2ViZDhiN2E1Y2ViNDhjYzk0ODRjOTljNzNmZTg3MTRkNGYxNDdmODMzOGJiYTQ5ZGE0ZGZhZGMwYzQxN2Q2NSIsImlhdCI6MTczOTQ4OTA3NS45NzEzMDgsIm5iZiI6MTczOTQ4OTA3NS45NzEzMTIsImV4cCI6MTc3MTAyNTA3NS45NjU4MTQsInN1YiI6IjI2NDE2MCIsInNjb3BlcyI6WyJwYXQ6cmVhZCIsInBhdDp3cml0ZSJdpTj_tv13KmqDZ36LH1hgDbmaLVdFOh8sufUGq6XYbEzHD0oXdUrAS0Z_N_cThCS818No76P_9crznk7DnJFtsJMEPUZ7-P97i6Aw9id7dDlbwQKvdVAHw
-EBCvVdc7YzAlEPnrrwiEbUOBhWgOyn9x-me83dXzoje9h2ndIy64vLik0lJqgzvPpXapfgrM”
}
]
}
},
“type”: “@n8n/n8n-nodes-langchain.toolHttpRequest”,
“typeVersion”: 1.1,
“position”: [
360,
-340
],
“id”: “f8e49712-1320-46c9-96ff-f410b3cb1175”,
“name”: “Reservations”
}
],
“connections”: {
“AI Agent1”: {
“main”: [
[
{
“node”: “Telegram”,
“type”: “main”,
“index”: 0
}
]
]
},
“Telegram”: {
“main”: [

]
},
“OpenAI Chat Model1”: {
“ai_languageModel”: [
[
{
“node”: “AI Agent1”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“Text Classifier1”: {
“main”: [
[
{
“node”: “AI Agent1”,
“type”: “main”,
“index”: 0
}
],
[
{
“node”: “AI Agent1”,
“type”: “main”,
“index”: 0
}
],
,

]
},
“OpenAI Chat Model2”: {
“ai_languageModel”: [
[
{
“node”: “Text Classifier1”,
“type”: “ai_languageModel”,
“index”: 0
}
]
]
},
“When chat message received”: {
“main”: [
[
{
“node”: “Text Classifier1”,
“type”: “main”,
“index”: 0
}
]
]
},
“Inqueries”: {
“ai_tool”: [
[
{
“node”: “AI Agent1”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Properties”: {
“ai_tool”: [
[
{
“node”: “AI Agent1”,
“type”: “ai_tool”,
“index”: 0
}
]
]
},
“Reservations”: {
“ai_tool”: [
[
{
“node”: “AI Agent1”,
“type”: “ai_tool”,
“index”: 0
}
]
]
}
},
“pinData”: {},
“meta”: {
“instanceId”: “8bfab7d91a93691a937ed7de52a3e7b9311163521c230ac9f559877a208d60e9”
}
}

(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)

Share the output returned by the last node

[
{
“ok”: true,
“result”: {
“message_id”: 43,
“from”: {
“id”: 7778979559,
“is_bot”: true,
“first_name”: “voiceBot”,
“username”: “HVTAIvoiceBot”
},
“chat”: {
“id”: 6628085877,
“first_name”: “Jeffrey”,
“last_name”: “Jensen”,
“type”: “private”
},
“date”: 1739511763,
“text”: “It seems there was an issue retrieving the reservation details for the property "Paddington second floor." The request returned an error.\n\nIf you’re looking for current reservations, it may be helpful to check back later, or if you have specific dates in mind, let me know, and I can assist you further!\n\nThis message was sent automatically with n8n”,
“entities”: [
{
“offset”: 305,
“length”: 41,
“type”: “italic”
},
{
“offset”: 346,
“length”: 3,
“type”: “text_link”,
“url”: “Powerful Workflow Automation Software & Tools - n8n
}
],
“link_preview_options”: {
“is_disabled”: true
}
}
}
]

Information on your n8n setup

  • n8n version:
    [email protected]
  • Database (default: SQLite):
    ??
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
    ??
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
    n8n cloud
  • Operating system:
    -Windows

Please share your JSON code inside a code block:

like this

Also, you might want to have a look here:

Hey @Jeffrey_Jensen do you still need help with this?

Figured it out, thanks man

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.