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

# Create a new message

> Create a new message in a ticket. Required field: `ticket` (ticket ID).
Optional fields: `comment` (rich text as TipTap doc JSON, or a plain string) or `markdownComment`
(Markdown, converted server-side; takes precedence over `comment`), `type` (defaults to `TEXT`, or `NOTE`
when `isNote` is true), `isNote` (creates an internal note), `attachments` (array of `{ name, url, type }`),
`channel`, `replyTo` (message ID to quote), `data`, and `actions`. Other schema properties are accepted for
backwards compatibility but are ignored on create; messages are always attributed to the authenticated
user.



## OpenAPI

````yaml https://api.gleap.io/api-docs.json post /messages
openapi: 3.0.0
info:
  title: gleap-server
  version: 14.0.0
  contact: {}
servers:
  - url: https://api.gleap.io/v3
security: []
paths:
  /messages:
    post:
      tags:
        - Messages
      summary: Create a new message
      description: >-
        Create a new message in a ticket. Required field: `ticket` (ticket ID).

        Optional fields: `comment` (rich text as TipTap doc JSON, or a plain
        string) or `markdownComment`

        (Markdown, converted server-side; takes precedence over `comment`),
        `type` (defaults to `TEXT`, or `NOTE`

        when `isNote` is true), `isNote` (creates an internal note),
        `attachments` (array of `{ name, url, type }`),

        `channel`, `replyTo` (message ID to quote), `data`, and `actions`. Other
        schema properties are accepted for

        backwards compatibility but are ignored on create; messages are always
        attributed to the authenticated

        user.
      operationId: CreateMessage
      parameters:
        - in: header
          name: project
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMessageDto'
      responses:
        '200':
          description: Ok
          content:
            application/json:
              schema: {}
              examples:
                Example 1:
                  value:
                    id: 507f1f77bcf86cd799439015
                    ticket: 507f1f77bcf86cd799439011
                    type: TEXT
                    data:
                      content:
                        type: doc
                        content:
                          - type: paragraph
                            content:
                              - type: text
                                text: >-
                                  Thank you for reporting this issue. We are
                                  looking into it.
                    comment: >-
                      Thank you for reporting this issue. We are looking into
                      it.
                    attachments:
                      - name: screenshot.png
                        url: https://example.com/screenshots/screenshot.png
                        type: image/png
                    user:
                      id: 507f1f77bcf86cd799439012
                      email: support@example.com
                      firstName: John
                      lastName: Doe
                    createdAt: '2024-01-20T11:00:00.000Z'
                    updatedAt: '2024-01-20T11:00:00.000Z'
      security:
        - jwt: []
components:
  schemas:
    CreateMessageDto:
      properties:
        user:
          type: string
        session:
          type: string
        bot:
          type: boolean
        fallbackUser:
          $ref: '#/components/schemas/FallbackUserDto'
        messageRef:
          type: string
        ticket:
          type: string
        data: {}
        translatedData: {}
        type:
          type: string
        emailId:
          type: string
        sessionNotificationsUnread:
          type: boolean
        outbound:
          type: string
        outboundTemplate:
          type: string
        outboundSubject:
          type: string
        status: {}
        statusHistory:
          items: {}
          type: array
        comment: {}
        markdownComment:
          type: string
          description: >-
            Markdown message body, honored when creating a message: the server
            converts it to TipTap JSON and it

            takes precedence over `comment`. Ignored when updating a message.
        replyTo:
          type: string
        kaiChat:
          type: boolean
        aiData: {}
        attachments:
          items:
            $ref: '#/components/schemas/AttachmentDto'
          type: array
        actions:
          items:
            properties:
              data: {}
              type:
                type: string
            required:
              - type
            type: object
          type: array
        channel:
          $ref: '#/components/schemas/ChannelDto'
        sendToChannel:
          type: boolean
        isNote:
          type: boolean
        rating:
          type: string
      type: object
      additionalProperties: false
    FallbackUserDto:
      properties:
        username:
          type: string
        email:
          type: string
        imageUrl:
          type: string
      type: object
      additionalProperties: false
    AttachmentDto:
      properties:
        name:
          type: string
        url:
          type: string
        type:
          type: string
      required:
        - name
        - url
      type: object
      additionalProperties: false
    ChannelDto:
      properties:
        id:
          type: string
        type:
          type: string
        messageId:
          type: string
      required:
        - id
      type: object
      additionalProperties: false
  securitySchemes:
    jwt:
      type: http
      scheme: bearer
      bearerFormat: JWT

````