API Call Issues: Agents Not Responding During Calls

·
·

The API calls arent working for me, the agents keep silent the entire call. could you take a look Torrey Leonard?

  • Avatar of Tony K
    Tony K
    ·
    ·

    Hi Artur - I've been using the API quite extensively. What are some of the issues you are having?

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    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.

  • Avatar of Tony K
    Tony K
    ·
    ·

    let me make sure my API calls are working -- sec

  • Avatar of Tony K
    Tony K
    ·
    ·

    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

  • Avatar of Tony K
    Tony K
    ·
    ·

    or if it is expecting a number and gets a string, etc.

  • Avatar of Tony K
    Tony K
    ·
    ·

    if it were authentication you probably would get a 401 error

  • Avatar of Tony K
    Tony K
    ·
    ·

    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

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    I'm using postman for the tests

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    This call works sometimes

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    and sometimes it just returns "400: Authenticate"

  • Avatar of Tony K
    Tony K
    ·
    ·

    if it is sometimes, then I am more convinced it is the JSON formatting

  • Avatar of Tony K
    Tony K
    ·
    ·

    how are you feeding to the thoughtly API? Custom code? Make.com? n8n? zapier?

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    it cant be, I used this same call in one automation, and it worked for at least a month

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    n8n

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    this error never raised to me before today

  • Avatar of Tony K
    Tony K
    ·
    ·

    sec, you can get good info from n8n

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    gotta drop the log here, one sec

  • Avatar of Tony K
    Tony K
    ·
    ·

    ya, the http request log should have error details.

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    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
  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    I'm gonna try the curl

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    and now it is, I called again, with the same endpoint, and now worked just fine

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    same body

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    same headers

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    no change at all

  • Avatar of Tony K
    Tony K
    ·
    ·

    how come you are passing your x-api-token via metadata and not through the header?

  • Avatar of Tony K
    Tony K
    ·
    ·

    can I see your expression and result from the json body content in your http request node?

  • Avatar of Tony K
    Tony K
    ·
    ·

    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

  • Avatar of Tony K
    Tony K
    ·
    ·

    anyways, if you want someone to ping against to debug, let me know and we can even jump on a call and share notes.

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    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?

  • Avatar of Tony K
    Tony K
    ·
    ·

    oh ok, the screenshot showed it in the metadata, must have just been added for logging

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    it is in the header

  • Avatar of Tony K
    Tony K
    ·
    ·

    I don't know -- I don't think that their API would know about twilio and would still accept but not 'work'

  • Avatar of Tony K
    Tony K
    ·
    ·

    hmmm just to rule it out, have you tried hardcoding it into n8n (like you did in postman) ?

  • Avatar of Tony K
    Tony K
    ·
    ·

    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

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    the API calls are just working now, I do not get it

  • Avatar of Artur DouraSoft
    Artur DouraSoft
    ·
    ·

    I havent changed a single line of code, a single line of the json itself, whatever, its working rn

  • Avatar of Tony K
    Tony K
    ·
    ·

    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.