How do i get an end-of-call report for VAPI chat?
# support
d
Reading through the documentation, there doesn't seem to be a way to "end" a chat so that an end of call report is generated to get the structured data.
v
To retrieve an end-of-call (structured data) report in VAPI, structured outputs are generated automatically after the call ends and can be accessed from the call artifact. Here’s a code example to fetch structured outputs from a completed call:
Copy code
typescript
const call = await vapi.calls.get(callId);
const outputs = call.artifact?.structuredOutputs;
Note: The documentation only describes this for voice calls, not chat sessions. If you need structured outputs for chat, please confirm with Vapi support. For more details, see the [Structured Outputs documentation](https://docs.vapi.ai/assistants/structured-outputs). Source: - [Structured outputs](https://docs.vapi.ai/assistants/structured-outputs)
d
This is only for calls. I need it got chat sessions
c
Hi Dennis Ho, For chat sessions, structured outputs are managed differently compared to voice calls. While there's no specific "end-of-chat" event like the "end-of-call" for voice, you can work with session updates to retrieve structured outputs. Here's how you can handle it: 1. **Webhook Subscription**: Subscribe to the
session.updated
webhook. This event will notify you whenever a session is updated, which includes chats. 2. **Session Artifacts**: Process the session's
artifact
from the webhook to access
structuredOutputs
. This will contain the structured data similar to an "end-of-chat" report. For detailed implementation, you can refer to the [Structured Outputs documentation](https://docs.vapi.ai/assistants/structured-outputs). If you have further questions, let me know.