### OpenAPI Start Timestamp Example Source: https://docs.retellai.com/api-references/update-chat Example of the chat's begin timestamp in milliseconds since epoch. ```yaml 1703302407333 ``` -------------------------------- ### Example Ngrok Console Output Source: https://docs.retellai.com/features/register-webhook Shows the typical console display after starting Ngrok, including session status, account info, and the public forwarding URL. ```text ngrok (Ctrl+C to quit) Session Status online Account inconshreveable (Plan: Free) Version 3.0.0 Region United States (us) Latency 78ms Web Interface http://127.0.0.1:4040 Forwarding https://84c5df474.ngrok-free.dev -> http://localhost:8080 ``` -------------------------------- ### Starting State Name Example Source: https://docs.retellai.com/api-references/list-retell-llms Example of specifying the initial state for an LLM, which must be one of the defined states. ```YAML information_collection ``` -------------------------------- ### OpenAPI Example: Start Node ID Source: https://docs.retellai.com/api-references/list-conversation-flow-components Provides an example of a string value used to identify the starting node in a conversation flow component. ```yaml collect_info ``` -------------------------------- ### Subagent Node Instruction Example Source: https://docs.retellai.com/build/conversation-flow/subagent-node This instruction guides the LLM on its task and when to utilize available tools, such as an order lookup tool, based on user input. ```text Help the user check their order status. If the user provides an order number, use the available order lookup tool to retrieve the latest status. ``` -------------------------------- ### Install Ngrok using Homebrew Source: https://docs.retellai.com/features/register-webhook Installs the Ngrok command-line tool on macOS or Linux systems using Homebrew. ```bash brew install ngrok/ngrok/ngrok ``` -------------------------------- ### OpenAPI Example: Note Content Source: https://docs.retellai.com/api-references/list-conversation-flow-components Illustrates example text content for a note, which can include references to images. ```yaml Remember to handle edge cases here. ``` -------------------------------- ### OpenAPI Example: Note Size Source: https://docs.retellai.com/api-references/list-conversation-flow-components Shows example dimensions (width and height) for a note displayed on the flow canvas. ```yaml width: 200 height: 100 ``` -------------------------------- ### Install Retell Web SDK Source: https://docs.retellai.com/deploy/web-call Install the Retell Web SDK using npm to add it to your project dependencies. ```bash npm install retell-client-js-sdk ``` -------------------------------- ### Install Retell SDK (Node.js & Python) Source: https://docs.retellai.com/get-started/sdk Install the Retell SDK using npm for Node.js projects or pip for Python projects. ```bash npm i retell-sdk ``` ```bash pip install retell-sdk ``` -------------------------------- ### Verify Wireshark and tshark Installation Source: https://docs.retellai.com/reliability/debug-calls-pcap Use these commands to confirm that Wireshark and tshark are correctly installed and accessible from your command line. ```bash wireshark --version tshark --version ``` -------------------------------- ### OpenAPI Example: MCP Headers Source: https://docs.retellai.com/api-references/list-conversation-flow-components Illustrates an example of HTTP headers for an MCP connection request, specifically an Authorization header with a bearer token. ```yaml Authorization: Bearer 1234567890 ``` -------------------------------- ### End Call Tool Configuration Example Source: https://docs.retellai.com/api-references/list-retell-llms Example configuration for an 'end_call' tool within an LLM's toolset, used to terminate a call. ```YAML - type: end_call name: end_call description: End the call with user. ``` -------------------------------- ### Example Prompts for IVR Navigation Source: https://docs.retellai.com/build/telephony/navigate-ivr Examples of prompts to guide the Retell agent in navigating IVR systems, either by listening carefully to the IVR setup or by pressing a known digit. ```Prompt You are going to call to a business and they may have IVR setup. Listen carefully to their setup and press the right digit to navigate the IVR to reach the support department. ``` ```Prompt Press digit 1 to reach the support department. ``` -------------------------------- ### Initialize OpenAI Client and Starting Sentence (Python) Source: https://docs.retellai.com/integrate-llm/integrate-llm This snippet shows how to import the OpenAI client and define an initial greeting sentence for the AI agent in Python. ```python from openai import OpenAI import os beginSentence = "Hey there, I'm your personal AI therapist, how can I help you?" ``` -------------------------------- ### Initialize Retell Client (Python) Source: https://docs.retellai.com/api-references/update-call This Python snippet shows how to import the Retell SDK and initialize the client using an API key from environment variables. ```Python import os from retell import Retell ``` -------------------------------- ### Initialize SDK with API Key (TypeScript) Source: https://docs.retellai.com/get-started/sdk Configure the Retell SDK client by securely loading the API key from environment variables. ```typescript const retellClient = new Retell({ apiKey: process.env.RETELL_API_KEY, }); ``` -------------------------------- ### Get Call API Response Example Source: https://docs.retellai.com/features/post-call-analysis-consumption This JSON structure illustrates a typical response from the Get Call API, including the call_id and the nested call_analysis results object. ```json { "call_id": "123", "call_analysis": { // Analysis results object } } ``` -------------------------------- ### Example Get Call latency response (JSON) Source: https://docs.retellai.com/reliability/check-actual-latency This JSON snippet shows the 'latency' portion of a Get Call response, including end-to-end (e2e), Large Language Model (LLM), and Text-to-Speech (TTS) latency metrics. It provides percentiles (p50, p90, p95, p99), min/max values, count, and raw values for each category. ```json { "latency": { "e2e": { "p50": 800, "p90": 1200, "p95": 1500, "p99": 2500, "min": 500, "max": 2700, "num": 10, "values": [500, 620, 780, 800, 850, 900, 1100, 1200, 1500, 2700] }, "llm": { "p50": 400, "p90": 650, "p95": 800, "p99": 1200, "min": 250, "max": 1300, "num": 10, "values": [250, 310, 380, 400, 420, 500, 600, 650, 800, 1300] }, "tts": { "p50": 150, "p90": 250, "p95": 300, "p99": 400, "min": 80, "max": 420, "num": 10, "values": [80, 100, 130, 150, 160, 200, 230, 250, 300, 420] } } } ``` -------------------------------- ### Example Prompt for Invoking MCP Tool Source: https://docs.retellai.com/build/single-multi-prompt/mcp This prompt demonstrates how to explicitly instruct the agent on when to invoke a specific MCP tool, such as `verify_user`, based on user input. ```text When user states his name and phone number, please call tool `verify_user` function. ``` -------------------------------- ### OpenAPI Example: MCP Query Parameters Source: https://docs.retellai.com/api-references/list-conversation-flow-components Shows example query parameters to append to an MCP connection request URL, including a numeric index and a key-value pair. ```yaml index: '1' key: value ``` -------------------------------- ### Transfer Started Webhook Payload Example Source: https://docs.retellai.com/features/webhook Shows the JSON structure for a "transfer_started" event, detailing the "transfer_destination" and "transfer_option". Payload fields may vary by transfer type. ```json { "event": "transfer_started", "call": { "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6" }, "transfer_destination": { "number": "+12137771235", "extension": "1234" }, "transfer_option": { "type": "warm_transfer", "showTransfereeAsCaller": true, "publicHandoffOption": { "type": "static_message", "message": "Hi, I am transferring the caller now." }, "agentDetectionTimeoutMs": 15000, "onHoldMusic": { "type": "default" }, "enableBridgeAudioCue": true } } ``` -------------------------------- ### Create Knowledge Base with Python Source: https://docs.retellai.com/api-references/create-knowledge-base This Python snippet demonstrates how to create a knowledge base, including adding text, URLs, and files. Make sure to install the 'retell' library and replace 'YOUR_RETELL_API_KEY' with your actual API key. ```python from retell import Retell client = Retell( api_key="YOUR_RETELL_API_KEY", ) file = open("./test_data.txt", "rb") knowledge_base_response = client.knowledge_base.create( knowledge_base_name="Sample KB", knowledge_base_texts=[ { "text": "Hello, how are you?", "title": "Sample Question", }, ], knowledge_base_urls=[ "https://www.retellai.com", "https://docs.retellai.com", ], knowledge_base_files=[file], ) print(knowledge_base_response.knowledge_base_id) file.close() ``` -------------------------------- ### Handle Inbound Call Webhook and Dial SIP URI (Twilio, Node.js) Source: https://docs.retellai.com/deploy/custom-telephony This example demonstrates how to register a phone call with Retell to obtain a call ID and then use Twilio's VoiceResponse to dial to the generated SIP URI. It assumes an existing call handling setup for inbound calls. ```Typescript Node const client = new Retell({ apiKey: 'YOUR_RETELL_API_KEY', }); server.app.post( "/voice-webhook", async (req: Request, res: Response) => { // Register the phone call to get call id const phoneCallResponse = await client.call.registerPhoneCall({ agent_id: 'oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD', from_number: "+12137771234", // optional to_number: "+12137771235", // optional direction: "inbound", // optional }); // Start phone call websocket const voiceResponse = new VoiceResponse(); const dial = voiceResponse.dial(); dial.sip( `sip:${phoneCallResponse.call_id}@sip.retellai.com`, ); res.set("Content-Type", "text/xml"); res.send(voiceResponse.toString()); }, ); ``` -------------------------------- ### GET /get-concurrency Source: https://docs.retellai.com/api-references/get-concurrency Get the current concurrency and concurrency limit of the org. ```APIDOC ## GET /get-concurrency ### Description Get the current concurrency and concurrency limit of the org ### Method GET ### Endpoint /get-concurrency ### Response #### Success Response (200) - **current_concurrency** (integer) - The current concurrency (amount of ongoing calls) of the org. - **concurrency_limit** (integer) - The total concurrency limit (at max how many ongoing calls one can make) of the org. This should be the sum of `base_concurrency` and `purchased_concurrency`. - **base_concurrency** (integer) - The free concurrency limit of the org. - **purchased_concurrency** (integer) - The amount of concurrency that the org has already purchased. - **concurrency_purchase_limit** (integer) - The maximum amount of concurrency that the org can purchase. - **remaining_purchase_limit** (integer) - The remaining amount of concurrency that the org can purchase. This is the difference between `concurrency_purchase_limit` and `purchased_concurrency`. - **reserved_inbound_concurrency** (integer) - Number of normal concurrency slots reserved for inbound calls. - **concurrency_burst_enabled** (boolean) - Whether burst concurrency mode is enabled. When enabled, allows the org to exceed their normal concurrency limit with a surcharge. - **concurrency_burst_limit** (integer) - The maximum concurrency limit when burst mode is enabled. This is calculated as min(3x normal limit, normal limit + 300). Returns 0 if burst mode is disabled. #### Response Example ```json { "current_concurrency": 10, "concurrency_limit": 100, "base_concurrency": 20, "purchased_concurrency": 80, "concurrency_purchase_limit": 100, "remaining_purchase_limit": 20, "reserved_inbound_concurrency": 10, "concurrency_burst_enabled": true, "concurrency_burst_limit": 60 } ``` #### Error Response (401) - **status** (string) - `enum: ["error"]` - **message** (string) - Example: API key is missing or invalid. #### Error Response (500) - **status** (string) - `enum: ["error"]` ``` -------------------------------- ### Create Batch Call (JavaScript) Source: https://docs.retellai.com/api-references/create-batch-call Example demonstrating how to create a batch call using the Retell SDK for JavaScript. It initializes the client and sends a request with a `from_number` and a list of `tasks`. ```JavaScript import Retell from 'retell-sdk'; const client = new Retell({ apiKey: process.env['RETELL_API_KEY'], // This is the default and can be omitted }); const batchCallResponse = await client.batchCall.createBatchCall({ from_number: '+14157774444', tasks: [{ to_number: '+12137774445' }], }); console.log(batchCallResponse.batch_call_id); ``` -------------------------------- ### LLM States Configuration Example Source: https://docs.retellai.com/api-references/list-retell-llms Detailed example of defining LLM states, including state prompts, transitions (edges), and associated tools like 'transfer_call' and 'book_appointment_cal' for structured conversations. ```YAML - name: information_collection state_prompt: You will follow the steps below to collect information... edges: - destination_state_name: appointment_booking description: Transition to book an appointment. tools: - type: transfer_call name: transfer_to_support description: Transfer to the support team. transfer_destination: type: predefined number: '16175551212' ignore_e164_validation: false transfer_option: type: cold_transfer show_transferee_as_caller: false - name: appointment_booking state_prompt: You will follow the steps below to book an appointment... tools: - type: book_appointment_cal name: book_appointment description: Book an annual check up. cal_api_key: cal_live_xxxxxxxxxxxx event_type_id: 60444 timezone: America/Los_Angeles ``` -------------------------------- ### OpenAPI Chat Status Example Source: https://docs.retellai.com/api-references/update-chat Example of an ongoing chat session status. ```yaml ongoing ``` -------------------------------- ### Create Batch Call (Python) Source: https://docs.retellai.com/api-references/create-batch-call Example demonstrating how to create a batch call using the Retell SDK for Python. It initializes the client and sends a request with a `from_number` and a list of `tasks`. ```Python import os from retell import Retell client = Retell( api_key=os.environ.get("RETELL_API_KEY"), # This is the default and can be omitted ) batch_call_response = client.batch_call.create_batch_call( from_number="+14157774444", tasks=[{ "to_number": "+12137774445" }], ) print(batch_call_response.batch_call_id) ``` -------------------------------- ### GET /get-conversation-flow-component/{conversation_flow_component_id} Source: https://docs.retellai.com/api-references/get-conversation-flow-component Get a shared conversation flow component by its unique ID. ```APIDOC ## GET /get-conversation-flow-component/{conversation_flow_component_id} ### Description Get a shared conversation flow component ### Method GET ### Endpoint /get-conversation-flow-component/{conversation_flow_component_id} ### Parameters #### Path Parameters - **conversation_flow_component_id** (string) - Required - ID of the component to retrieve ### Response #### Success Response (200) - **conversation_flow_component_id** (string) - Unique identifier for the component - **user_modified_timestamp** (integer) - Timestamp of last user modification - **linked_conversation_flow_ids** (array of string) - IDs of conversation flows linked to this shared component - **name** (string) - Name of the component - **flex_mode** (boolean) - If enabled, the whole component will be converted as a Single Prompt agent. - **tools** (array of object) - Tools available within the component - **mcps** (array of object) - A list of MCP server configurations to use for this component - **nodes** (array of object) - Nodes that make up the component - **start_node_id** (string) - The ID of the starting node within the component. #### Response Example ```json { "conversation_flow_component_id": "cfc_example_id", "user_modified_timestamp": 1678886400, "linked_conversation_flow_ids": [ "cf_linked_1", "cf_linked_2" ], "name": "Customer Information Collector", "flex_mode": false, "tools": [ { "type": "custom", "name": "get_customer_info", "description": "Get customer information from database", "tool_id": "tool_001", "url": "https://api.example.com/customer", "method": "GET" } ], "mcps": [], "nodes": [ { "id": "collect_info", "type": "conversation", "instruction": { "type": "prompt", "text": "Ask the customer for their name and contact information." } } ], "start_node_id": "collect_info" } ``` ``` -------------------------------- ### OpenAPI Chat Transcript Example Source: https://docs.retellai.com/api-references/update-chat Example of a full chat transcription between an agent and a user. ```yaml Agent: hi how are you doing? User: Doing pretty well. How are you? Agent: That's great to hear! I'm doing well too, thanks! What's up? User: I don't have anything in particular. Agent: Got it, just checking in! User: Alright. See you. Agent: have a nice day ``` -------------------------------- ### Initialize Retell Web Client Source: https://docs.retellai.com/deploy/web-call Import the RetellWebClient class and create an instance to interact with the Retell API. ```javascript import { RetellWebClient } from "retell-client-js-sdk"; const retellWebClient = new RetellWebClient(); ``` -------------------------------- ### OpenAPI Chat Type Example Source: https://docs.retellai.com/api-references/update-chat Example of the chat type, indicating an API-based chat. ```yaml api_chat ```