Event object
An object that refers to a single piece of information emitted when someone is typing, receiving a message, mentioning others in a message, or reporting a message to the admin.
Contrary to other Chat SDK entities, this object provides no methods. Its only purpose is to pass payloads of different types emitted when certain chat operations occur.
Properties
The Event
object has the following properties:
class Event<T extends EventType> {
timetoken: string
type: T
payload: EventPayloads[T]
channelId: string
userId: string
}
Parameter | Type | Description |
---|---|---|
timetoken | string | Timetoken of the message that triggered an event. |
type | T | Type of action that emits an event: typing , report , receipt , mention , invite , moderation , or custom . |
payload | EventPayloads[T] | Data passed in an event that differ depending on the event type. |
channelId | string | Target channel where this event is delivered. |
userId | string | Unique ID of the user that triggered the event. |
Use case
You can use events to collect historical chat events or create your own custom events. You can later visualize them in a graphical form (like a moderation dashboard for flagged messages) or create additional business logic with functions that these events can trigger.