v0 Platform API/API Reference/Hooks

Create Hook

Creates a new webhook that listens for specific events. Supports optional association with a chat.

POST/v1/hooks

Usage

TypeScript Example
import { v0 } from 'v0-sdk'

const result = await v0.hooks.create({
  name: 'My Hook',
  events: ['chat.created', 'message.created'],
  url: 'https://example.com',
})

console.log(result)

API Signature

Request

Body

name: string

A human-readable name for the hook.

events: 'chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'message.finished'[]

List of event types the hook should subscribe to.

chatId?: string

The ID of a chat to scope the hook to.

url: string

The target URL to receive the webhook payloads.

Response

id: string

A unique identifier for the webhook.

object: 'hook'

Fixed value identifying this object as a webhook.

name: string

A user-defined name to label the webhook.

events: 'chat.created' | 'chat.updated' | 'chat.deleted' | 'message.created' | 'message.updated' | 'message.deleted' | 'message.finished'[]

List of event types this webhook is subscribed to.

chatId?: string

Optional ID of the chat that this webhook is scoped to.

url: string

Target URL that receives event payloads for this webhook.