Handling calls for the returning users
# support
y
Greetings, I need some help with returning customers. I'm trying to load a digest of their previous conversation at the start of a new call. Right now, I have two assistants- one for new users and one for returning ones. They're supposed to invoke a tool to load the conversation digest from my backend. The problem is the tool only gets triggered if the user explicitly asks for it. I need it to fire automatically right when the call starts. Ideally, I'd like to use a single assistant and just swap out the system context. Is that even possible? I checked the docs for creating assistants but couldn't find a way to automatically trigger a tool at the beginning of the call. What's the best way to handle this? Is there an on-start event I can use to trigger a tool, or am I thinking about this all wrong? Should I be using workflows for this instead? Any help would be great. Thanks.
c
Hi yarcat, To automatically trigger a tool at the start of a call, you can include it in the
firstMessage
configuration of your assistant or use a custom function to call your backend upon call initiation. Here’s a basic method to achieve this: 1. Use the `firstMessageMode`**:** Set
firstMessageMode
to
"assistant-speaks-first"
. 2. Invoke the Tool Automatically: Modify the
firstMessage
content to include the logic to call the tool. This could require configuring a system prompt that contains instructions for the assistant to call the backend tool immediately. For a single assistant setup, configure the assistant on your server to recognize returning users:
Copy code
json
{
  "assistant": {
    ...
    "firstMessage": "Welcome back, {{userName}}. Let me check the latest updates on our previous conversation.",
    "firstMessageMode": "assistant-speaks-first"
    ...
  },
  "tools": [
    {
      "type": "apiRequest",
      "name": "loadConversationDigest",
      "url": "https://api.your-backend.com/conversation-digest",
      "method": "GET",
      "parameters": {
        "userId": "{{userId}}"
      }
    }
  ]
}
Replace placeholders like
{{userName}}
and
{{userId}}
with the appropriate dynamic variables or session data. This should help in fetching the conversation digest automatically as soon as the call starts, without needing a manual user prompt. If this doesn’t resolve the issue, please let us know and we’ll be happy to step in and assist further.
j
I have this exact same agentd for a dealership. For rrturning customers, you have to explicitly say something like "Refer to this conversation for customer context" then your custom variable for that. For names, I use custom variables too.
c
Hello, Thanks for getting back. You're right! When handling returning customers and personalizing conversations, you need to: 1. For customer context/history: - Add an explicit instruction in your system prompt like "Refer to this conversation for customer context: {{customerContext}}" - Set the context value through
variableValues
when starting the call 2. For customer names: - Use the variable syntax:
{{customerName}}
(or your preferred variable name) - Provide the value through
assistantOverrides
when making the call:
Copy code
{
  "assistantOverrides": {
    "variableValues": {
      "customerContext": "Previous conversation about billing issue on Sept 1",
      "customerName": "John"
    }
  }
}
Remember that variables must be set when starting the call - they cannot be set in the dashboard directly
2 Views