https://retellai.com/?utm_source=discord&utm_medium=seo logo
Dynamic Variable Twilio Outbound
# ❓・bug-report
y
Hi, I'm trying to feed in dynamic variables to my outbound Twilio calls but am having a very hard time. The variables are being pulled in (username, address, phone number) from a database into the twilio_client.create_phone_call function but it doesn't seem to work. I modified the function to incorporate username and address but they don't feed in properly to the agent. Any advice on how to fix this? I see there is documentation on the site for register call with dynamic variables but I don't see executing the call.
n
A few quick questions: 1.) Are you using a retell LLM? Because only retell LLM is supported for outbound dynamic variables 2.) Are you setting it correctly while hitting `create_phone_call`: https://docs.retellai.com/api-references/create-phone-call 3.) Are you setting those variables in the prompt using {{ }} : https://docs.retellai.com/retell-llm/dynamic-variables#define-dynamic-variables
y
1. Yes 2. I think so — see below: "client_list_with_numbers = pd.read_csv('test_data_retell_elizabeth.csv') current_index = 0 row = client_list_with_numbers.iloc[current_index] phone_number = client_list_with_numbers['phone_number'].tolist()[0:6] user_name = client_list_with_numbers['First Name'].tolist()[0:6] user_addresses = [] for current_index in range(len(client_list_with_numbers)): row = client_list_with_numbers.iloc[current_index] user_address = f"{row['Address']} {row['City']} {row['State']} {row['ZIP Code']}" user_addresses.append(user_address) print(f"Making call to: {phone_number[current_index]} which has name: {user_name[current_index]} and addy: {user_addresses[current_index]}") client.call.create(from_number="REDACTED", to_number=str(phone_number[current_index]), retell_llm_dynamic_variables={"user_name":user_name[current_index], "user_address":user_addresses[current_index]}) 3. I also believe yes: begin_message="Hi, {{user_name}}?" Address is later referred to as {{user_address}
n
@yertletheturtle0864 this seems to be the correct way. Were you able to make it work? I would consider printing the output from call.create to see the variables and the LLM response.
y
I got it to finally work. Thanks
m
how did you get it to work, i am faciing similar issue