> ## Documentation Index
> Fetch the complete documentation index at: https://botpress-pb-update-api.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Properties

<ResponseExample>
  ```json Event properties theme={null}
  {
    "botId": "<string>",
    "conversationId": "<string>",
    "createdOn": "<Date>",
    "direction": "<EventDirection>",
    "id": "<string>",
    "integration": "<string>",
    "kb": {
      "included": [],
      "results": []
    },
    "messageId": "<string>",
    "payload": {},
    "preview": "<string>",
    "state": {},
    "tags": {
      "conversation": {},
      "message": {},
      "user": {}
    },
    "trigger": {
      "conversationId": "<string>",
      "eventName": "<string>",
      "flowId": "<string>",
      "integration": "<string>",
      "nodeId": "<string>",
      "userId": "<string>"
    },
    "type": "<string>",
    "userId": "<string>"
  }
  ```
</ResponseExample>

Whenever an event occurs during your bot's execution—like a message being sent—you can access details about that event using the `event` object's properties.

The `event` object is available [wherever you can use code in Botpress Studio](/studio/guides/advanced/use-code). This includes:

* [Hooks](/studio/concepts/hooks)
* [Actions](/studio/concepts/actions)
* [Execute Code Cards](/studio/concepts/cards/execute-code)

You can also access the `event` object within certain [Cards](/studio/concepts/cards/introduction)' configuration fields.

<Warning>
  This documentation omits certain properties of the `event` object which exist to maintain internal functionality and aren't useful for <Tooltip tip="Happy bot building!">bot builders</Tooltip>.
</Warning>

<ResponseField name="event" type="IncomingEvent">
  Information about the last incoming event in your bot's execution.

  <Expandable>
    <ResponseField name="botId" type="string" required>
      The ID of the bot that experienced the event.
    </ResponseField>

    <ResponseField name="conversationId" type="string">
      The ID of the conversation that the event took place in.
    </ResponseField>

    <ResponseField name="createdOn" type="Date" required>
      The data and time when the event was created (in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format).
    </ResponseField>

    <ResponseField name="direction" type="EventDirection" required>
      The direction of the event, indicating whether the event was received by the bot or sent from the bot.

      Possible values:

      * `'incoming'`: The event originated from the user and was received by the bot.
      * `'outgoing'`: The event was generated by the bot and sent to the user.
    </ResponseField>

    <ResponseField name="id" type="string" required>
      The unique identifier for the event.
    </ResponseField>

    <ResponseField name="integration" type="string">
      The [integration](/integrations/) that the event occurred on.
    </ResponseField>

    <ResponseField name="kb" type="object">
      Information about [Knowledge Bases](/studio/concepts/knowledge-base/introduction) queried for the event.

      <Expandable>
        <ResponseField name="included" type="Studio.KnowledgeBase.KB[]" required>
          Array of Knowledge Bases queried for the event.

          <Warning>
            Since most of this object's properties are for internal use by Botpress, we've omitted its deeper structure from this documentation.
          </Warning>
        </ResponseField>

        <ResponseField name="results" type="Studio.KnowledgeBase.ContentResult[]">
          Array of Knowledge Base results consulted for this event.

          <Warning>
            Since most of this object's properties are for internal use by Botpress, we've omitted its deeper structure from this documentation.
          </Warning>
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="messageId" type="string">
      The unique identifier for the current event's message.
    </ResponseField>

    <ResponseField name="payload" type="object" required>
      The payload for the current event.
    </ResponseField>

    <ResponseField name="preview" type="string" required>
      A representation of the event in plain text. If the event is text message, this property will contain the message itself.
    </ResponseField>

    <ResponseField name="state" type="EventState" required>
      Data related to the state of the event.

      <Warning>
        Since most of this object's properties are for internal use by Botpress, we've omitted its deeper structure from this documentation.
      </Warning>
    </ResponseField>

    <ResponseField name="tags" type="EventTags">
      Any tags associated with the current event. These can contain useful data related to the integration associated with the event.

      <Expandable>
        <ResponseField name="conversation" type="object">
          Tags for the conversation.
        </ResponseField>

        <ResponseField name="message" type="object">
          Tags for the message.
        </ResponseField>

        <ResponseField name="user" type="object">
          Tags for the user.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="trigger" type="DM.Trigger">
      The [Trigger](/studio/concepts/triggers) that sent the event.

      <Expandable>
        <ResponseField name="conversationId" type="string">
          The ID of the conversation associated with this Trigger.
        </ResponseField>

        <ResponseField name="eventName" type="string">
          The name of the event that the Trigger sent.
        </ResponseField>

        <ResponseField name="flowId" type="string" required>
          The ID of the Workflow containing the Trigger.
        </ResponseField>

        <ResponseField name="integration" type="string">
          The integration associated with the Trigger.
        </ResponseField>

        <ResponseField name="nodeId" type="string" required>
          The ID of the Node that contains the Trigger.
        </ResponseField>

        <ResponseField name="userId" type="string">
          The ID of the user associated with this Trigger.
        </ResponseField>
      </Expandable>
    </ResponseField>

    <ResponseField name="type" type="string" required>
      The type of the event.
    </ResponseField>

    <ResponseField name="userId" type="string">
      The user ID associated with this event.
    </ResponseField>
  </Expandable>
</ResponseField>
