> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chatlevel.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Event Types

> List of supported event types and their payloads

## connection.open

A WhatsApp device successfully connected and authenticated.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "connection.open",
      "deviceId": 1234567,
      "data": {
        "displayName": "John Doe",
        "phoneNumber": "+1234567890"
      },
      "timestamp": "2024-01-15T10:30:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## connection.closed

A WhatsApp device disconnected from the server.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "connection.closed",
      "deviceId": 1234567,
      "data": {},
      "timestamp": "2024-01-15T10:35:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## connection.auth

A QR or Pairing code was generated for device pairing. Can either contain qrCode or pairingCode.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "connection.auth",
      "deviceId": 1234567,
      "data": {
        "qrCode": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA...",
    	"pairingCode": "ABCD1234"
      },
      "timestamp": "2024-01-15T10:25:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## connection.timeout

QR or Pairing code timed out without successful pairing.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "connection.timeout",
      "deviceId": 1234567,
      "data": {},
      "timestamp": "2024-01-15T10:27:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## connection.logout

A connection closed by logout

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "connection.logout",
      "deviceId": 1234567,
      "data": {},
      "timestamp": "2024-01-15T10:35:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## message.received

A new message was received by the WhatsApp instance.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "message.received",
      "deviceId": 1909568,
      "data": {
        "id": "3EB0C7F8A5B2D4E6F9A1C3D5",
        "from": "1234567890",
    	"fromType": "pn | lid",
    	"lid": "138087493537914" || null, 
    	"phoneNumber": "1234567890" || null,
        "pushName": "John Doe",
        "content": {
          "text": "Hello world"
        },
        "type": "text"
      },
      "timestamp": "2025-10-23T10:53:48.552Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## message.sent

A message was sent from the WhatsApp device.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "message.sent",
      "deviceId": 1234567,
      "data": {
        "id": "3EB0C7F8A5B2D4E6F9A1C3D6",
        "to": "0987654321",
    	"toType": "pn | lid",
    	"lid": "138087493537914" || null,
    	"phoneNumber": "1234567890" || null,
        "content": {
          "text": "Thanks for reaching out!"
        },
        "type": "text"
      },
      "timestamp": "2024-01-15T10:41:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## message.updated

A message was edited.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "message.updated",
      "deviceId": 1234567,
      "data": {
        "messageId": "3EB0C7F8A5B2D4E6F9A1C3D6",
        "from": "0987654321",
      	"fromType": "pn | lid",
    	"lid": "138087493537914" || null,
    	"phoneNumber": "1234567890" || null,
        "fromMe": true,
        "update": {
          "editedContent": {
            "text": "Edited text content"
          },
          "messageType": "text"
        }
      },
      "timestamp": "2024-01-15T10:42:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## message.deleted

A message was deleted.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "message.deleted",
      "deviceId": 1909568,
      "data": {
        "messageId": "3EB0C7F8A5B2D4E6F9A1C3D6",
        "from": "0987654321",
    	"fromType": "pn | lid",
    	"lid": "138087493537914" || null,
    	"phoneNumber": "1234567890" || null,
        "fromMe": false
      },
      "timestamp": "2025-10-22T21:55:44.332Z"
    }
    ```
  </Accordion>
</AccordionGroup>

## call

A whatsapp call was received, accepted, rejected or timed out. Will almost always come with lid.

<AccordionGroup>
  <Accordion title="Sample Request Body">
    ```json theme={null}
    {
      "event": "call",
      "deviceId": 1234567,
      "data": {
        "id": "string",
        "from": "138087493537914",
    	"fromType": "lid",
    	"lid": "138087493537914",
    	"phoneNumber": null,
        "status": "offer | accept | timeout | reject",
        "isVideo": true,
        "isGroup": false,
        "date": 1678901250
      },
      "timestamp": "2024-01-15T10:45:00.000Z"
    }
    ```
  </Accordion>
</AccordionGroup>
