https://retellai.com/?utm_source=discord&utm_medium=seo logo
How do we know in webhook if call was successfully...
# ❓・ai-evy-support
f
@AI Evy How do we know in webhook if call was successfully complete by user after all discussion?
a
Thanks for tagging me @faizan_53123. I'll look through relevant sources and get back to you shortly.
### Answer To determine if a call was successfully completed, you can use webhooks to receive real-time notifications about call events [(1) ]() . The webhook system supports different event types including when a call ends and when it's analyzed [(2) ]() . When setting up webhooks, you'll receive notifications with different event types . For call completion analysis, the most relevant webhook event is the
call_analysis
event :
Copy code
json
{
 "event_type": "call_analysis",
 "call_analysis": {
 // Analysis results object
 }
}
You can also access call completion information through the Get Call API [(1) ]() , which provides details like transcript, recording, and latency tracking . The webhook approach gives you real-time updates when a call is initiated, ends, and analyzed . For webhook configuration and setup details, you can refer to the Webhook Configuration section [(2) ]() .
​ To learn more, see the sources I considered: [[1] Receive calls](https://docs.retellai.com/deploy/inbound-call) [[2] Consume the analysis data](https://docs.retellai.com/features/post-call-analysis-consumption) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
f
@AI Evy can i call some function(an api) at call succefull end through my agent?
a
Thanks for the follow-up, @faizan_53123. I'll get back to you soon.
### Answer Yes, you can trigger API calls when a call ends successfully through several mechanisms in Retell AI: ## Webhook Events You can configure a webhook URL at the agent level to receive call events [(1) ]() . When creating or updating an agent, set the
webhook_url
parameter :
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
 apiKey: 'YOUR_RETELL_API_KEY',
}) ;
const agentResponse = await client.agent.create({
 response_engine: { llm_id: 'llm_234sdertfsdsfsdf', type: 'retell-llm' },
 voice_id: '11labs-Adrian',
}) ;
console.log(agentResponse.agent_id) ;
The webhook will receive events when calls end, and you can check the
call_analysis
object to determine if the call was successful [(2) ]() . The call analysis includes fields like
call_successful
and
user_sentiment
. ## Custom LLM WebSocket Integration If you're using a custom LLM via WebSocket, you can send a
response_event
with
end_call
set to true to programmatically end the call [(3) ]() :
Copy code
json
{
  "response_type": "response",
  "response_id": "response_001",
  "content": "Thank you for calling. Have a great day!",
  "content_complete": true,
  "end_call": true
}
## Tool Call Integration During the call, you can use tool call invocation events to trigger external APIs . Send
tool_call_invocation
events through the WebSocket to call your functions . The webhook approach is typically the most straightforward for triggering actions after call completion, as it provides comprehensive call analysis data including success indicators [(2) ]() .
​ To learn more, see the sources I considered: [[1] Create Agent](https://docs.retellai.com/api-references/create-agent) [[2] List Calls](https://docs.retellai.com/api-references/list-calls) [[3] LLM WebSocket](https://docs.retellai.com/api-references/llm-websocket) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.