Skip to content
AI Agent HTTP Tools...
 
Notifications
Clear all

AI Agent HTTP Tools: Passing Parameters in JSON

5 Posts
3 Users
0 Reactions
4 Views
Jeffrey_Jensen
(@jeffrey_jensen)
Posts: 2
New Member
Topic starter
 

Describe the problem/error/question

I am using an AI Agent with HTTP tools. The agent generates the parameters.
I am trying to pass an array of strings, specifically ["Id"]. However, during testing, I noticed the request was only accepted when structured as {{"["ID"]}}, which then allowed it to be recognized as an array.

I have updated the description of my HTTP AI Tool, but after 6 attempts, it still cannot find a way to format the parameter as JSON for acceptance.

What is the error message (if any)?

The error message received is: "Request failed with status code 400"

Please share your workflow

```json
{
"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-ekGywdU8ocMkLd5iAi17UW84zNgXsbZc1fcW8d-5HjOgawgWbfYA0zbaMGAmVPS6kQbqb33mRIWCc5hp0YY1GE983kdP6x0wyRVclyfNsO9SU7Rte5bV6VLUpwKn2XMqoRAanRXjmYVS9ebz1Dr61r99hLHKFrAS0ZNcThCS818No76P9crzDd7LWFsslb-lUaz-ZdZ3CNAoEcPq7jhUwLuSf3yaHzvAlsYvHuZThgOoNswGAa-eXo2PQrzvwsQJVmtH-Nnk7DnJFtsJMEPUZ7-P97i6Aw9id7bdxYHEOgCDx7y2Ljxlk4ijDwMFnxetxQO3TkAUiXmZyEyl0tFBhEu-kdpWuIVAZ3u85YdDlbwQKvdVAHw-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
NcThCS818No76P9crzDd7LWFsslb-lUaz-ZdZ3CNAoEcPq7jhUwLuSf3yaHzvAlsYvHuZThgOoNswGAa-eXo2PQrzvwsQJVmtH-Nnk7DnJFtsJMEPUZ7-P97i6Aw9id7bdxYHEOgCDx7y2Ljxlk4ijDwMFnxetxQO3TkAUiXmZyEyl0tFBhEu-kdpWuIVAZ3u85YdDlbwQKvdVAHw-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.eyJhdWQiOiI5YTYyNGRmMC0xMmYxLTQ0OGUtYjg4NC00MzY3ODBhNWQzY2QiLCJqdGkiOiIyOWJmNjRiM2NmYWNiM2RhN2ViZDhiN2E1Y2ViNDhjYzk0ODRjOTljNzNmZTg3MTRkNGYxNDdmODMzOGJiYTQ5ZGE0ZGZhZGMwYzQxN2Q2NSIsImlhdCI6MTczOTQ4OTA3NS45NzEzMDgsIm5iZiI6MTczOTQ4OTA3NS45NzEzMTIsImV4cCI6MTc3MTAyNTA3NS45NjU4MTQsInN1YiI6IjI2NDE2MCIsInNjb3BlcyI6WyJwYXQ6cmVhZCIsInBhdDp3cml0ZSJdpTjtv13KmqDZ36LH1hgDbmaLVdFOh8sufUGq6XYbEzHD0oXdUrAS0ZNcThCS818No76P9crznk7DnJFtsJMEPUZ7-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

json
[
{
"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.nnIf 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!nnThis message was sent automatically with callin.io",
"entities": [
{
"offset": 305,
"length": 41,
"type": "italic"
},
{
"offset": 346,
"length": 3,
"type": "text_link",
"url": "https://n8n.io/?utm_source=n8n-internal&utm_medium=powered_by&utm_campaign=n8n-nodes-base.telegram_8bfab7d91a93691a937ed7de52a3e7b9311163521c230ac9f559877a208d60e9"
}
],
"link_preview_options": {
"is_disabled": true
}
}
}
]

Information on your callin.io setup

  • callin.io version:
    callin.io@1.76.3
  • Database (default: SQLite):
    ??
  • callin.io EXECUTIONS_PROCESS setting (default: own, main):
    ??
  • Running callin.io via (Docker, npm, callin.io cloud, desktop app):
    callin.io cloud
  • Operating system:
    -Windows

Please provide the rewritten markdown content *it should be in the markdown format.

 
Posted : 14/02/2025 5:51 am
solomon
(@solomon)
Posts: 78
Trusted Member
 

Kindly share your JSON code within a code block:

like this

Additionally, you might find these resources helpful:

 
Posted : 24/02/2025 7:43 pm
solomon
(@solomon)
Posts: 78
Trusted Member
 

Hey do you still need help with this?

 
Posted : 28/02/2025 2:40 pm
Jeffrey_Jensen
(@jeffrey_jensen)
Posts: 2
New Member
Topic starter
 

Resolved, thank you!

 
Posted : 03/03/2025 9:12 pm
system
(@system)
Posts: 332
Reputable Member
 

This thread was automatically closed 90 days following the last response. New replies are no longer permitted.

 
Posted : 01/06/2025 9:12 pm
Share: