---
source_url: https://www.pubnub.com/docs/chat/kotlin-chat-sdk/learn/chat-entities/event
title: Event object
updated_at: 2026-06-15T12:11:38.372Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# Event object

`Event` represents a single piece of information emitted during chat operations: typing indicators, message receipts, mentions, or reports.

Unlike other Chat SDK entities, `Event` provides no methods - it only passes payloads emitted during chat operations.

:::note Deprecated event types
Many `EventContent` subtypes (`Typing`, `Report`, `Receipt`, `Mention`, `Invite`, `Custom`, `Moderation`) are deprecated. Use entity-level methods instead (for example, `channel.onTypingChanged()`, `user.onMentioned()`, `channel.onMessageReported()`). See [Custom events](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/custom-events) for the full mapping.
:::

## Properties

The `Event` interface has the following properties:

```kotlin
class Event<T : EventContent>(
    val chat: Chat,
    val timetoken: Long,
    val payload: T,
    val channelId: String,
    val userId: String
)
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| chat | Chat | Optional |  | Reference to the main `Chat` object. |
| timetoken | Long | Optional |  | Timetoken of the message that triggered an event. |
| payload | T | Optional |  | Data passed in an event (of `EventContent` subtype) that differ depending on the emitted event type (`typing`, `report`, `receipt`, `mention`, `invite`, `custom`, `moderation`, or `text`). |
| channelId | String | Optional |  | Target channel where this event is delivered. |
| userId | String | Optional |  | [Unique ID](https://www.pubnub.com/docs/general/setup/users-and-devices) of the user that triggered the event. |

##### Event structure

The `EventContent` class takes the following parameters:

```kotlin
@Serializable
sealed class EventContent {
    @Serializable
    @SerialName("typing")
    class Typing(val value: Boolean) : EventContent()

    @Serializable
    @SerialName("report")
    class Report(
        val text: String? = null,
        val reason: String,
        val reportedMessageTimetoken: Long? = null,
        val reportedMessageChannelId: String? = null,
        val reportedUserId: String?,
    ) : EventContent()

    @Serializable
    @SerialName("receipt")
    class Receipt(val messageTimetoken: Long) : EventContent()

    @Serializable
    @SerialName("mention")
    class Mention(val messageTimetoken: Long, val channel: String, val parentChannel: String? = null) : EventContent()
    // channel should be channelId and parentChannel should be parentChannelId, but we can't change it not tt break compatibility with existing Chat SDK

    @Serializable
    @SerialName("invite")
    class Invite(val channelType: ChannelType, val channelId: String) : EventContent()

    @Serializable
    @SerialName("custom")
    class Custom(
        @Contextual val data: Any,
        @Transient val method: EmitEventMethod = EmitEventMethod.PUBLISH
    ) : EventContent()

    @Serializable
    @SerialName("moderation")
    class Moderation(val channelId: String, val restriction: RestrictionType, val reason: String? = null) :
        EventContent()

    @Serializable
    @SerialName("text")
    open class TextMessageContent(
        val text: String,
        val files: List<File>? = null,
    ) : EventContent() {
        override fun equals(other: Any?): Boolean {
            if (this === other) {
                return true
            }
            if (other !is TextMessageContent) {
                return false
            }

            if (text != other.text) {
                return false
            }
            if (files != other.files) {
                return false
            }

            return true
        }

        override fun hashCode(): Int {
            var result = text.hashCode()
            result = 31 * result + (files?.hashCode() ?: 0)
            return result
        }

        override fun toString(): String {
            return "TextMessageContent(text='$text', files=$files)"
        }
    }

    class UnknownMessageFormat(val jsonElement: JsonElement) : TextMessageContent("", null)
}
```

For details, refer to the [chat events documentation](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/custom-events).

## Use case

Events enable:

* Collecting historical chat events
* Creating [custom events](https://www.pubnub.com/docs/chat/kotlin-chat-sdk/build/features/custom-events)
* Building moderation dashboards for flagged messages
* Triggering business logic with [Functions](https://www.pubnub.com/docs/serverless/functions/overview)