Hugo
03/31/2025, 12:54 PMVapi Support Bot
03/31/2025, 12:56 PMjavascript
// Send a system message with updated context
const message = {
type: 'add-message',
message: {
role: 'system',
content: `Updated context: ${JSON.stringify(relevantContext)}`,
},
// Set to false to silently update without triggering a response
triggerResponseEnabled: false
};
### Method 2: Using Variable Substitution
javascript
const assistant = {
model: {
messages: [
{
role: 'system',
content: 'Relevant context: {{relevant_context}}'
}
]
}
};
// Update variables
const variables = {
relevant_context: JSON.stringify(updatedContext)
};
Both methods allow for dynamic updates during an active conversation, and changes are properly tracked without requiring full context reloads [(source)](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1343457322072145950).
## Accessing Speech Transcriptions
For accessing transcriptions during a call, you can:
1. Configure serverMessages
to include "transcript":
json
{
"serverMessages": [
"transcript",
"end-of-call-report"
]
}
Your server will then receive real-time transcripts via webhooks:
```json
{
"message": {
"type": "transcript",
"transcript": "User's speech text",
"role": "user",
"transcriptType": "final"
}
}Vapi Support Bot
03/31/2025, 12:56 PMClientMessageTranscript
event and check if transcriptType
is "final" to get the complete transcript [(source)](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1260258706667343892).
There is a note that the transcription might not be immediately available when the "speech-update" is triggered [(source)](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334902474053652500), but with your acceptance of a slight latency, this approach should work for your use case.
Is there anything specific about implementing this solution that you'd like me to elaborate on?
Sources:
- [Discord Thread about Dynamic Variable Updates](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1343457322072145950)
- [Discord Thread about Accessing Transcriptions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341440757189578782)
- [Discord Thread about ClientMessageTranscript Event](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1260258706667343892)
- [Discord Thread about Transcription Availability](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334902474053652500)Hugo
03/31/2025, 1:05 PMHugo
03/31/2025, 1:05 PMHugo
03/31/2025, 1:06 PMHugo
03/31/2025, 1:34 PMKings Big
03/31/2025, 4:06 PMHugo
04/01/2025, 8:36 AMKings Big
04/02/2025, 2:41 PMJoe
05/02/2025, 3:32 AMvariableValues
mid call? Or do those need to be set at the beginning of the call?