Key features
- Synchronous execution: Completes before the greeting plays
- Context preparation: Stores data for use throughout the conversation
Use cases
The Start function can:1. Read connection metadata
- Capture metadata about the user’s connection—SIP headers for voice, URL parameters or session data for webchat.
- Example use case: Determine the hotel site or business branch based on telephony headers (voice) or URL parameters (webchat).
2. Retrieve date and time
- Initialize state with the current date, time, or day of the week for timestamping or scheduling logic.
- Example use case: Preload available time slots for scheduling queries or confirm user-requested dates.
3. Makes API calls
- Fetch external data such as user preferences, account information, or customer records.
- Example use case: Retrieve and preload personalized data to enhance the conversation’s responsiveness and user experience.
4. Choose a language provider
- Choose an alternative TTS system using PlayHT, Rime, or Cartesia.i
- See the function classes documentation for more details.
Implementation example
Below is a Python implementation of the Start function:Best practices for Start function design
- Efficient execution: Ensure the function completes quickly to minimize delays in starting the conversation.
-
Error handling:
- Handle missing or malformed data and avoids runtime errors.
- Provide fallbacks for incomplete or invalid information (like missing SIP headers).
-
State initialization:
- Predefine and initialize all state variables needed for the conversation to avoid undefined behaviors.
-
Contextual relevance:
- Only include setup steps that are directly relevant to the conversation’s purpose.
- Avoid overloading the Start function with unnecessary logic.
Examples: Adding context and personalization
Use the Start function to personalize conversations with user data from SIP headers (voice), URL parameters (webchat), API calls, or stored Variables.Multiple voice agents
Full article: Multi-voice A single deployment can use multiple voice agents. A range of voices acts as a major retention boost for repeat users, because each voice has its own personality and will handle enquiries in subtly different ways.Dynamic user identification
Use information like the user’s phone number (voice), session data (webchat), or metadata to greet them personally and acknowledge their history with your business. Example:- “Hello, John! Thank you for calling. How can we assist you today?”
- “Hi! It looks like you’re calling about your recent order. Would you like to discuss that today?”
Personalized recommendations
Make an API call to reference user preferences or interaction history to suggest products, services, or solutions tailored to the user’s needs. Example:- “Based on your recent purchases, we think you might like our new line of wireless headphones!”
- “I see you’ve been interested in our premium package. Would you like to learn more about its benefits?”
Preloading relevant context
Prepare scheduling information or past bookings to streamline conversations and save time for the user. Example:- “Your last appointment was on January 3rd. Would you like to book another one?”
- “I see there’s an available time slot tomorrow at 2 PM. Should I reserve that for you?”
Customized support based on account details
Retrieve account-specific information, such as subscription plans or recent activity, to provide targeted assistance. Example:- “It looks like you’re on our Gold Membership plan. Let me share some exclusive offers with you.”
- “I see you recently opened a support ticket. Would you like an update on its status?”

