The API calls arent working for me, the agents keep silent the entire call. could you take a look Torrey Leonard?
Hi Artur - I've been using the API quite extensively. What are some of the issues you are having?
Currently the only issue I'm having is not being able to make api calls to the calling endpoint, majority of the times it returns 400 "Authenticate", even though it worked for a month, and that error raised today. And whenever I can make this call, the agent remains in total silence with no bg sound.
let me make sure my API calls are working -- sec
mine are still working. Did you look at your data and make sure it was passing properly? If there are line breaks or unwanted json characters a 400 will happen
or if it is expecting a number and gets a string, etc.
if it were authentication you probably would get a 401 error
do you have the ability to check what was sent via the API? I don't think there is a log on Thoughtly side to see what it was trying to receive, but I would even try with something like postman so you can manually test your arguments
This call works sometimes
and sometimes it just returns "400: Authenticate"
if it is sometimes, then I am more convinced it is the JSON formatting
it cant be, I used this same call in one automation, and it worked for at least a month
n8n
this error never raised to me before today
sec, you can get good info from n8n
gotta drop the log here, one sec
ya, the http request log should have error details.
Error code 400 Full message
400 - "{\"data\":null,\"error\":\"Authenticate\"}"
Request
{ "body": { "contact_id": "c2fe1180-2be2-4ad9-81e6-70401f58a370", "interview_id": "FU09xzkJ", "metadata": { "metadata1": "1" } }, "headers": { "x-api-token": "**hidden**", "accept": "application/json,text/html,application/xhtml+xml,application/xml,text/*;q=0.9, image/*;q=0.8, */*;q=0.7" }, "method": "POST", "uri": "https://api.thought.ly/contact/call", "gzip": true, "rejectUnauthorized": true, "followRedirect": true, "resolveWithFullResponse": true, "followAllRedirects": true, "timeout": 300000, "encoding": null, "json": false, "useStream": true }
Other info Item Index 0 Node type n8n-nodes-base.httpRequest Node version 4.2 (Latest) n8n version 1.75.2 (Self Hosted) Time 18/02/2025, 12:20:31 Stack trace
NodeApiError: Bad request - please check your parameters at ExecuteContext.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js:525:33) at processTicksAndRejections (node:internal/process/task_queues:95:5) at WorkflowExecute.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:632:19) at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:890:51 at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/WorkflowExecute.js:1224:20
I'm gonna try the curl
and now it is, I called again, with the same endpoint, and now worked just fine
same body
same headers
no change at all
how come you are passing your x-api-token via metadata and not through the header?
can I see your expression and result from the json body content in your http request node?
in n8n you can also save the authentication under generic auth type, then header, then save your x-api-token there... way easier to maintain
anyways, if you want someone to ping against to debug, let me know and we can even jump on a call and share notes.
I'm not passing my x-api-token within metadata, I'm passing through header, using the header auth as you said before. I've already saved the auth, it is not the json input, I tested it again, and now it worked, maybe that was the twilio issue?
oh ok, the screenshot showed it in the metadata, must have just been added for logging
it is in the header
I don't know -- I don't think that their API would know about twilio and would still accept but not 'work'
hmmm just to rule it out, have you tried hardcoding it into n8n (like you did in postman) ?
I tested mine, so I don't think it is the API interface that isn't working. https://docs.thoughtly.com/api-reference/contact/call-a-contact the ability to test on their API documentation pages can tell you if their API is responding correctly as well
the API calls are just working now, I do not get it
I havent changed a single line of code, a single line of the json itself, whatever, its working rn
good to hear, but if you are triggering from n8n and in particular using AI Agents, I still think it is based on formatting or special characters.