https://retellai.com/?utm_source=discord&utm_medium=seo logo
I’m trying to send call outcome data to my n8n wor...
# ❓・ai-evy-support
a
Thanks for tagging me @Milano. I'll look through relevant sources and get back to you shortly.
### Answer [(1) ]() The 404 error is not normal and indicates a configuration issue with your n8n webhook endpoint [(2) ]() . Your endpoint needs to accept POST requests at the exact path you've specified [(3) ]() . Setup Steps: 1. Create your n8n webhook endpoint that accepts POST requests :
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) ;
 }
 // Acknowledge the receipt of the event
 res.status(204) .send() ;
}) ;
2. Ensure both your n8n webhook and Retell use the same HTTP method (POST) [(2) ]() . 3. Test locally first using curl before using ngrok [(3) ]() :
Copy code
curl --location 'localhost:8080/webhook' \
--header 'Content-Type: application/json' \
--data '{
 "event": "call_ended",
 "call": {
 "call_type": "phone_call",
 "from_number": "+12137771234",
 "to_number": "+12137771235",
 "direction": "inbound",
 "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
 "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
 "call_status": "registered",
 "metadata": {},
 "retell_llm_dynamic_variables": {
 "customer_name": "John Doe"
 },
 "start_timestamp": 1714608475945,
 "end_timestamp": 1714608491736,
 "disconnection_reason": "user_hangup",
 "transcript": "...",
 "opt_out_sensitive_data_storage": false
 }
}'
Regarding call outcome data: The webhook payload includes
disconnection_reason
in the
call
object [(1) ]() . To receive only specific events, filter them using the
webhook_events
field when creating or updating your agent . The default events are
call_started
,
call_ended
, and
call_analyzed
. Your n8n endpoint must return a successful status code (2xx) within 10 seconds .
​ To learn more, see the sources I considered: [[1] Webhook Overview](https://docs.retellai.com/features/webhook-overview) [[2] 404 error](https://discord.com/channels/1186424376300679209/1381540467493048440) [[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.
m
@AI Evy What does the test button send out to my endpoint
a
Thanks for the follow-up, @Milano. I'll get back to you soon.
### Answer The available sources don't specify what exact payload the test button sends to your endpoint. However, based on the webhook specification, the test would likely send a sample webhook payload with the structure documented for webhook events [(1) ]() . The webhook payload structure includes the event type and call object . For example, a
call_ended
event payload looks like this [(2) ]() :
Copy code
json
{
 "event": "call_ended",
 "call": {
 "call_type": "phone_call",
 "from_number": "+12137771234",
 "to_number": "+12137771235",
 "direction": "inbound",
 "call_id": "Jabr9TXYYJHfvl6Syypi88rdAHYHmcq6",
 "agent_id": "oBeDLoLOeuAbiuaMFXRtDOLriTJ5tSxD",
 "call_status": "registered",
 "metadata": {},
 "retell_llm_dynamic_variables": {
 "customer_name": "John Doe"
 },
 "start_timestamp": 1714608475945,
 "end_timestamp": 1714608491736,
 "disconnection_reason": "user_hangup",
 "transcript": "...",
 "opt_out_sensitive_data_storage": false
 }
}
The test button likely sends a similar sample payload to verify your endpoint can receive and process webhook events correctly [(1) ]() .
​ 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.