Webhook not reliable for outbound calls
# support
a
I have a webhook set up on a NextJS app. I am not able to receive webhooks reliably for "end-of-call" events for outbound calls I am having my Vapi agent do. I am creating a Vapi assistant dynamically in code with the following parameters
Copy code
{
    name: "assistant",
    serverMessages: ["end-of-call-report"],
    serverUrl: "https://MY_URL.com/api/vapi,
    serverUrlSecret: "HASH_OF_SERVER_SECRET,
    hipaaEnabled: true,
    backgroundSound: "off",
    model: {
      provider: "openai",
      model: "gpt-4o",
      tools: [{
        "type": "endCall"
      }],
    },
    endCallMessage: "Goodbye!",
    endCallPhrases: ["Goodbye", "Have a nice day", "Bye"],
    firstMessage: "MY_DYNAMIC_FIRST_MESSAGE",
    voicemailMessage: "MY_DYNAMIC_VOICEMAIL_MESSAGE",
    voicemailDetection: {
      provider: "twilio",
    }
  };
The webhook URL is correct and have a handler for vapi "end-of-call" events on that route. There are times when I receive webhook no problem when the Vapi agent ends the call. But, most times I do not. I have noticed that receiving "end-of-call" events for voicemails and when the callee hangs up is more reliable. I cannot tell if this is a Vapi issue. Maybe something isn't configured properly for when the Vapi agent ends the call for an outbound call? @Sahil any ideas?
@nikhil btw this is related to the github PR I put up here: https://github.com/VapiAI/web/pull/54. Really want to use vapi but unsure about how reliable the webhooks are from dynamic assistants. Lmk if I'm doing something wrong.
s
@Ajay Vasisht do you mind sharing some latest call_id for which you haven't recieved the end-of-call-report? Well, we send status-update for all the cases even the call failed but that's not the case with end-of-call-report
So you might want to listen to that webhook as well
a
@Sahil yeah some latest call ids that I didn't receive end-of-call-report events for reliably: - 22809210-852d-4fb8-af9c-92d48ab770cf - 3a630b1f-6096-4656-8926-d97d25136f17 - 6a50ff8d-93fd-4f8e-afe3-7516a87d12dd The reason I'm not doing the status-update one is because I need the transcript and summary. And I can only get this from the webhook b/c I need VAPI not to store that info to be HIPAA-compliant. Otherwise, ofc I would just poll for that data from the GET call API.
Is there a way you're handling outbound calls differently than inbound? Or maybe it's because I'm creating dynamic assistants vs. re-using one but with overrides?
cc @nikhil
c
Wouldnt webhooks be a problem from your server and not VAPI. VAPI does not provide webhooks. I have had issues of webhooks being stupid sometimes but that has nothing to do with. Just reset the webhook or server.
a
@Chowderr Vapi emits events to a webhook URL I have configured on an assistant. But I'm saying for end-of-call reports sent for outbound calls on assistants I am dynamically making, I am not receiving those events on my webhooks reliably in production on my vercel deployment. My server appears fine as I get webhooks on different routes from different providers (e.g. clerk, stripe). And, I get these events sometimes but not call the time. Have tried deploying the server but that doesn't resolve the issue. My peer has the same vercel setup as I for inbound calls on assistants he made on the dashboard and those events to his webhook URL appear reliable. So my guess is VAPI wasn't handling my edge case the same.
c
I see. usually putting a new webhook reolves the issue for me. weird.
a
What do you mean by put a new webhook?
c
a new webhook/serverurl
a
yeah have tried that too :/
s
We send the webhook data at the end of the call, but sometimes an error occurs or something happens during the call, which is why we don't send a webhook request for that particular one. The reason for this is that the call wasn't completed properly, so there is no point in sending an incomplete end-of-call report.
a
@Sahil That's the thing is from my POV it was completed correctly. I'm not sure why it would be an error reason for an outbound call that the vapi assistant ended because it said the endCallPhrase. Also, wouldn't you send a webhook any ways with the call reason being some "failure" reason according the list for
endedReason
on this API https://docs.vapi.ai/api-reference/calls/get-call?
Can we hop on a quick call? I think this is an edge case that requires a fix of some kind re: how you all handle outbound calls.
c
I dont know if this helps, but I track everything on call. Including all ended reason and map. SO when I pull the call I can actually see everything.
a
Yeah @Chowderr I can see the reason for the call ending on the dashboard. The issue is I want this information through a webhook b/c that's the only way I can get th transcript b/c we're HIPAA and so cant have VAPI store it. But, the webhook isn't publishing. And @Sahil it seem the call reasons aren't necessarily errors for the call IDs - one is that the customer ended, another is that the assistant ended. Neither gave me a webhook. I want to call out that these 2 calls happened the same way though - vapi called me, I gave info, and it ended the call not me. Not sure why the reasons are different. https://cdn.discordapp.com/attachments/1273036658413146237/1274037627053670490/image.png?ex=66c0cb80&is=66bf7a00&hm=8052dbe1f57f0f266a0cf85a9565a3287420231b2f984fed3db694ffd1b4d123&
c
I do not look in the dashboard. I track this. So wherever you send you data if that makes sense. I I am using the API I dont need to go in the dashboard and check anything
a
I don't think that matters for my use case, but appreciate you sharing. Vapi's reason they show on their dashboard should be the same as the one I can pull via API.
c
So now when a call hits a certain view or is filled with one of those I get notified because its an actual problem
You know you don't see all of the information on the dashboard right...also VAPI does not noitfy you..... if that was the case you would have known this call had an error
a
Ended reason is on the dashboard?
c
But you thought the call was still complete right?
a
I'm saying Vapi might be labelling it incorrectly. I have just pulled the call info via API and it's the same ended reason I see on the dashboard.
c
I doubt it. There are two reasons and a status all the time. Do you know all of the reasons and statuses or no?
Also I thought if HIPPA is on no information is sent?
a
yes all listed on the
endedReason
here: https://docs.vapi.ai/api-reference/calls/get-call
if HIPAA on, you still get the transcript via webhook. Vapi doesn't store it for access via API
c
Would you not just turn on transcript in client messages?
a
not sure what you mean by client messages
Its the thing right above this where you set everything lol - server messages.
a
no I want just end-of-call-report. transcript sends too many intermediate events - I just want the end transcript for a call.
sorry was confused, I'm doing this programatically
c
So do you have a bug. I am confused. This sends after the call if you have it set. What I said earlier would fix. Just change your webhook and do one call and test. No lie i just did this 5 times for a video I am making. All worked fine If you are doing this all by the API then maybe your JSON is wrong or something?
a
The problem is still: 1. for outbound calls from a dynamic assistant created in code, the end-of-call-report event does not fire reliably to my webhook URL 2. Sahil said VAPI doesn't send that event for errors, but the call ids I shared aren't errors and should have still fired an event. cc: @Sahil @nikhil
shown here
can you see if something is wrong in my json?
c
Goes back to your server like I said. You would have to check the times and etc.
To be fair that is what you should have sent first to isolate the problem. 1. lets just assume VAPI sends the report all the time. 2. Then its up to your webhook to catch it - if it doesnt it most likely your webhook or the platform you are using. 3. I make vidoes on this exact same thing. Whenever i have a problem a just switch the webhook and it works. Across 10 different platforms. Code/No code. if you have jot done that then thats where you need to start. (baiscally if you have jt tried to change the webhook and replicate you will get nowhere)
a
I'm confident my server webhook URL is correct because I sometimes get the end-of-call-report on my URL just not all the time. And, on similar webhook URLs on my server for other services (e.g. clerk, stripe) I get those webhooks 100% reliably. I don't think 1. is the assumption I can make based on what I'm seeing / what Sahil said.
c
I am not saying it is not correct. I am simply saying try another one.
That is simple troubleshooting at a basic level.
a
I have tried another one haha
c
I am not sure how to explain it more clearly
All from NodeJS? s
a
yup
c
Try something else - just because. I would literally say your NodeJS is broken lol
Your saying everything I do from NodeJS is not working and blaming VAPI. A simple test would be to put a webhook from somewhere else and see if that sent. If it didnt then you know its VAPI not your sevrer. Does that make sense?
a
that's what I'm saying I have done.
c
I am not saying switch or anything. Just do more test.
So no webhook from anywhere works when you make a call?
a
It does not work reliably, no.
c
So all webhooks from different platforms fire lets say 2/5 times?
a
yes exactly
c
Yea we have to see if its a bug on VAPI side or something.
a
exactly, thanks for your help @Chowderr . Let's see what @Sahil @nikhil suggest around this too.
c
I wont lie tagging nikhil wont do much. He is not on discord like that.
a
didn't know, worth a shot haha. Praying for Sahil then
flagging this here to easily access @Sahil
and this
and this
s
Sent you calendly link.
so marking it as complete for now.
a
thanks
found time tomorrow - chat soon!
c
Curious to know your outcome on this 🙂
a
ah yup meant to follow up here
@Sahil and I got on a call and he basically said it was a Vapi bug
they saw last Friday that they werent handling events correctly for outbound calls, put in the patch, and it's worked perfectly fine since then
so ty Sahil for hopping on the call and explaining that. Would love to hear more about the specific issue but you were super helpful!
@Chowderr hope that helps
c
I very much kindly appreciate that information. @Sahil maybe a bugs channel update. Would be sweet.
5 Views