conversation.analysis

The conversation analysis webhook is triggered when conversation analysis completes.

Webhook payload

Here is an example of the POST request JSON payload:

1{
2 "event_type": "conversation.analysis",
3 "data": {
4 "conversation": {
5 "latencies_ms": [3179, 935, 595],
6 "interruptions_count": 1
7 },
8 "call_info": {
9 "from_phone_number": "+17124583766",
10 "to_phone_number": "+19189397081"
11 }
12 },
13 "created_at": "2025-07-14T11:36:33.767Z"
14}

Example usage

Here’s an example of how to handle the webhook in a Hono app:

1import { Hono } from "hono";
2import { Webhook } from "svix";
3
4const app = new Hono();
5
6app.post("/webhooks/phonic", async (c) => {
7 if (!process.env.PHONIC_WEBHOOK_SECRET) {
8 return c.text("Bad Request", 400);
9 }
10
11 const wh = new Webhook(process.env.PHONIC_WEBHOOK_SECRET);
12 const rawBody = await c.req.text();
13
14 try {
15 const payload = wh.verify(rawBody, {
16 "svix-id": c.req.header("svix-id") ?? "",
17 "svix-timestamp": c.req.header("svix-timestamp") ?? "",
18 "svix-signature": c.req.header("svix-signature") ?? "",
19 });
20
21 console.log(JSON.stringify(payload, null, 2));
22
23 return c.text("OK", 200);
24 } catch (error) {
25 console.error("Failed to verify webhook:", error);
26
27 return c.text("Bad Request", 400);
28 }
29});
30
31export default app;