The Start function is executed immediately when a conversation begins, ensuring that the agent is fully prepared to handle user interactions.
It runs synchronously, meaning the greeting message will not be played until the Start function has completed its tasks. This function is essential for setting up key context and initializing the conversation state.
Below is a Python implementation of the Start function:
Copy
Ask AI
import datetime as dtimport redef start_function(conv: Conversation): # Retrieve the current date and time now = dt.datetime.now() conv.state.current_date = now.strftime("%A %d-%m-%Y") conv.state.current_weekday = now.strftime("%A") conv.state.current_time = now.strftime("%H:%M") # Initialize state variables conv.state.available_times = None conv.state.user_bookings = None conv.state.phone_number = None # Extract the phone number from SIP headers from_header = conv.sip_headers.get('From', '') match = re.search(r"sip:(.+?)@", from_header) if match: conv.state.phone_number = match.group(1) # Return an empty string to indicate successful execution return str()
Personalization is essential for creating exceptional customer experiences. By using the Start function, the agent can incorporate context to deliver personalized experiences, ensuring every caller feels valued and understood. This not only improve customer satisfaction but also boosts trust and engagement with your brand. Information collected from SIP headers, API calls or during the conversation can be stored in Variables. Below are examples of how the Start function can be used for personalization:
Full article:Multi-voiceA single deployment can use multiple voice agents. A range of voices acts as a major retention boost for repeat callers, because each voice has its own personality
and will handle enquiries in subtly different ways.
Make an API call to reference user preferences or interaction history to suggest products, services, or solutions tailored to the caller’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?”