https://retellai.com/?utm_source=discord&utm_medium=seo logo
i want cal endpoint in first of call that search f...
# ❓・ai-evy-support
y
@AI Evy i want cal endpoint in first of call that search for user by his phone number sometimes it's work but i need it always work
a
Thanks for tagging me @Youssef Degachi. I'll look through relevant sources and get back to you shortly.
### Answer --- Based on the available sources, I don't have specific documentation about configuring an endpoint to reliably execute at the very start of every call to search for a user by phone number. However, here are some relevant approaches that may help: Using Custom Functions: You can define a custom function linked to a webhook that receives the caller's phone number. When Retell calls your endpoint, it passes the call structure including `from_number`: [(1) ]()
Copy code
json
{
  "call": {
    "call_type": "phone_call",
    "from_number": "+12137771234",
    "to_number": "+12137771235",
    "direction": "inbound",
    "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
    "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
    ...
  },
  "name": "get_weather",
  "args": {
    "city": "New York"
  }
}
Dynamic Variables: You can use
retell_llm_dynamic_variables
to inject call-specific data (like customer info looked up by phone number) into your prompts. [(2) ]() , [(3) ]() For intermittent failures: - There's a retry mechanism for inbound dynamic variable webhooks. [(4) ]() - There's a timeout for Retell webhooks. If your lookup is inconsistent, it may be related to webhook timeout or response issues on your endpoint side. Check out these potentially useful sources for more details: - [Register Phone Call]() - [Create Phone Call]() Would you like me to provide a general answer about ensuring webhook reliability, or do you have more details about when it fails vs. works?
​ To learn more, see the sources I considered: [[1] Discord message from @manny_40662 on 2024-11-14](https://discord.com/channels/1186424376300679209/1294891368505937952/1306720462306414602) [[2] Register Phone Call](https://docs.retellai.com/api-references/register-phone-call) [[3] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[4] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
y
it's shoudll be in prompet
@AI Evy it's shoud be in prompt
a
Thanks for the follow-up, @Youssef Degachi. I'll get back to you soon.
### Answer --- To ensure your function runs at the very start of every call via the prompt, you can structure your task steps to call the function immediately as the first action. Example prompt structure: [(1) ]()
Copy code
## Task
1. Call get_name_and_last_meeting to retrieve the callers name and their last meeting.
2. Greet the caller using this greeting: Hi {{first_name}}, your most recent meeting was {{ title }}.
...
[(2) ]() This pattern instructs the LLM to run the function before doing anything else. Best practices for reliable function execution at call start: - Write the task as explicit steps, with the function call as Step 1 [(1) ]() - Use clear language like "Run the function 'your_function_name'" rather than just "call" [(2) ]() - Use markdown formatting for better LLM understanding Example for your use case:
Copy code
## Task
1. Run the function 'search_user_by_phone' to look up the caller by their phone number.
2. Greet the caller using the retrieved information.
...
If the function still doesn't fire consistently, you may also want to add explicit instructions like:
Copy code
1. Immediately run the function 'search_user_by_phone' before saying anything.
[(1) ]() This makes it explicit that the agent should not speak until the function completes.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Write a single prompt](https://docs.retellai.com/build/single-multi-prompt/write-single-prompt) [[2] Single prompt is confirming action twice](https://discord.com/channels/1186424376300679209/1351007284431552572) ​