https://retellai.com/?utm_source=discord&utm_medium=seo logo
how do i get a retell webhook
# ❓・ai-evy-support
j
@AI Evy how do i get a retell webhook?
a
Thanks for tagging me @jaidami_21355. I'll look through relevant sources and get back to you shortly.
### Answer To set up a Retell AI webhook, follow these steps [(1) ]() : 1. Create your server endpoint - Set up an HTTP or HTTPS endpoint that can accept webhook requests with a POST method :
Copy code
javascript
// install the sdk: <https://docs.retellai.com/get-started/sdk>
import { Retell } from "retell-sdk";
import express, { Request, Response } from "express";
const app = express() ;
app.use(express.json() ) ;
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. Test locally - Test your endpoint on
localhost:8080/webhook
using this CURL command :
Copy code
bash
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
 }
}'
3. Make your endpoint online - Deploy using Ngrok :
Copy code
bash
brew install ngrok/ngrok/ngrok
Copy code
bash
ngrok http <http://localhost:8080>
4. Register your webhook - You have two options: - **Account level webhook**: Set up through the dashboard's webhooks tab for events related to any agent under your account - **Agent level webhook**: Set up through the dashboard's agent detail page 5. Verify your webhook - Start a web call in the dashboard to verify the webhook is triggered correctly Retell AI supports three webhook events:
call_started
,
call_ended
, and
call_analyzed
[(2) ]() . The webhook will POST the payload to your endpoint with a 10-second timeout and up to 3 retries .
​ To learn more, see the sources I considered: [[1] Setup guide](https://docs.retellai.com/features/register-webhook) [[2] Webhook Overview](https://docs.retellai.com/features/webhook-overview) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.