https://retellai.com/?utm_source=discord&utm_medium=seo logo
help me troubleshoot this
# ❓・ai-evy-support
b
@AI Evy help me troubleshoot this. I am hooking my Retell voice agent to n8n via a webhook. In the voice agent's post call analysis configuration I'm using the variable 'sentiment' to grade the caller. The variable value is set to a 'number'. However when the webhook is successfully called, it uses a previously defined variable called 'user_sentiment' which is not expected. I've already checked that the voice agent is saved, but the output still shows 'user_sentiment' instead of 'sentiment'.
a
Thanks for tagging me @bitbasilica. I'll look through relevant sources and get back to you shortly.
### Answer Based on the documentation, there are two distinct sentiment-related variables in Retell AI's call analysis: 1. **Built-in `user_sentiment`**: This is a predefined variable that's automatically included in the call analysis response [(1) ]() [(2) ]() [(3) ]() [(4) ]() . It appears in the
call_analysis
object as an enum with values like "Positive" . 2. **Custom post-call analysis variables**: These are defined in the agent's
post_call_analysis_data
configuration [(5) ]() [(6) ]() [(7) ]() [(8) ]() and appear in the
custom_analysis_data
object [(1) ]() [(2) ]() [(3) ]() [(4) ]() . The issue you're experiencing suggests that the webhook is returning the built-in
user_sentiment
rather than your custom
sentiment
variable. Here's what to check: Verify your agent configuration includes your custom variable:
Copy code
javascript
"post_call_analysis_data": [
  {
    "type": "number",
    "name": "sentiment",
    "description": "Grade the caller sentiment as a number"
  }
]
[(5) ]() [(6) ]() [(7) ]() [(8) ]() Check the webhook payload structure: - Built-in
user_sentiment
appears at:
call_analysis.user_sentiment
[(1) ]() [(2) ]() [(3) ]() [(4) ]() - Custom variables appear at:
call_analysis.custom_analysis_data.sentiment
Ensure you're processing the correct webhook event: As mentioned in the Discord discussion, there are multiple webhook events per call, and custom analysis data is only available in the
call_analyzed
event [(9) ]() . Make sure your n8n workflow is filtering for this specific event type. If the custom variable still isn't appearing, try creating a test call and verify that your custom
sentiment
variable appears in the
custom_analysis_data
object of the webhook payload, separate from the built-in
user_sentiment
field.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
b
it's 'user_sentiment' under 'custom_analysis_data'
@AI Evy it's 'user_sentiment' under 'custom_analysis_data'
a
Thanks for the follow-up, @bitbasilica. I'll get back to you soon.
### Answer Based on the documentation, the
user_sentiment
field appears in two different locations in the call analysis response [(1) ]() [(2) ]() [(3) ]() [(4) ]() [(5) ]() : 1. **Built-in location**:
call_analysis.user_sentiment
- This is the standard sentiment analysis field 2. **Custom analysis data**:
call_analysis.custom_analysis_data
- This is where your custom post-call analysis variables should appear If you're seeing
user_sentiment
under
custom_analysis_data
instead of your custom
sentiment
variable, this suggests there might be a configuration issue. The documentation shows that custom analysis data should contain your specifically defined variables . According to the Discord discussion, the
user_sentiment
attribute is part of the call analysis object and is only available after the call ends via the "call_analyzed" webhook event [(6) ]() . It's currently used for analytics purposes only . To troubleshoot this issue, I'd recommend: 1. Double-checking your agent's post-call analysis configuration to ensure your custom
sentiment
variable is properly defined 2. Verifying that you're processing the correct webhook event type (
call_analyzed
) 3. Confirming that your custom variable name doesn't conflict with any built-in field names The fact that you're seeing
user_sentiment
in the
custom_analysis_data
object rather than your expected
sentiment
variable suggests the system might be defaulting to a built-in behavior rather than using your custom configuration.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
b
@AI Evy yes this value is shown after the call ends and the 'call_analyzed' webhook is called. I don't know why 'user_sentiment' is still shown
a
Thanks for the follow-up, @bitbasilica. I'll get back to you soon.
### Answer Based on the documentation, the
call_analyzed
webhook contains the full call data including the
call_analysis
object [(1) ]() . The call analysis structure shows that
user_sentiment
is a built-in field that appears at
call_analysis.user_sentiment
[(2) ]() [(3) ]() [(4) ]() , while custom analysis data should appear separately at
call_analysis.custom_analysis_data
. The fact that you're seeing
user_sentiment
appearing under
custom_analysis_data
instead of your custom
sentiment
variable suggests there may be a configuration issue with your agent's post-call analysis setup. According to the Discord discussion, the
call_analyzed
webhook is indeed the correct one for post-call analysis data [(5) ]() . The webhook structure should separate built-in fields from custom analysis data. To troubleshoot this issue, I'd recommend: 1. Verify your agent configuration includes your custom variable properly defined in the
post_call_analysis_data
array 2. Check that your custom variable name doesn't conflict with built-in field names like
user_sentiment
3. Ensure you're looking at the correct webhook payload structure - custom variables should be nested under
custom_analysis_data
If the issue persists, you might want to contact support as this could indicate a potential bug where the system is incorrectly placing built-in sentiment analysis under the custom data section instead of using your configured custom variable.
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) [[3] Get Call](https://docs.retellai.com/api-references/get-call) [[4] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[5] Discord message from @majestic_seahorse_21472 on 2025-03-13](https://discord.com/channels/1186424376300679209/1294891368505937952/1349768291303821312) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
b
I switched the variable to be called 'call_sentiment' to avoid any duplicates, but the output is still 'user_sentiment'
a
Thanks for the follow-up, @bitbasilica. I'll get back to you soon.
b
@AI Evy I switched the variable to be called 'call_sentiment' to avoid any duplicates, but the output is still 'user_sentiment'
a
### Answer If you're still seeing
user_sentiment
appearing in the
custom_analysis_data
section even after changing your variable name to
call_sentiment
, this indicates a potential configuration issue that needs troubleshooting [(1) ]() [(2) ]() [(3) ]() [(4) ]() [(5) ]() . Here are the key troubleshooting steps: 1. Verify your agent's post-call analysis configuration: Make sure your agent includes the custom variable properly defined in the
post_call_analysis_data
array [(6) ]() :
Copy code
javascript
"post_call_analysis_data": [
  {
    "type": "number",
    "name": "call_sentiment",
    "description": "Grade the caller sentiment as a number"
  }
]
2. Confirm you're processing the correct webhook event: As mentioned in the Discord discussion, custom analysis data is only available in the
call_analyzed
event [(7) ]() [(8) ]() . Make sure your n8n workflow is specifically filtering for this webhook event type. 3. Check the webhook payload structure: - Built-in
user_sentiment
should appear at:
call_analysis.user_sentiment
[(1) ]() [(2) ]() [(3) ]() [(4) ]() [(5) ]() - Your custom
call_sentiment
should appear at:
call_analysis.custom_analysis_data.call_sentiment
4. Verify agent version and publication: Ensure you're using the correct agent version and that any changes have been properly saved and published [(9) ]() . Since changing the variable name didn't resolve the issue, this suggests the system may not be recognizing your custom post-call analysis configuration at all. The fact that
user_sentiment
keeps appearing in
custom_analysis_data
instead of your defined variable indicates the configuration may not be taking effect. I'd recommend checking your agent configuration directly through the API or dashboard to confirm your custom analysis fields are properly saved, and consider contacting support if the issue persists as this behavior suggests a potential configuration or system issue.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.