https://retellai.com/?utm_source=discord&utm_medium=seo logo
For some reason, when the call ends, two web hooks...
# ❓・ai-evy-support
w
@AI Evy For some reason, when the call ends, two web hooks are sent. Can this be fixed? Also, if the conversation ends too quickly, the variables are not sent.
a
Thanks for tagging me @who3677. I'll look through relevant sources and get back to you shortly.
### Answer Based on the available sources, there are indeed documented cases of duplicate webhook events being sent. Regarding duplicate webhooks: Multiple webhook events for the same call have been reported by other users [(1) ]() [(2) ]() . The webhook system has a timeout of 10 seconds and will retry up to 3 times if no success status (2xx) is received [(3) ]() [(4) ]() . This retry mechanism could potentially cause duplicate webhooks if your endpoint doesn't respond properly or times out. Regarding variables not being sent when conversations end quickly: Dynamic variables are collected during the call and only become available after the call ends [(5) ]() [(6) ]() [(7) ]() . When a dynamic variable is not assigned a value during the call, it will remain unchanged in its raw form (e.g.,
{{variable_name}}
) rather than being replaced [(5) ]() . Recommended solutions: 1. Ensure your webhook endpoint returns a 2xx status code within 10 seconds to prevent retries [(3) ]() [(4) ]() 2. Implement idempotency checks in your webhook handler to handle potential duplicates 3. For variables in short calls, consider using the
call_analyzed
webhook event instead of
call_ended
, as it provides the complete call analysis including all collected dynamic variables [(3) ](
ok-overview) You can verify webhook authenticity using the
x-retell-signature
header with your Retell API Key to ensure the webhooks are legitimate [(8) ]() .
​ To learn more, see the sources I considered: [[1] Webhook called multiple times inconsistently for one call](https://discord.com/channels/1186424376300679209/1357052408819355729) [[2] webhook for call_started event getting sent twice on some inbound calls](https://discord.com/channels/1186424376300679209/1275810854440276039) [[3] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[4] Inbound call webhook](https://docs.retellai.com/features/inbound-call-webhook) [[5] Dynamic Variables](https://docs.retellai.com/build/dynamic-variables) [[6] Create Web Call](https://docs.retellai.com/api-references/create-web-call) [[7] Create Phone Call](https://docs.retellai.com/api-references/create-phone-call) [[8] Secure the webhook](https://docs.retellai.com/features/secure-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
w
У меня Вместо (или вместе с) call_ended подписывайтесь на событие call_analyzed. — Оно отправляется только после того, как весь текст и все переменные извлечены и подставлены в JSON. как раз таки два веб хука call_ended и call_analyzed, а надо только один в котором вся инфа, это возможно?
@AI Evy Instead of (or along with) call_ended, subscribe to the call_analyzed event. It is only sent after all text and variables have been extracted and inserted into JSON. There are two web hooks, call_ended and call_analyzed, but I only need one that contains all the information. Is that possible?
a
Thanks for the follow-up, @who3677. I'll get back to you soon.
### Answer Based on the documentation, you can indeed subscribe to just the
call_analyzed
event to get all the information in one webhook [(1) ]() . The
call_analyzed
event is triggered when call analysis is complete and contains the full call data including the
call_analysis
object . This event includes all fields from the call object that would be in
call_ended
, plus the complete analysis data . According to the webhook specification, you can set up your webhook endpoint to handle only the
call_analyzed
event [(2) ]() . In your webhook handler, you would filter for this specific event type:
Copy code
javascript
app.post("/webhook", (req: Request, res: Response) => {
 const {event, call} = req.body;
 switch (event) {
 case "call_analyzed":
 console.log("Call analyzed event received", call.call_id) ;
 break;
 default:
 console.log("Received an unknown event:", event) ;
 }
 // Acknowledge the receipt of the event
 res.status(204) .send() ;
}) ;
The
call_analyzed
webhook contains the complete call object with all collected dynamic variables and the full call analysis, so you won't need the separate
call_ended
event [(1) ]() . This approach ensures you receive all the extracted text and variables in a single webhook after processing is complete . You can configure this either at the account level through the dashboard's webhooks tab or at the agent level through the agent detail page [(2) ]() .
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] 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.