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

# Enviar mensaje en el thread (MESSAGE) o nota interna (COMMENT)

> Operacion: Enviar mensaje en el thread.



## OpenAPI

````yaml /generated/specs/communications.json post /api/v1/conversations/threads/{id}/messages
openapi: 3.0.0
info:
  title: Raul API - Comunicaciones
  description: >-
    Conversations (threads, mensajes, channel accounts), inbox, omnichannel,
    email sync, WhatsApp, social, spam, tags y solicitudes de borrador con IA.
  version: 2.0.0
  contact: {}
servers:
  - url: https://api.raul.ugps.io
    description: Production
security: []
tags: []
paths:
  /api/v1/conversations/threads/{id}/messages:
    post:
      tags:
        - Conversations
      summary: Enviar mensaje en el thread (MESSAGE) o nota interna (COMMENT)
      description: 'Operacion: Enviar mensaje en el thread.'
      operationId: ConversationMessagesController_createMessage
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
        - name: Idempotency-Key
          in: header
          description: >-
            UUID v4 estable por intento lógico. Es obligatorio para MESSAGE y
            opcional para COMMENT.
          required: false
          schema:
            type: string
            format: uuid
            pattern: >-
              ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateThreadMessageDto'
      responses:
        '400':
          description: MESSAGE sin Idempotency-Key o encabezado presente que no es UUID v4
        '409':
          description: >-
            La clave fue usada con otro payload, la entrega externa no se pudo
            confirmar o su resultado venció
      security:
        - bearerAuth: []
components:
  schemas:
    CreateThreadMessageDto:
      type: object
      properties:
        attachments:
          type: array
          items:
            $ref: '#/components/schemas/MessageAttachmentDto'
        body:
          type: string
          description: Cuerpo (requerido si no hay adjuntos)
        channelAccountId:
          type: string
          description: Cuenta de salida (casilla). Sin ella se usa la personal
        cc:
          description: CC (sólo email)
          type: array
          items:
            type: string
        sendMode:
          type: string
          description: Modo de envío desde casilla compartida
          enum:
            - send_as
            - on_behalf_of
        type:
          type: string
          enum:
            - MESSAGE
            - COMMENT
        channelId:
          type: number
          description: >-
            Canal del envío (1002 email, 1003 whatsapp). Debe coincidir con el
            del thread; default: el del thread
        subject:
          type: string
          description: Asunto (sólo email)
        to:
          description: Destinatarios explícitos (sólo email)
          type: array
          items:
            type: string
        clientId:
          type: string
          description: ID del cliente asociado (sólo WhatsApp)
        contactId:
          type: string
          description: ID del contacto asociado (sólo WhatsApp)
        opportunityId:
          type: string
          description: ID del negocio asociado (sólo WhatsApp)
        quoteId:
          type: string
          description: ID de la cotización asociada (sólo WhatsApp)
      required:
        - type
    MessageAttachmentDto:
      type: object
      properties:
        name:
          type: string
          description: Nombre del archivo
        contentType:
          type: string
          description: 'Tipo MIME (ej: image/jpeg)'
        contentBytes:
          type: string
          description: Contenido en base64
      required:
        - name
        - contentType
        - contentBytes
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Token de sesión Better Auth para rutas de backoffice; las rutas de
        portal usan su token propio.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.