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

# Send a message to a conversation

> Sends a text, image, or document message to the conversation recipient.

For `text`, `content` is required. For `image` and `document`, `media` is required and the file is uploaded to WhatsApp before sending.

This endpoint requires an open service window for the conversation.



## OpenAPI

````yaml /openapi.json post /conversations/{conversationId}/messages
openapi: 3.1.0
info:
  title: Cogfy Public API
  version: 1.0.0
  description: API for interacting with the Cogfy platform
servers:
  - url: https://messenger-public-api.cogfy.com
    description: Production server
  - url: http://localhost:3100
    description: Local server
security:
  - ApiKeyAuth: []
tags: []
paths:
  /conversations/{conversationId}/messages:
    post:
      tags:
        - Conversations
      summary: Send a message to a conversation
      description: >-
        Sends a text, image, or document message to the conversation recipient.


        For `text`, `content` is required. For `image` and `document`, `media`
        is required and the file is uploaded to WhatsApp before sending.


        This endpoint requires an open service window for the conversation.
      parameters:
        - in: path
          name: conversationId
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
          required: true
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                content:
                  anyOf:
                    - type: string
                      maxLength: 4096
                    - type: 'null'
                type:
                  type: string
                  enum:
                    - text
                    - image
                    - document
                media:
                  anyOf:
                    - type: object
                      properties:
                        name:
                          anyOf:
                            - type: string
                            - type: 'null'
                        mimeType:
                          type: string
                        base64:
                          type: string
                      required:
                        - mimeType
                        - base64
                    - type: 'null'
              required:
                - type
            examples:
              text:
                summary: Send a text message
                value:
                  type: text
                  content: Hello!
              image:
                summary: Send an image message
                value:
                  type: image
                  content: See this image
                  media:
                    name: photo.jpg
                    mimeType: image/jpeg
                    base64: ...
      responses:
        '201':
          description: Message sent successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    pattern: >-
                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$
                required:
                  - id
                additionalProperties: false
        '400':
          description: Bad request, invalid input data or expired service window
        '401':
          description: Unauthorized
        '404':
          description: Conversation or WhatsApp phone number not found
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: api-key

````