Tool Data not being used
# support
r
I am close. I checked with Postman, all good, I’ve got the format of the message correct. I just can’t get the agent to use the data returned. How do I fix/troubleshoot this. In thing is that I’m putting multiple records in the response. It was JSON, but now it’s just plain text. What else am I missing?
v
@Rb Surge It sounds like you're having trouble with the agent using the data returned from your API. Since you've mentioned that the response format has changed from JSON to plain text, this could be the source of the issue. Agents typically expect data in a structured format like JSON, which allows for easier parsing and extraction of the necessary information. To troubleshoot this issue, you may want to: 1. Ensure that the agent is designed to handle plain text responses if that's the format you're now using. 2. Check that the plain text response is being parsed correctly by the agent to extract the multiple records you mentioned. 3. Verify that the agent's logic is set up to use the extracted data as intended. If you need to revert to JSON and are unsure how to proceed, or if you need assistance with parsing and using the plain text response, please provide more details about the agent's current setup and the expected behavior. This will help me guide you more effectively. If you have specific error messages or logs, those would also be helpful in diagnosing the problem.
You can continue this conversation by mentioning me in the message.
r
@Vapi only the text in the result section is text formatted. The rest of the response if JSON.
v
@Rb Surge Understood. If only the text in the result section is plain text and the rest of the response is in JSON format, the issue might be with how the agent is handling the parsing of the result section. Here are some steps you can take to troubleshoot and fix the issue: 1. **Parse the JSON**: Ensure that the agent is correctly parsing the JSON part of the response to access the result section. 2. **Handle Plain Text**: Once you have the result section as plain text, you will need to implement logic to parse or handle this plain text appropriately. This could involve regex, string splitting, or other text processing methods to extract the necessary information from the plain text. 3. **Data Mapping**: After parsing the plain text, map the extracted data to the agent's expected format or variables. 4. **Test the Changes**: Test the agent with the new logic to ensure it can now use the data returned. 5. **Error Handling**: Implement error handling to manage any unexpected formats or parsing errors. If you're still facing issues after trying these steps, please provide more specific information about the agent's expected behavior and how it processes the response. This will help me give you more targeted advice. If you need to test the parsing logic or any other functionality, let me know, and I can assist you further.
r
@Vapi do I need to define the functions to match information from the JSON response? Also, how can I use Regex to parse the data on platform?
s
Hey @Rb Surge To help track down this issue, could you share: - The call ID - When exactly this happened (the timestamp) - What response you expected to get - What response you actually got instead This would really help me figure out what went wrong!
r
Sent you a direct message with the information
Can you delete the last message it has private information. Thanks. I already fixed the 404 codes.
However, the issue still exists.
I had the message type set to GET instead of POST, so thats why the 404
s
@Rb Surge if 404 is fixed, then what's the issue now?
oh!! then make the required changes.
r
Information coming back in the JSON is not being recognized by the agent.
I got it to work with Retell within minutes cause it was all setup... rather use VAPI, but i have spent hours today working on this with no luck.
s
@Rb Surge can you share the call id so i could take a look?
r
When You get a moment, please delete the screenshot. Thanks.
d31bf42d-ea0a-4720-ae68-de3346bfab42
I just checked the logs and it looks like its not calling the tool.
I dont see the call anywhere in the logs.
It just doesnt seem to be calling my tool anymore.
Ive tried a few different ways.
s
@Rb Surge
current
🔵 05:06:02:001 Server Message Successful. (https://hook.us1.make.com/). Response: Accepted
expected
Copy code
json
{
    "results": [
        {
            "toolCallId": "X",
            "result": "Y"
        }
    ]
}
Your returning the response in wrong format, your expected to return the response in above format of type string only without any new-line breaks.
@Rb Surge Here at Vapi, the initial learning curve is high, but things get smoother pretty easily. I can't speak about other solutions.
r
I have it setup that way... Not in make, but in n8n
Im redoing make to see if I can get it to work that way.
Should I format the response in the Result in a JSON format? Im returning multiple items, that I want the model to have access to.
s
Copy code
json
{
    "results": [
        {
            "toolCallId": "X",
            "result": "Y"
        }
    ]
}
Just Replace
Y
with you result of multiple items which you want model to have access to, just make
Y
type is string only without any new-line breaks.
r
So I cant use any JSON Nesting?
s
@Rb Surge you can use it, just note that it has to be stringified.
Copy code
ts
const result = JSON.stringify(response)
r
@Shubham Bajaj I have been looking at the webhook responses and I’m getting 200, but no data is being returned. I’ve tested with other solutions and the data is being sent. Is there a timeout? What could be causing this?
s
@Rb Surge could you share the recent call id so i can take a look?