GeneralKugelBlitz
05/05/2025, 4:55 AMVapi Support Bot
05/05/2025, 4:56 AMmessage
event in your frontend code:
javascript
vapi.on("message", (message) => {
// Check if message contains your custom state
if (message.content && message.content.includes("ask_email")) {
// Trigger your UI pop-up for email input
showEmailPopup();
}
});
Then have your assistant include the trigger text in its response when appropriate.
Sources:
- [Vapi SDK Documentation](https://docs.vapi.ai/sdks)
- [Discord Discussion](https://discord.com/channels/1211482211119796234/1330803502615625738)GeneralKugelBlitz
05/05/2025, 4:58 AMVapi Support Bot
05/05/2025, 5:00 AMjavascript
// Update your assistant via API
curl -X PATCH https://api.vapi.ai/assistant/YOUR_ASSISTANT_ID \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": {
"messages": [
{
"role": "system",
"content": "You are a helpful assistant. When the user is about to book an appointment, include the text 'ask_email' in your response."
}
]
}
}'
This instructs the assistant to include the trigger text that your frontend code is listening for.
Source:
- [Vapi Knowledge Base](https://docs.vapi.ai/knowledge-base)GeneralKugelBlitz
05/05/2025, 5:17 AMGeneralKugelBlitz
05/05/2025, 5:18 AMGeneralKugelBlitz
05/05/2025, 5:19 AMVapi Support Bot
05/05/2025, 5:19 AMtool-calls
clientMessage type? This might allow you to send structured data to your frontend without it being part of the spoken transcript. Could you share more details about your current assistant configuration and how you're handling clientMessages in your frontend code?
Sources:
- [Vapi SDK Documentation](https://docs.vapi.ai/sdks)
- [Discord Discussion](https://discord.com/channels/1211482211119796234/1330803502615625738)GeneralKugelBlitz
05/05/2025, 5:21 AMVapi Support Bot
05/05/2025, 5:22 AMadd-message
type with vapi.send()
and set triggerResponseEnabled
to false:
javascript
vapi.send({
type: "add-message",
message: {
role: "system",
content: "ask_email"
},
triggerResponseEnabled: false
});
Then listen for system messages in your frontend code to trigger the email popup without the assistant speaking it.
Sources:
- [Vapi Background Messages](https://docs.vapi.ai/assistants/background-messages)
- [Discord Discussion](https://discord.com/channels/1211482211119796234/1338730919904673853)Shubham Bajaj
05/05/2025, 7:26 AMShubham Bajaj
05/05/2025, 7:26 AMShubham Bajaj
05/05/2025, 7:27 AMGeneralKugelBlitz
05/05/2025, 7:27 AMGeneralKugelBlitz
05/05/2025, 7:35 AMGeneralKugelBlitz
05/05/2025, 7:36 AMShubham Bajaj
05/05/2025, 8:56 AM