https://retellai.com/?utm_source=discord&utm_medium=seo logo
Hello, good day
# ❓・ai-evy-support
m
@AI Evy Hello, good day. I have an agent who makes calls without any problems, but when the call ends, the webhook with the end events isn't being sent. Is there anything else I should be aware of?
a
Thanks for tagging me @miguelusma04. I'll look through relevant sources and get back to you shortly.
### Answer --- Hello! Here are a few things to check regarding
call_ended
webhooks not being received: 1. Webhook URL Configuration Make sure your webhook URL is properly set at either the agent level or account level. The agent-level
webhook_url
setting will override the account-level webhook for that specific agent. [(1) ]() 2. Endpoint Requirements Your endpoint must return a success status code (2xx) within 10 seconds. If no success status is received, the webhook will retry up to 3 times. [(2) ]() 3. Event Handling The webhook sends three event types:
call_started
,
call_ended
, and
call_analyzed
. All events POST to the same URL, so your endpoint should handle each event type appropriately. Here's an example of how to handle the events:
Copy code
javascript
app.post("/webhook", (req: Request, res: Response) => {
  const {event, call} = req.body;
  switch (event) {
    case "call_started":
      console.log("Call started event received", call.call_id) ;
      break;
    case "call_ended":
      console.log("Call ended event received", call.call_id) ;
      break;
    case "call_analyzed":
      console.log("Call analyzed event received", call.call_id) ;
      break;
    default:
      console.log("Received an unknown event:", event) ;
  }
  res.status(204) .send() ;
}) ;
[(3) ]() 4. Non-Blocking Behavior Note that webhooks are triggered in order but are not blocking. If
call_started
webhook fails,
call_ended
can still be triggered. [(2) ]() 5. Calls That Don't Connect If a call did not connect (e.g.,
dial_failed
,
dial_no_answer
,
dial_busy
) , the
call_started
webhook won't be triggered, but
call_ended
and
call_analyzed
webhooks will still fire. I'd recommend checking your server logs to see if the webhook requests are arriving but failing, or if they're not arriving at all. You can also verify your webhook URL is accessible publicly using tools like ngrok during testing. [(3) ]()
​ To learn more, see the sources I considered: [[1] List Chat Agents](https://docs.retellai.com/api-references/list-chat-agents) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[3] Setup guide](https://docs.retellai.com/features/register-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.