Skip to main content

Webhooks overview

Webhooks send activity from your UponAI agents to your application as JSON HTTP POST requests. Use them to update a CRM, process transcripts, monitor transfers, or start an automation when analysis is ready, without repeatedly checking an API.

Voice events​

These events are available for both LLM-based and conversation-flow voice agents. Webhook settings belong to the agent.

EventWhen it happensData to use
call_startedA call connects and begins.Call and agent identifiers, with initial call information.
call_endedA call finishes, transfers, or fails.End status, disconnection reason, and available call details. Analysis may not be ready yet.
call_analyzedPost-call analysis finishes.Call details and call_analysis.
transcript_updatedTranscript turns update, including a final update at call end.Available call details and transcript_with_tool_calls.
transfer_startedA transfer attempt begins.Call details, plus transfer destination and options when available.
transfer_bridgedA transfer connects.Call details, plus transfer destination and options when available.
transfer_cancelledA transfer is cancelled or fails to connect.Call details and available transfer context.
transfer_endedThe transfer leg ends.Available call details.

A call that never connects may have no call_started event. Handle end and analysis events without requiring a previously received start event.

Chat events​

EventWhen it happensData to use
chat_startedA chat begins.Chat and agent identifiers, with initial chat information.
chat_endedA chat finishes or encounters an error.Available chat details; analysis may not be ready yet.
chat_analyzedChat analysis finishes.Chat details and chat_analysis.

Configure your receiving endpoint​

  1. Open the agent's webhook settings and enter your application's receiving URL.
  2. Select the events you want delivered. Voice and chat agents have separate event lists.
  3. Configure webhook authentication for the endpoint, then save.
  4. When changing subscriptions on a draft, publish that version and verify that the relevant phone numbers use it.

UponAI stores your receiving URL separately from its managed delivery endpoint. Enter your own URL; UponAI handles routing and branding automatically. Optional transcript and transfer events follow your saved selections. Clearing an optional selection removes it from the subscription. Internal lifecycle processing continues independently of the events you choose to receive.

Browser demo calls and API web sessions use the saved event selections. Saving or publishing an agent preserves the customer receiving URL.

Configure through the API​

Set webhook_url and webhook_events when creating or updating an agent. For example, update an editable voice-agent version:

curl -X PATCH 'https://api.upon-ai.com/api/v1/agents/agent_example?version=3' \
-H "Authorization: Bearer $UPONAI_API_KEY" \
-H 'Content-Type: application/json' \
-d '{
"workspaceId": 123,
"webhook_url": "https://example.com/hooks/voice",
"webhook_events": ["call_ended", "call_analyzed", "transcript_updated", "transfer_ended"]
}'
  • On creation, omitting webhook_events selects the three lifecycle events for that channel: started, ended, and analyzed.
  • On PATCH, omitted webhook fields keep their current values.
  • webhook_events: [] disables customer event forwarding.
  • webhook_url: null clears the receiving destination.
  • Read the agent back after saving to confirm the URL and event selections.

A subscription change against a published version can return 409. Update an editable draft, then publish it separately. A destination-only update can save against a published version when its managed endpoint and subscriptions already match. Historical version responses show the current agent-level customer webhook settings.

See Update agent, Update chat agent, and the API, SDK, and MCP configuration guide.

Request payloads​

Voice deliveries contain an event and a call object. Chat deliveries contain an event and a chat object. Fields depend on the event and available data; accept additional fields and handle missing optional values.

This shortened voice example illustrates a completed call:

{
"event": "call_ended",
"call": {
"call_id": "call_example",
"agent_id": "agent_example",
"call_type": "phone_call",
"direction": "inbound",
"call_status": "ended",
"disconnection_reason": "user_hangup",
"start_timestamp": 1792500000000,
"end_timestamp": 1792500060000,
"transcript": "Agent: Hello. How can I help?"
}
}

Transfer events can include additional top-level context:

{
"event": "transfer_started",
"call": { "call_id": "call_example", "agent_id": "agent_example" },
"transfer_destination": { "number": "+12025550123", "extension": "100" },
"transfer_option": { "type": "warm_transfer" }
}

