End of Call report data structure differs between ...
# support
c
Quick question. It seems like the payload for an
end-of-call-report
changes slighlty between the a web call and a phone call. On a normal phone call, there is the
message.call.assistantId
which we use in our backend code to differentiate between agents and handle different agents with different logic. But when doing a web call, this key seems to be inexplicably missing which breaks our code. Any idea what is happening here? https://cdn.discordapp.com/attachments/1345103814318882959/1345103814612746240/Screenshot_2025-02-28_at_1.41.14_PM.png?ex=67c3550c&is=67c2038c&hm=2660b3dfd7b87c732a8fa0c929c6c385bae4d9d7ddf06f62183ca49eb353baff&
v
It sounds like you're encountering a frustrating issue with the
end-of-call-report
payload in Vapi. The absence of the
message.call.assistantId
key in web calls can indeed disrupt your backend logic. Here are a few potential reasons for this discrepancy: 1. **Call Flow and Handling Logic**: The
assistantId
may not be recorded in the same way for web calls as it is for phone calls. If the assistant was not directly involved in the web call, the
assistantId
might not be included in the payload. It's worth reviewing your call handling logic to ensure that the
assistantId
is being captured correctly. 2. **Persistent vs. Transient Assistants**: If you're using transient assistants for web calls, the
assistantId
might not be included. Make sure that your assistant is set up as persistent if you need the
assistantId
to be present in every case. 3. **Incorrect Payload Configuration**: Sometimes, the payload structure can be affected by how the call is initiated. If you're using a transient assistant, it might take precedence over the expected
assistantId
. Double-check your payload configuration to ensure it's set up correctly. 4. **Webhook and Server Handling**: If your webhook is configured to handle requests based on phone numbers, ensure that it responds with the necessary assistant information, including the
assistantId
. To handle the missing key in your code, consider implementing null-checks and defaults to prevent runtime errors. For example, you can use optional chaining to safely access the
assistantId
and set a default value if it's missing. If these suggestions don't resolve the issue, it might be helpful to consult Vapi's documentation or support for more specific guidance on the payload structure differences between web and phone calls. Let me know if you need further assistance! 😊 Sources: - [Vapi Community Discussion](https://discord.com/channels/1211482211119796234/1211483291191083018/1336915389040558160)
- [Vapi Web SDK Documentation](https://docs.vapi.ai/sdk/web) - [Server URL Handling](https://docs.vapi.ai/server-url/events)
k
Hey it exists can you share the code snippet your trying to make use of it?
c
sure. I am using the webhooks to process end of call reports, because the typescript client sdk wasn't up to date in its type definitions I saw on the official api refernce back when I tried it a couple of weeks ago. https://cdn.discordapp.com/attachments/1345103814318882959/1346527248089350256/code_snipped.txt?ex=67c882b9&is=67c73139&hm=ea272629eb23cfe64961079f570bd0dd74d79a4c4d148e30700a69d10f744dc5&
s
@corneliusschramm checking if your able to resolve it now?
FYI: To fix this, you should make the assistantId optional in your schema, then in your processing logic, you can handle cases where assistantId might be missing.
Copy code
ts
await processEndOfCallReport({
 ...,
  assistantId: call?.assistantId || DEFAULT_ASSISTANT_ID,
});
2 Views