# message.created.metadata

Source: https://developer.nylas.com/docs/reference/notifications/message-metadata/message-created-metadata/

Sent for Google grants using the `/gmail.metadata` scope. Does not include `body`, `snippet`, or `attachment` fields.

> You cannot subscribe to this trigger directly. Subscribe to `message.created` instead — if the grant uses the Gmail metadata scope, the delivered notification type will be `message.created.metadata`.

## data.object fields

- `id` (string) **(required)** - The Nylas message ID.
- `grant_id` (string) **(required)** - The grant ID that owns this message.
- `object` (string) **(required)** (message) - Always `message`.
- `thread_id` (string) - The thread this message belongs to.
- `subject` (string) - The message subject line.
- `from` (array) - Sender information.
  - `name` (string) - Display name of the sender.
  - `email` (string) - Email address of the sender.
- `to` (array) - Primary recipients.
  - `name` (string)
  - `email` (string)
- `cc` (array) - CC recipients.
  - `name` (string)
  - `email` (string)
- `bcc` (array) - BCC recipients.
  - `name` (string)
  - `email` (string)
- `reply_to` (array) - Reply-to addresses.
  - `name` (string)
  - `email` (string)
- `date` (integer) - Unix timestamp when the message was sent.
- `headers` (array) - Email headers included with the metadata scope.
  - `name` (string) - Header name.
  - `value` (string) - Header value.
- `starred` (boolean) - Whether the message is starred/flagged.
- `unread` (boolean) - Whether the message is unread.
- `folders` (array) - Folder names the message belongs to.
- `metadata` (object) - Custom key-value metadata attached to the message.

## Example payload

```json
{
  "specversion": "1.0",
  "type": "message.created.metadata",
  "source": "/google/emails/realtime",
  "id": "<WEBHOOK_ID>",
  "time": 1723821985,
  "webhook_delivery_attempt": 1,
  "data": {
    "application_id": "<NYLAS_APPLICATION_ID>",
    "object": {
      "bcc": [
        {
          "email": "leyah@example.com"
        }
      ],
      "cc": [
        {
          "email": "kaveh@example.com"
        }
      ],
      "date": 1723821981,
      "folders": [
        "SENT"
      ],
      "from": [
        {
          "email": "swag@example.com",
          "name": "Nylas Swag"
        }
      ],
      "grant_id": "<NYLAS_GRANT_ID>",
      "headers": [
        {
          "name": "Delivered-To",
          "value": "nyla@example.com"
        },
        {
          "name": "Return-Path",
          "value": "<swag@example.com>"
        },
        {
          "name": "Received",
          "value": "Received Header Value"
        },
        {
          "name": "MIME-Version",
          "value": "1.0"
        },
        {
          "name": "From",
          "value": "Nylas Swag <swag@example.com>"
        },
        {
          "name": "Date",
          "value": "Fri, 16 Aug 2024 9:26:21 -0600"
        },
        {
          "name": "Message-ID",
          "value": "<MESSAGE_ID>"
        },
        {
          "name": "Subject",
          "value": "Let's send an attachment"
        },
        {
          "name": "To",
          "value": "<nyla@example.com>"
        },
        {
          "name": "Content-Type",
          "value": "multipart/alternative"
        },
        {
          "name": "Custom-Header",
          "value": "Custom header"
        }
      ],
      "id": "<MESSAGE_ID>",
      "metadata": {
        "key1": "all-meetings",
        "key2": "on-site"
      },
      "object": "message",
      "reply_to": [],
      "starred": false,
      "subject": "Let's send an attachment",
      "thread_id": "<THREAD_ID>",
      "to": [
        {
          "email": "nyla@example.com"
        }
      ],
      "unread": false
    }
  }
}
```
