https://retellai.com/?utm_source=discord&utm_medium=seo logo
<@1145576664366055464> how to format a webhook res...
# ❓・ai-evy-support
e
@AI Evy how to format a webhook response to give information back to the agent e.g. checking a timetable
a
Thanks for tagging me @emanuelkr. I'll look through relevant sources and get back to you shortly.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Webhook Overview]() * [Inbound call webhook]() * [Setup guide]() * [AI Voice Agents in 2025: Everything Businesses Need to Know | Retell AI]() -----------------------------
### Answer For inbound call webhooks, the response should be a JSON with a successful status code (2xx) with fields grouped under
call_inbound
[(1)]() . Here's how to format it:
Copy code
json
{
  "call_inbound": {
    "dynamic_variables": {
        "customer_name": "John Doe"
    },
    "metadata": {
        "random_id": "12345"
    }
  }
}
The response can include these optional fields: - `dynamic_variables`: Use this to set dynamic variables for the inbound call - `metadata`: Use this to set metadata for the inbound call - `override_agent_id`: Use this to override the agent id For webhook reliability, note that: - The webhook has a 10 second timeout - It will retry up to 3 times if no success status (2xx) is received
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
e
@AI Evy I meant for custom functions
a
Thanks for the follow-up, @emanuelkr. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Inbound call webhook]() * [Dynamic Variables]() * [Setup guide]() * [Deprecating on 4/30/2025]() -----------------------------
### Answer When implementing custom functions, Retell passes the following structure to your endpoint:
Copy code
json
{
  "call": {
    "call_type": "phone_call",
    "from_number": "+12137771234", 
    "to_number": "+12137771235",
    "direction": "inbound",
    "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
    "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
    "call_status": "registered",
    "metadata": {},
    "retell_llm_dynamic_variables": {
      "customer_name": "John Doe"
    },
    "opt_out_sensitive_data_storage": true
  },
  "name": "get_weather",
  "args": {
    "city": "New York"
  }
}
[(1)]() You can access the call details and function arguments from this payload to implement your custom logic and return the appropriate response. I apologize, but I don't see specific documentation about the exact response format for custom functions in the provided information sources. To get the most accurate information about custom function response formatting, I'd recommend checking: [Contact Sales]() [https://github.com/RetellAI/]() Would you like me to provide a general answer about webhook responses instead?
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
e
@AI Evy and how should the reponse look like
a
Thanks for the follow-up, @emanuelkr. I'll get back to you soon.
----------------------------- **While I generate an answer, here are some sources that might be helpful**: * [Inbound call webhook]() * [Dynamic Variables]() * [LLM WebSocket]() * [Discord message from @jarrad562 on 2024-11-18]() -----------------------------
### Answer For tool call results, the response should be formatted as:
Copy code
json
{
  "response_type": "tool_call_result",
  "tool_call_id": "some_id_here",
  "content": "Appointment booked successfully."
}
[(1)]() The response requires: - `response_type`: Must be "tool_call_result" - `tool_call_id`: The unique ID for this tool call - `content`: The result of the tool call, which can be a string or stringified JSON This result will be captured in the transcript with tool calls after the call ends.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.