https://retellai.com/?utm_source=discord&utm_medium=seo logo
where would the response variables be present in t...
# ❓・ai-evy-support
m
@AI Evy where would the response variables be present in the retell webhook for event type 'call_analysis' for a custom function defined for an agent
a
Thanks for tagging me @mjemperor_. I'll look through relevant sources and get back to you shortly.
### Answer For the
call_analyzed
webhook event, the response includes the full call object with the
call_analysis
field populated. [(1) ]() The
call_analysis
object contains: [(2) ]() -
call_summary
-
in_voicemail
-
user_sentiment
-
call_successful
-
custom_analysis_data
Custom function call data (tool calls) would be found in the
transcript_with_tool_calls
field of the call object, not within
call_analysis
. [(2) ]() [(3) ]() Here's the webhook payload structure:
Copy code
json
{
  "event": "call_analyzed",
  "call": {
    "call_analysis": {
      "call_summary": "...",
      "in_voicemail": false,
      "user_sentiment": "Positive",
      "call_successful": true,
      "custom_analysis_data": {}
    },
    "transcript_with_tool_calls": [...]
  }
}
[(1) ]() [(2) ]() If you need the actual arguments/responses from custom functions during the call, check
transcript_with_tool_calls
. For post-call analysis data you've configured, look in
call_analysis.custom_analysis_data
. [(2) ]()
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Get Call](https://docs.retellai.com/api-references/get-call) [[3] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
m
@AI Evy so I have a customer function called Create_client which makes an api call and returns client_id in response how do i access it from the 'call_analysis' POST call webhook
a
Thanks for the follow-up, @mjemperor_. I'll get back to you soon.
### Answer The
client_id
returned by your
Create_client
custom function won't be in the
call_analysis
object directly. [(1) ]() Custom function responses are captured in the
transcript_with_tool_calls
field of the call object within the webhook payload. [(2) ]() To access your `client_id`: 1. Parse the
call.transcript_with_tool_calls
array from the
call_analyzed
webhook payload 2. Look for the tool call entry with
name: "Create_client"
3. The response (including
client_id
) will be in that entry's result The
call_analysis.custom_analysis_data
field is for post-call analysis metrics you configure in the agent settings, not for capturing custom function return values. If you need the
client_id
easily accessible after the call, consider: - Storing it in your own database when the custom function executes [(3) ]() - Using the
transcript_with_tool_calls
array to parse it from the webhook The function result is included in the transcript structure that precisely captures when the tool was invoked and what was the result. [(2) ]()
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Get Call](https://docs.retellai.com/api-references/get-call) [[3] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.