wreox
04/05/2025, 7:38 AMVapi Support Bot
04/05/2025, 7:40 AMjson
{
"analysisPlan": {
"structuredDataPlan": {
"schema": {
"type": "object",
"properties": {
"call_outcome": { "type": "string" },
"customer_name": { "type": "string" }
},
"required": ["call_outcome", "customer_name"]
}
}
}
}
## Creating an Analysis Plan for Calls
The analysis plan is configured within the assistant.analysisPlan
as mentioned in the [Vapi API documentation](https://docs.vapi.ai/api-reference/calls/create). Here's a more complete example:
json
{
"analysisPlan": {
"summaryPlan": {
"messages": [
{
"key": "value"
}
],
"enabled": true,
"timeoutSeconds": 1.1
},
"structuredDataPlan": {
"messages": [
{
"key": "value"
}
],
"enabled": true,
"schema": {
"type": "object",
"properties": {
"call_outcome": { "type": "string", "description": "Outcome of the call described in two words" },
"customer_name": { "type": "string" },
"customer_email": { "type": "string" }
},
"required": ["call_outcome"]
},
"timeoutSeconds": 1.1
}
}
}
## Customizing the Structured Data PromptVapi Support Bot
04/05/2025, 7:40 AMjson
{
"structuredDataPrompt": "Extract the following information from the call: 1) The outcome of the call described in exactly two words, 2) The customer's name, 3) The customer's email address."
}
This prompt will instruct the AI to extract the specific information you need in the format defined by your schema.
After the call ends, you can access the structured data through the analysis
object:
javascript
// When the call ends, you'll receive a call object that includes the analysis
const call = await vapiClient.calls.get(callId);
if (call.status === 'ended') {
// Access the structured data from the analysis object
const structuredData = call.analysis?.structuredData;
console.log('Call Outcome:', structuredData.call_outcome);
}
Is there anything specific about this implementation you'd like me to explain further? 🙂
Sources:
- [Vapi documentation](https://docs.vapi.ai/assistants/call-analysis)
- [Vapi API documentation](https://docs.vapi.ai/api-reference/calls/create)wreox
04/05/2025, 7:41 AMwreox
04/05/2025, 7:46 AMVapi Support Bot
04/05/2025, 7:47 AMGET Get Call
API endpoint to retrieve structured data from a call. The structured data is accessible through the analysis
object after a call ends.
Here's a code example of how you can access the structured data:
javascript
// When the call ends, you'll receive a call object that includes the analysis
const call = await vapiClient.calls.get(callId);
if (call.status === 'ended') {
// Access the structured data from the analysis object
const structuredData = call.analysis?.structuredData;
console.log('Call Outcome:', structuredData.call_outcome);
}
As shown in the example, you would use the vapiClient.calls.get(callId)
method to retrieve the call object, which contains the analysis with the structured data you defined in your analysis plan.
The structured data is generated based on your structuredDataPlan
configuration and is stored in call.analysis.structuredData
as mentioned in the [Vapi documentation](https://docs.vapi.ai/assistants/call-analysis).
Is there anything specific about accessing the structured data that you'd like to know more about?
Source:
- [Vapi documentation](https://docs.vapi.ai/assistants/call-analysis)Kyle Brunker
04/06/2025, 11:51 AMKyle Brunker
04/06/2025, 11:57 AMwreox
04/06/2025, 1:14 PMKyle Brunker
04/07/2025, 1:22 PM