Capturing Webhook Response as Variable in Vapi Age...
# support
h
@User @User @User I'm currently integrating tool responses into my Vapi agent workflow. The tool is returning correct JSON data (e.g., technician details), but the agent is responding with incorrect information. In platforms like Retell, we can dynamically capture tool results using variables and inject them into the agent's response logic. Despite the tool returning accurate data, there's no clear way to capture and reuse the tool response as a dynamic variable inside the Vapi dashboard agent. This makes it difficult to ensure the agent speaks based on the latest tool output. Is there a way to bind tool responses to variables inside the agent's prompt or logic? https://cdn.discordapp.com/attachments/1460701116185448459/1460701117284487228/image.png?ex=697a546c&is=697902ec&hm=5d8b91a8286b50ee3a8678a773e3b25c1cd9c783c4375af09786c93c7112b0a2& https://cdn.discordapp.com/attachments/1460701116185448459/1460701118148645015/image.png?ex=697a546d&is=697902ed&hm=6ef9abe9b2e59f521bcf684d70d467ed921b489b6b3e7de6d902bb19b6cc0432&
g
Use a API Request-type tool to retrieve the specific information, additionally use the test tool option to validate the results
c
Here is a link to the documentation regarding best practices in assigning tool results to a variable, then using those variables in the assistant's response: https://docs.vapi.ai/prompting-guide#example-appointment-setter-prompt
h
@GeraDeluxer Is there a way to check the data coming into Vapi from a tool response? I’m reviewing the call transcript, and although the tool call is successful, I can’t see the data that Vapi received from the webhook response. https://cdn.discordapp.com/attachments/1460701116185448459/1460859748755706011/image.png?ex=697ae829&is=697996a9&hm=db0555516f7c42a984e0b6f972595af7c3623d45a12344c869acf30a5d9d1bdf&
When the 'execute asynchronously' option is enabled, the tool’s response does not appear in the transcripts. When it is disabled, the response is visible. I want to run the tool asynchronously because I am searching for a technician in a sheet with 15,000 records, which takes time to process. If I don’t enable the asynchronous option, the agent just waits for the response to return. However, when the option is enabled, the agent does not receive the tool’s response. https://cdn.discordapp.com/attachments/1460701116185448459/1460870901854634065/image.png?ex=697af28c&is=6979a10c&hm=7a8aa83a59e604193d7aaf23580fac28a7a204464d737034a5cd533d92ac091a&
h
@GeraDeluxer I’m trying to understand how the tool test works. The status shows “OK,” but I couldn’t add anything to the request body since it was auto‑generated from variables. How should I use it? Do I need to set the ZIP code in the request body myself? I wasn’t able to add anything manually to the request body. https://cdn.discordapp.com/attachments/1460701116185448459/1461064877849182219/image.png?ex=697a55b4&is=69790434&hm=53cafcc063063bd6bdfa005ca2ccc5b85aaf69dd9adf2b52ff58165f850df911&
g
Use API Request-type tool instead of custom tool.
c
The test tool only uses default values and it duplicates the first value for each type into the rest. This is only to verify that the tool is able to send to the webhook then receive a response. Like GeraDeluxer said, use the API request tool to configure this and you will be able to configure default values for your tool. If you need further assistance, let me know and we'll get it sorted
h
im trying to use the test tool, I have added defaults, it just sends an empty request
Copy code
"type": "function",
  "function": {
    "name": "check_ltv",
    "description": "this tool sends the loan amount, the home value and the desired cashout and returns the LTV",
    "parameters": {
      "type": "object",
      "properties": {
        "Home_Value_Num": {
          "description": "the amount of dollars the contact thinks his home is worth",
          "type": "number",
          "default": "12"
        },
        "Loan_Amount_Num": {
          "description": "the amount of dollars the contacts current mortgage or loan is for",
          "type": "number",
          "default": "14"
        },
        "Desired_Cashout_Amount": {
          "description": "how many dollars is the contact looking to cashout?",
          "type": "number",
          "default": "14"
        }
      },
      "required": [
        "Home_Value_Num",
        "Loan_Amount_Num",
        "Desired_Cashout_Amount"
      ]
    }
  },
c
please provide a log of the empty request and we will investigate the issue