Webhooks API
Manage signed webhook endpoints, delivery history, and signature verification.
Manage signed webhook endpoints, delivery history, and signature verification.
WebhooksClient
Project webhook endpoints, secret rotation, and delivery history.
create
Creates a signed webhook endpoint and reveals its secret once.
create(options: CreateWebhookEndpointOptions): Promise<CreatedWebhookEndpoint>| Parameter | Type | Required | Description |
|---|---|---|---|
options | CreateWebhookEndpointOptions | Yes | HTTPS destination, subscribed event types, and initial active state. |
Returns: Promise<CreatedWebhookEndpoint>
Throws
- EyeballError when validation, authentication, or executor admission fails.
Example
import { Eyeball } from "@eyeball/sdk";
const eyeball = new Eyeball({
apiKey: process.env.EYEBALL_API_KEY!,
baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});
const endpoint = await eyeball.webhooks.create({
url: "https://agent.example.com/eyeball",
events: ["execution.completed", "trigger.slack.message_received"],
});
console.log(endpoint.secret);delete
Permanently removes one webhook endpoint.
delete(endpointId: string): Promise<void>| Parameter | Type | Required | Description |
|---|---|---|---|
endpointId | string | Yes | Project-scoped webhook endpoint identifier. |
Returns: Promise<void>
Throws
- EyeballError when the endpoint is unavailable or the request fails.
deliveries
Lists delivery attempts for one webhook endpoint.
deliveries(endpointId: string, options?: ListWebhookDeliveriesOptions): Promise<WebhookDeliveryPage>| Parameter | Type | Required | Description |
|---|---|---|---|
endpointId | string | Yes | Project-scoped webhook endpoint identifier. |
options | ListWebhookDeliveriesOptions | No | Cursor and page-size controls. |
Returns: Promise<WebhookDeliveryPage>
Throws
- EyeballError when pagination is invalid or the executor request fails.
get
Retrieves one webhook endpoint without exposing its signing secret.
get(endpointId: string): Promise<WebhookEndpoint>| Parameter | Type | Required | Description |
|---|---|---|---|
endpointId | string | Yes | Project-scoped webhook endpoint identifier. |
Returns: Promise<WebhookEndpoint>
Throws
- EyeballError when the identifier is invalid, unavailable, or the request fails.
list
Lists webhook endpoints with cursor pagination.
list(options?: ListWebhookEndpointsOptions): Promise<WebhookEndpointPage>| Parameter | Type | Required | Description |
|---|---|---|---|
options | ListWebhookEndpointsOptions | No | Cursor and page-size controls. |
Returns: Promise<WebhookEndpointPage>
Throws
- EyeballError when pagination is invalid or the executor request fails.
rotateSecret
Invalidates the prior signing secret and reveals its replacement once.
rotateSecret(endpointId: string): Promise<RotatedWebhookSecret>| Parameter | Type | Required | Description |
|---|---|---|---|
endpointId | string | Yes | Project-scoped webhook endpoint identifier. |
Returns: Promise<RotatedWebhookSecret>
Throws
- EyeballError when the endpoint is unavailable or the request fails.
update
Updates at least one mutable webhook endpoint field.
update(endpointId: string, options: UpdateWebhookEndpointOptions): Promise<WebhookEndpoint>| Parameter | Type | Required | Description |
|---|---|---|---|
endpointId | string | Yes | Project-scoped webhook endpoint identifier. |
options | UpdateWebhookEndpointOptions | Yes | New URL, event subscriptions, or active state. |
Returns: Promise<WebhookEndpoint>
Throws
- EyeballError when no field changes, a value is invalid, or the executor request fails.
createWebhookSignature
Creates the RFC 001 v1=<hex> signature for an exact raw payload.
createWebhookSignature(options: CreateWebhookSignatureOptions): string| Parameter | Type | Required | Description |
|---|---|---|---|
options | CreateWebhookSignatureOptions | Yes | — |
Returns: string
verifyWebhookSignature
Verifies a signed webhook using a constant-time digest comparison and a five-minute replay window. The payload must be the unmodified raw body.
verifyWebhookSignature(options: VerifyWebhookSignatureOptions): boolean| Parameter | Type | Required | Description |
|---|---|---|---|
options | VerifyWebhookSignatureOptions | Yes | — |
Returns: boolean
Types
CreateWebhookEndpointOptions
Fields accepted when registering a signed webhook destination.
export interface CreateWebhookEndpointOptions {
url: string;
events: readonly WebhookSubscriptionEventType[];
active?: boolean;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
active | boolean | No | No | — |
events | readonly WebhookSubscriptionEventType[] | Yes | No | — |
url | string | Yes | No | — |
UpdateWebhookEndpointOptions
Mutable webhook endpoint fields; at least one must be present.
export interface UpdateWebhookEndpointOptions {
url?: string;
events?: readonly WebhookSubscriptionEventType[];
active?: boolean;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
active | boolean | No | No | — |
events | readonly WebhookSubscriptionEventType[] | No | No | — |
url | string | No | No | — |
ListWebhookEndpointsOptions
Cursor pagination controls for webhook endpoint listing.
export interface ListWebhookEndpointsOptions {
cursor?: string;
limit?: number;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
cursor | string | No | No | — |
limit | number | No | No | — |
ListWebhookDeliveriesOptions
Cursor pagination controls for one endpoint's delivery history.
export interface ListWebhookDeliveriesOptions {
cursor?: string;
limit?: number;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
cursor | string | No | No | — |
limit | number | No | No | — |
CreatedWebhookEndpoint
export interface CreatedWebhookEndpoint extends WebhookEndpoint {
/** Returned only by endpoint creation. Store this value immediately. */
secret: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
active | boolean | Yes | No | — |
createdAt | string | Yes | No | — |
endpointId | string | Yes | No | — |
events | readonly WebhookSubscriptionEventType[] | Yes | No | — |
secret | string | Yes | No | Returned only by endpoint creation. Store this value immediately. |
secretPrefix | string | Yes | No | — |
updatedAt | string | Yes | No | — |
url | string | Yes | No | — |
RotatedWebhookSecret
export interface RotatedWebhookSecret {
endpointId: string;
secretPrefix: string;
/** Returned only by secret rotation. Store this value immediately. */
secret: string;
rotatedAt: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
endpointId | string | Yes | No | — |
rotatedAt | string | Yes | No | — |
secret | string | Yes | No | Returned only by secret rotation. Store this value immediately. |
secretPrefix | string | Yes | No | — |
VerifyWebhookSignatureOptions
export interface VerifyWebhookSignatureOptions {
/** Exact request bytes. Verify before parsing JSON. */
payload: string | Uint8Array;
headers: WebhookHeaderSource;
secret: string;
/** Defaults to five minutes. */
toleranceMs?: number;
/** Test seam; defaults to the current wall-clock time. */
now?: number | Date;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
headers | WebhookHeaderSource | Yes | No | — |
now | number | Date | No | No | Test seam; defaults to the current wall-clock time. |
payload | string | Uint8Array<ArrayBufferLike> | Yes | No | Exact request bytes. Verify before parsing JSON. |
secret | string | Yes | No | — |
toleranceMs | number | No | No | Defaults to five minutes. |
WebhookDelivery
export interface WebhookDelivery {
deliveryId: string;
endpointId: string;
eventId: string;
eventType: WebhookEventType;
status: WebhookDeliveryStatus;
attempts: readonly WebhookDeliveryAttempt[];
createdAt: string;
nextRetryAt?: string;
completedAt?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
attempts | readonly WebhookDeliveryAttempt[] | Yes | No | — |
completedAt | string | No | No | — |
createdAt | string | Yes | No | — |
deliveryId | string | Yes | No | — |
endpointId | string | Yes | No | — |
eventId | string | Yes | No | — |
eventType | WebhookEventType | Yes | No | — |
nextRetryAt | string | No | No | — |
status | WebhookDeliveryStatus | Yes | No | — |
WebhookDeliveryAttempt
export interface WebhookDeliveryAttempt {
attempt: number;
attemptedAt: string;
completedAt: string;
statusCode?: number;
error?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
attempt | number | Yes | No | — |
attemptedAt | string | Yes | No | — |
completedAt | string | Yes | No | — |
error | string | No | No | — |
statusCode | number | No | No | — |
WebhookDeliveryPage
export interface WebhookDeliveryPage {
deliveries: readonly WebhookDelivery[];
nextCursor?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
deliveries | readonly WebhookDelivery[] | Yes | No | — |
nextCursor | string | No | No | — |
WebhookDeliveryStatus
export type WebhookDeliveryStatus =
| "pending"
| "delivering"
| "succeeded"
| "failed";WebhookEndpoint
export interface WebhookEndpoint {
endpointId: string;
url: string;
secretPrefix: string;
events: readonly WebhookSubscriptionEventType[];
active: boolean;
createdAt: string;
updatedAt: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
active | boolean | Yes | No | — |
createdAt | string | Yes | No | — |
endpointId | string | Yes | No | — |
events | readonly WebhookSubscriptionEventType[] | Yes | No | — |
secretPrefix | string | Yes | No | — |
updatedAt | string | Yes | No | — |
url | string | Yes | No | — |
WebhookEndpointPage
export interface WebhookEndpointPage {
webhooks: readonly WebhookEndpoint[];
nextCursor?: string;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
nextCursor | string | No | No | — |
webhooks | readonly WebhookEndpoint[] | Yes | No | — |
VoiceObserverFailedWebhookData
export interface VoiceObserverFailedWebhookData {
sessionId: string;
agentId: string;
agentRevision: number;
lastHandledSequence: number;
attempts: number;
reason: VoiceObserverFailureReason;
operation: VoiceObserverFailureOperation;
error: NormalizedToolError;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
agentId | string | Yes | No | — |
agentRevision | number | Yes | No | — |
attempts | number | Yes | No | — |
error | NormalizedToolError | Yes | No | — |
lastHandledSequence | number | Yes | No | — |
operation | VoiceObserverFailureOperation | Yes | No | — |
reason | VoiceObserverFailureReason | Yes | No | — |
sessionId | string | Yes | No | — |
VoiceObserverFailedWebhookEvent
Executor-owned failure signal; it is not part of the worker event sequence.
export interface VoiceObserverFailedWebhookEvent {
id: string;
type: "voice.observer.failed";
createdAt: string;
projectId: string;
data: VoiceObserverFailedWebhookData;
}| Property | Type | Required | Readonly | Description |
|---|---|---|---|---|
createdAt | string | Yes | No | — |
data | VoiceObserverFailedWebhookData | Yes | No | — |
id | string | Yes | No | — |
projectId | string | Yes | No | — |
type | "voice.observer.failed" | Yes | No | — |
VoiceObserverFailureOperation
export type VoiceObserverFailureOperation =
| "get_events"
| "get_session"
| "publish_event"
| "publish_transcript"
| "publish_failure";VoiceObserverFailureReason
export type VoiceObserverFailureReason = "retry_exhausted" | "non_retryable";WebhookEvent
export type WebhookEvent =
| ExecutionWebhookEvent
| VoiceSessionWebhookEvent
| VoiceTranscriptWebhookEvent
| VoiceObserverFailedWebhookEvent
| TriggerWebhookEvent;WebhookEventType
export type WebhookEventType =
| TerminalEventType
| "voice.session.event"
| "voice.transcript.ready"
| "voice.observer.failed"
| TriggerWebhookEventType;WebhookSubscriptionEventType
export type WebhookSubscriptionEventType =
| (typeof WEBHOOK_SUBSCRIPTION_EVENT_TYPES)[number]
| TriggerWebhookEventType;