https://retellai.com/?utm_source=discord&utm_medium=seo logo
How can i use a custom function to save data on a ...
# ❓・ai-evy-support
k
@AI Evy How can i use a custom function to save data on a voice bot
a
Thanks for tagging me @khanfauji. I'll look through relevant sources and get back to you shortly.
### Answer You can use custom functions in Retell AI to save data by setting up an endpoint that receives data from the voice bot and stores it in your system [(1) ]() [(2) ]() . ## Setting Up Custom Functions for Data Storage Configuration Steps: 1. Create the custom function - Add a name like
save_user_data
and description in the Retell AI dashboard 2. Select HTTP Method - Choose POST, PUT, or PATCH for data saving operations 3. Add your endpoint URL - Specify where Retell will send the data to be saved 4. Define parameters using JSON schema format :
Copy code
json
{
 "type": "object",
 "properties": {
 "user_name": {
 "type": "string",
 "description": "The user's name to save"
 },
 "phone_number": {
 "type": "string", 
 "description": "The user's phone number"
 }
 },
 "required": [
 "user_name"
 ]
}
## Backend Implementation When Retell calls your custom function, it sends a POST request with : - `name`: the function name - `call`: call context and transcript data - `args`: the function arguments as JSON Your endpoint should return a status code between 200-299 to indicate successful data storage . ## Data Persistence Options You can save data to various systems through your custom function endpoint [(3) ]() [(4) ]() : - Customer databases for personalized interactions [(4) ]() - CRM systems for logging call details and customer information - Service management systems for tracking requests ## Important Considerations For data consistency, ensure you merge existing context with new data instead of overwriting, and add validation steps to confirm required fields persist [(5) ]() . The function result is capped at 15,000 characters to prevent overloading the LLM context window [(1) ]() [(2) ]() .
​ To learn more, see the sources I considered: [[1] Custom Function](https://docs.retellai.com/build/conversation-flow/custom-function) [[2] Integrate any system with custom function](https://docs.retellai.com/build/single-multi-prompt/custom-function) [[3] How to Connect Customer Data to Your Voice Bot | Retell AI](https://www.retellai.com/blog/how-to-connect-customer-data-into-your-voice-bot) [[4] Voice API: Integrate Phone AI Agents with Your System | Retell AI](https://www.retellai.com/blog/how-to-integrate-phone-ai-agents-with-your-existing-api-systems) [[5] Issues with Custom Functions](https://discord.com/channels/1186424376300679209/1387113810019746003) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.