https://retellai.com/?utm_source=discord&utm_medium=seo logo
Good evening, I fixed the post chat data extractio...
# ❓・ai-evy-support
t
@AI Evy Good evening, I fixed the post chat data extraction however I need to keep re running it to get it, which costs more, anyway how to fix it
a
Thanks for tagging me @Tubussie. I'll look through relevant sources and get back to you shortly.
### Answer Good evening! To avoid re-running and incurring extra costs, use the
call_analyzed
webhook
instead of polling the API repeatedly. [(1) ]() Here's how to set it up: 1. Configure your webhook to listen for the
call_analyzed
event type. [(2) ]() 2. Wait for the webhook — Post-call analysis results are typically available within seconds of the call ending and will be pushed to your endpoint automatically. [(1) ]() 3. Access the data — The
call_analysis
field in the webhook payload contains your custom analysis data including
custom_analysis_data
. [(3) ]() Important notes: - Post-call analysis fields will not be populated for calls that were not connected or where no conversation took place — check whether the field exists before using it. [(4) ]() - If you have data storage opt-out enabled, post-call analysis will not run. You would need to disable that setting for analysis to work. [(5) ]() - If using Make (Integromat) , use the "keep or use current data" option to grab the analyzed data, and check the webhook queue (truck icon) for unprocessed webhooks. [(6) ]() For more details on consuming post-call analysis via webhooks: [Post Call Analysis Overview]()
​ To learn more, see the sources I considered: [[1] Unlock Insights with Post-Call Analysis | Retell AI](https://www.retellai.com/features/post-call-analysis) [[2] Get Voice Agent](https://docs.retellai.com/api-references/get-agent) [[3] Update Call](https://docs.retellai.com/api-references/update-call) [[4] Post Call Analysis Overview](https://docs.retellai.com/features/post-call-analysis-overview) [[5] Post-Call Analysis](https://discord.com/channels/1186424376300679209/1339583616665255968) [[6] Discord message from @masanovets on 2024-11-23](https://discord.com/channels/1186424376300679209/1186462578310910112/1309859852725522502) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy Refers to previous messages, this is a chatbot
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer To avoid re-running post-call analysis (and the extra costs) , set up a webhook to receive the data automatically when analysis completes. [(1) ]() How to fix this: 1. Set up a webhook endpoint in your application to receive POST requests. [(2) ]() 2. Configure the webhook in your Retell dashboard to listen for the
call_analyzed
event type. 3. Handle the webhook payload — when a call is analyzed, you'll receive the full call data including the
call_analysis
object automatically. [(1) ]() Here's sample code for handling the webhook:
Copy code
javascript
app.post("/webhook", (req: Request, res: Response) => {
 if (
 !Retell.verify(
 JSON.stringify(req.body) ,
 process.env.RETELL_API_KEY,
 req.headers["x-retell-signature"] as string,
 )
 ) {
 console.error("Invalid signature") ;
 return;
 }
 const {event, call} = req.body;
 switch (event) {
 case "call_analyzed":
 console.log("Call analyzed event received", call.call_id) ;
 break;
 }
 res.status(204) .send() ;
}) ;
[(2) ]() Important notes: - Post-call analysis fields will not be populated for calls that were not connected or where no conversation took place — check whether the field exists before using it. [(1) ]() [(3) ]() - If the call doesn't start/connect (e.g.,
dial_no_answer
) , the
call_analyzed
webhook may not trigger since no analysis is performed when no conversation occurred. [(4) ]() For webhook configuration details: [Webhook Overview]()
​ To learn more, see the sources I considered: [[1] Consume the analysis data](https://docs.retellai.com/features/post-call-analysis-consumption) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[3] Post Call Analysis Overview](https://docs.retellai.com/features/post-call-analysis-overview) [[4] No "call_analyzed" webhook for some disconnection reasons](https://community.retellai.com/t/no-call-analyzed-webhook-for-some-disconnection-reasons/387) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy Does setting up the webhook work the same for voice agents and chat agents
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer Yes, the webhook setup works similarly for both voice agents and chat agents. The inbound webhook supports both call and SMS/chat scenarios—when you receive an inbound call, the event is
call_inbound
, and for inbound SMS/chat, you use
chat_inbound
. [(1) ]() The webhook will
POST
the payload to your endpoint with the same timeout (10 seconds) and retry behavior (up to 3 times) for both. Key differences in the payload: - For inbound calls, the event field is
"event": "call_inbound"
- For inbound SMS/chat, the event field is
"event": "chat_inbound"
Response format: - For calls: respond with
call_inbound
object containing your overrides - For SMS/chat: respond with
chat_inbound
object (simply replace
call_inbound
with
chat_inbound
in your response) The same fields are available for override in both cases, including
override_agent_id
,
dynamic_variables
,
metadata
, and
agent_override
. Check out these potentially useful sources for more details: - [Inbound webhook]() - [Webhook Overview]()
​ To learn more, see the sources I considered: [[1] Inbound webhook](https://docs.retellai.com/features/inbound-call-webhook) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.