https://retellai.com/?utm_source=discord&utm_medium=seo logo
Problem: The Custom Function node (lookup_customer...
# ❓・ai-evy-support
s
@AI Evy Problem: The Custom Function node (lookup_customer_by_phone) is not correctly processing the dynamic variable for the customer's phone number during testing, causing a "cache-like" behavior where it perpetually returns the result of the first successful run. Setup Details Function Name: lookup_customer_by_phone API Integration: Make.com (formerly Integromat) Webhook Variable Used: user_phone_number Detailed Steps & Symptoms Function Node Configuration: Parameters: A parameter named user_phone_number is correctly defined in the Function Node's Form view. Headers: The Content-Type: application/json header is correctly set to ensure proper data formatting for the Make.com webhook. Response Variables: The variables for receiving data back from Make.com (customer_data, customer_found) are correctly mapped to the returned JSON keys (data and found). Expected Behavior: When the global variable user_phone_number is changed in the Test Agent panel, the function should execute on the Make.com side using the new phone number, resulting in a new outcome (e.g., transitioning to the "New Customer" node for a number not found in the database). Observed Failure (The Cache): The test environment seems to be ignoring the live changes to the user_phone_number variable. The agent always follows the original path based on the result of the very first phone number used (e.g., if the first test found "Samantha," all subsequent tests, even with a different phone number, still transition to the "Existing Customer" path). This is preventing accurate debugging of the flow logic, which is dependent on the dynamic user_phone_number being passed and processed correctly on every call.
a
Thanks for tagging me @sandorrmp. I'll look through relevant sources and get back to you shortly.
### Answer This appears to be a testing environment issue with dynamic variables not updating properly in your custom function. Based on the documentation, here are a few troubleshooting steps: Dynamic Variable Configuration First, ensure your dynamic variable is properly configured. Dynamic variables use the
{{variable_name}}
syntax and can be used in custom function parameters [(1) ]() . Your
user_phone_number
should be referenced as
{{user_phone_number}}
in the function parameters [(2) ]() . Custom Function Request Structure When Retell sends requests to your Make.com webhook, it follows this structure :
Copy code
json
{
 "name": "lookup_customer_by_phone",
 "call": {...},
 "args": {
   "user_phone_number": "actual_phone_number_value"
 }
}
Potential Solutions 1. **Verify Parameter Definition**: Ensure your parameter schema correctly defines
user_phone_number
:
Copy code
json
{
 "type": "object",
 "properties": {
   "user_phone_number": {
     "type": "string",
     "description": "The customer's phone number for lookup"
   }
 },
 "required": [
   "user_phone_number"
 ]
}
2. **Check Default Variables**: If you have default dynamic variables set at the agent level, they might be overriding your test values. Default variables only serve as fallback when specific variables aren't included in the call request [(1) ]() . 3. **Verify Make.com Webhook**: Ensure your Make.com webhook is properly reading the
args.user_phone_number
from the incoming request body [(2) ]() . Testing Environment Considerations The documentation doesn't specifically address testing environment caching behavior, but you might want to try: - Clearing any test session data - Creating a new test session - Verifying that the dynamic variable is being updated in the actual request payload If the issue persists, this could be a platform-specific testing environment behavior that may require direct support assistance.
​ To learn more, see the sources I considered: [[1] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[2] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.