Flow agent wen hook not working

Here are my settings. The webhook is fine; I tested it with PowerShell. Is there anyone who can help me?

Based on your screenshot showing webhook settings, here are key things to verify:

Webhook Setup

You can register webhooks at two levels(1):

  • Account level webhook through system settings’ webhooks tab
  • Agent level webhook through the agent detail page

Verify Webhook Security

Your webhook endpoint needs to properly verify requests from Retell AI(2). Here’s the correct implementation:

// 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) => {
 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;
 // process the webhook
 // Acknowledge the receipt of the event
 res.status(204).send();
});

(2)

Webhook Response Requirements

Your endpoint must respond with a 2xx status code within 10 seconds(3). The webhook will retry up to 3 times if it doesn’t receive a success status(3).

Handle Webhook Events

Make sure your endpoint handles the different event types(1):

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();
});

(1)

Additional Notes

  • Only the API key with a webhook badge can verify webhooks(2)
  • You can allowlist Retell IP address: 100.20.5.228(2)
  • If metadata and retell_llm_dynamic_variables aren’t provided, they’ll be omitted from the webhook payload(3)

If you’re still experiencing issues after verifying these requirements, check that your webhook responds immediately with a 200 OK status(4).

hi i am using this function web hook with a flow agent

Based on your screenshot and the fact that you’re using a webhook with a Conversation Flow agent, here are the key points:

Webhook Configuration for Flow Agents

You can set the webhook URL at either the account level or agent level(1). From your screenshot, it appears you’ve configured the webhook URL in your agent settings.

Webhook URL Setup Options

You have two ways to register your webhook(2):

  • Account level webhook — Set up through the system settings’ webhooks tab for events related to any agent under your account
  • Agent level webhook — Set up through the dashboard’s agent detail page (note: if set, account level webhooks will not be triggered for that agent)

You can also set the webhook URL via API using the webhook_url parameter when creating or updating an agent(2).

Receiving Webhook Events

Once your webhook is registered, Retell automatically sends events including call_analyzed to your endpoint(2). Your server should handle it like this:

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)

Webhook Requirements

The webhook will POST the payload to your endpoint with a timeout of 10 seconds(1). If within 10 seconds no success status (2xx) is received, the webhook will be retried, up to 3 times(1).

Webhook Security

The webhook can be verified using your Retell API Key to make sure it comes from Retell AI(3). You should implement signature verification in your endpoint to ensure authenticity.

Since you mentioned testing with PowerShell was successful, make sure your production endpoint returns a 2xx status code within the 10-second timeout window and properly handles the event payload structure.

**

Hello @salas_jose, I noticed you’re using a custom function with an endpoint included. Could you clarify what isn’t working as expected? Did you try calling the function, and if so, did it fail to hit your API? Also, could you share a call ID so we can investigate further?