A chat delivery follows the same envelope pattern:

{
"event": "chat_started",
"chat": { "chat_id": "chat_example", "agent_id": "agent_example" }
}

Authenticate deliveries​

Agent webhook settings support these receiving-endpoint authentication methods:

MethodHeader your endpoint validates
BasicAuthorization: Basic <base64-encoded credentials>
BearerAuthorization: Bearer <configured token>
API keyX-API-Key: <configured value>

Use HTTPS and a dedicated secret for webhook authentication. The receiving-endpoint secret is separate from the API key your application uses to call UponAI. Match the configured method at your endpoint before accepting a delivery.

Node.js receiver example​

This example assumes you selected Bearer authentication in the agent's webhook settings. Set UPONAI_WEBHOOK_TOKEN to that same secret. Install express, and supply your application's durable webhookQueue implementation before running it.

import express from 'express';
import { timingSafeEqual } from 'node:crypto';
import { webhookQueue } from './webhook-queue.js';

const token = process.env.UPONAI_WEBHOOK_TOKEN;
if (!token) throw new Error('Set UPONAI_WEBHOOK_TOKEN');
const expected = Buffer.from(`Bearer ${token}`);
const app = express();

app.post('/hooks/voice', (req, res, next) => {
const actual = Buffer.from(req.get('authorization') || '');
if (actual.length !== expected.length || !timingSafeEqual(actual, expected)) {
return res.sendStatus(401);
}
next();
}, express.json({ limit: '5mb' }), async (req, res) => {
const { event, call, chat } = req.body || {};
const entityId = call?.call_id || chat?.chat_id;
if (typeof event !== 'string' || !entityId) return res.sendStatus(400);

try {
// Persist first; process CRM updates and other work in your queue worker.
await webhookQueue.enqueue(req.body);
return res.status(204).end();
} catch {
return res.sendStatus(503);
}
});

app.listen(3000);

Adjust the request-size limit for your expected transcripts. Return a 2xx response promptly after safely accepting the payload. Do expensive work asynchronously. Do not depend on a fixed retry count, a fixed delivery deadline, or exactly-once arrival; keep a reconciliation path for important business records.

  • Lifecycle events: make processing idempotent using event plus call_id or chat_id, scoped to your integration.
  • Transcript updates: expect multiple deliveries for one call. Update the transcript snapshot rather than discarding every event after the first call ID.
  • Transfers: one call can have multiple attempts. Include available event timestamps and transfer context when identifying a delivery; call ID and event name alone cannot distinguish attempts.
  • Analysis: wait for the analyzed event when your workflow requires analysis fields. Do not assume they are populated in the ended event.

Handle duplicate or delayed deliveries without repeating actions such as creating CRM records or sending notifications.

Test and troubleshoot​

For local development, expose your receiver through an HTTPS tunnel and configure that public URL on a test agent. Run a test call or chat, then check the receiving server's request logs and the agent settings readback.

If an event is missing, verify the saved URL, selected events, authentication, active agent version, and phone assignment. Transcript and transfer events must be selected explicitly. A transfer event also requires the corresponding transfer action to occur.

In Call History, open the call's Transcript to inspect recorded tool inputs and results, including pre-call and post-call tools. Open Logs for additional execution details. These views help diagnose the call workflow; check your own receiver logs to verify that your application accepted a webhook.

For configuration errors, 400 indicates an invalid URL or event selection, 409 indicates a published-version subscription conflict, and 502 indicates subscription verification failed and the customer settings were not saved.

Protect customer data​

Webhook payloads can contain transcripts, contact details, metadata, tool results, and recording links. Apply your own access controls, retention policy, and logging redaction to everything your receiver stores. Do not assume a storage preference makes an incoming webhook safe to log in full.

Optional fields and media availability can vary with privacy settings. Treat media links as sensitive and potentially temporary; handle unavailable or expired links without failing the entire event-processing workflow.

Search documentation

Type to filter pages. Use ↑ ↓ to choose, then Enter to open.

0 matching pages
AI questions are sent only when you select Ask AI or press Enter on it. Don’t include API keys or customer data.