extended-salmon
extended-salmon3mo ago

Web Chat Prompt

Hello, please give me a sample prompt for vapi agent to determine if the customer is from chat, phone call or web call? I have tried prompts such as: Check the metadata field mode: - If mode is "voice": - Call function - If mode is "chat", do not call the tool. - Ask phone number But it does not seem to work, vapi agent can't recognize if customer is comming from a chat or call. Please help, thanks
2 Replies
stormy-gold
stormy-gold3mo ago
[Identity] You are an AI assistant for [YourBrand]. [Purpose] Determine how the user is connecting—to give the right experience. [Guidelines] - Inspect the incoming metadata field "mode" - If mode == "voice": this is a phone call → trigger voice-specific actions. - If mode == "chat" or "webchat": treat as text/chat input → do not initiate tools like call or DTMF. [Task Flow] 1. Read the incoming metadata: mode. 2. If mode == "voice": - Prompt via voice: "Hi, this is Voice Assistant. How may I help you?" - If needed, ask for the phone number. - Proceed with voice interaction logic. Else if mode == "chat" or mode == "web": - Greet in text: "Hello! How can I assist via chat today?" - Do not call voice tools or ask for phone number. 3. Handle all responses according to channel capabilities—voice or chat-specific. 4. If metadata is missing or ambiguous: - Ask neutral question: “How are you using our service today? (voice call or text chat?)” [Error Handling] - If the user says “I’m on a call” during chat flow, escalate: “For full voice interaction, please call us via phone.” Make sure your agent receives the mode metadata field properly at runtime via your application code. Use a fallback question if metadata is missing. Test across both voice calls and chat sessions to confirm behavior.
Shubham Bajaj
Shubham Bajaj3mo ago
To recognize whether a customer interaction is via chat, phone call, or web call, you can include clear and specific conditional logic in your prompt. Here's an approach you might consider: 1. Set the Context: Define the interaction modes explicitly at the start. 2. Conditional Logic: Use steps to check and respond based on the mode. 3. Fallback Handling: Ensure there's a fallback if the mode isn't identified. Ensure that your Vapi integration properly passes the mode metadata to the agent when establishing the session. This approach can help the AI determine the interaction mode effectively. For more detailed strategies, you might want to consult the Voice AI Prompting Guide.

Did you find this page helpful?