Skip to main content
The webchat.message.sent webhook event is triggered whenever the AI or a human agent sends a message in a webchat session. This can be used to track outgoing communication and monitor agent activity.

Payload

AI Example

{
  "event": "webchat.message.sent",
  "data": {
    "sessionId": "550e8400-e29b-41d4-a716-446655440000",
    "orgId": "org-abc123",
    "profile": "Default Profile",
    "origin": "https://example.com/pricing",
    "messageId": "msg_a3c5e7f9",
    "content": "Yes — we offer monthly and annual billing. Want me to pull up pricing?",
    "sentBy": "ai",
    "createdAt": "2024-01-15T14:30:00Z"
  },
  "timestamp": "2024-01-15T14:30:00Z"
}

Human Agent Example

{
  "event": "webchat.message.sent",
  "data": {
    "sessionId": "550e8400-e29b-41d4-a716-446655440000",
    "orgId": "org-abc123",
    "profile": "Default Profile",
    "origin": "https://example.com/pricing",
    "messageId": "msg_b4d6f8a0",
    "content": "Hi, I just jumped in — happy to answer any other questions.",
    "sentBy": "human",
    "agentUserId": "user_xyz789",
    "createdAt": "2024-01-15T14:30:00Z"
  },
  "timestamp": "2024-01-15T14:30:00Z"
}

Properties

PropertyTypeDescription
eventstringThe webhook event type (webchat.message.sent).
data.sessionIdstringThe unique identifier for the webchat session.
data.orgIdstringThe Apten organization ID that owns the session.
data.profilestringThe name of the webchat profile that handled the session.
data.originstringThe URL of the page where the webchat widget was opened. Only included if set.
data.messageIdstringThe unique identifier for the message.
data.contentstringThe content of the message sent to the visitor.
data.sentBystringWho sent the message: ai or human.
data.agentUserIdstringThe Apten user ID of the human agent who sent the message. Only included when sentBy is human.
data.createdAtstringThe ISO 8601 timestamp when the message was sent.
timestampstringThe ISO 8601 timestamp when the webhook was sent.