API Reference
All event types emitted by ChatSpark webhooks and their payload schemas. Subscribe to specific events when registering a webhook endpoint.
| Event | Description |
|---|---|
lead.captured | Emitted when a lead is captured via the chat widget or API. |
conversation.started | Emitted when a new conversation begins. |
conversation.ended | Emitted when a conversation is closed or ended. |
message.sent | Emitted when a message is sent (user or assistant). |
agent.updated | Emitted when an agent configuration is updated. |
ai-action.completed | Emitted when an AI action (e.g., CRM integration) completes successfully. |
ai-action.failed | Emitted when an AI action fails. |
training.completed | Emitted when training data processing completes successfully. |
training.failed | Emitted when training data processing fails. |
json
{
"event": "lead.captured",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"leadId": "lead_123",
"agentId": "ag_123",
"name": "Jane Doe",
"email": "jane@example.com",
"phone": "+1234567890",
"companyName": "Acme Inc",
"message": "Initial message",
"createdAt": "2026-02-24T12:00:00.000Z"
}
}json
{
"event": "conversation.started",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"conversationId": "conv_abc",
"agentId": "ag_123",
"createdAt": "2026-02-24T12:00:00.000Z"
}
}json
{
"event": "conversation.ended",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"conversationId": "conv_abc",
"agentId": "ag_123",
"endedAt": "2026-02-24T12:30:00.000Z"
}
}json
{
"event": "message.sent",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"messageId": "msg_123",
"conversationId": "conv_abc",
"agentId": "ag_123",
"role": "user" | "assistant",
"content": "Message text",
"createdAt": "2026-02-24T12:00:00.000Z"
}
}json
{
"event": "agent.updated",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"agentId": "ag_123",
"updatedAt": "2026-02-24T12:00:00.000Z",
"changes": ["name", "prompt"]
}
}json
{
"event": "ai-action.completed",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"actionId": "action_123",
"actionType": "hubspot",
"agentId": "ag_123",
"conversationId": "conv_abc",
"result": {},
"completedAt": "2026-02-24T12:00:00.000Z"
}
}json
{
"event": "ai-action.failed",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"actionId": "action_123",
"actionType": "hubspot",
"agentId": "ag_123",
"error": "Error message",
"failedAt": "2026-02-24T12:00:00.000Z"
}
}json
{
"event": "training.completed",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"trainingId": 1,
"agentId": "ag_123",
"source": "product-docs",
"status": "completed",
"dataCount": 150,
"completedAt": "2026-02-24T12:00:00.000Z"
}
}json
{
"event": "training.failed",
"timestamp": "2026-02-24T12:00:00.000Z",
"data": {
"trainingId": 1,
"agentId": "ag_123",
"source": "product-docs",
"error": "Error message",
"failedAt": "2026-02-24T12:00:00.000Z"
}
}