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

# Send a new message

> Post the necessary fields for the API to send a new message.



## OpenAPI

````yaml /api-reference/conversations/openapi.json post /conversations/messages
openapi: 3.0.0
info:
  title: Conversations API
  description: Documentation for Conversations API
  version: '1.0'
  contact: {}
servers:
  - url: https://services.leadconnectorhq.com
security: []
tags:
  - name: Conversations
    description: Documentation for Conversations API
  - name: Search
    description: Documentation for Conversations API
  - name: Email
    description: Documentation for Conversations API
  - name: Messages
    description: Documentation for Conversations API
  - name: Providers
    description: Documentation for Conversations API
paths:
  /conversations/messages:
    post:
      tags:
        - Messages
      summary: Send a new message
      description: Post the necessary fields for the API to send a new message.
      operationId: send-a-new-message
      parameters:
        - name: Version
          in: header
          description: API Version
          required: true
          schema:
            type: string
            enum:
              - '2021-04-15'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SendMessageBodyDto'
      responses:
        '200':
          description: Created the message
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendMessageResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestDTO'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedDTO'
      security:
        - bearer:
            - conversations/message.write
components:
  schemas:
    SendMessageBodyDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - SMS
            - Email
            - WhatsApp
            - IG
            - FB
            - Custom
            - Live_Chat
          description: Type of message being sent
          example: Email
        contactId:
          type: string
          description: ID of the contact receiving the message
          example: abc123def456
        appointmentId:
          type: string
          description: ID of the associated appointment
          example: appt123
        attachments:
          description: Array of attachment URLs
          example:
            - https://storage.com/file1.pdf
            - https://storage.com/file2.jpg
          type: array
          items:
            type: string
        emailFrom:
          type: string
          description: Email address to send from
          example: sender@company.com
        emailCc:
          description: Array of CC email addresses
          example:
            - cc1@company.com
            - cc2@company.com
          type: array
          items:
            type: string
        emailBcc:
          description: Array of BCC email addresses
          example:
            - bcc1@company.com
            - bcc2@company.com
          type: array
          items:
            type: string
        html:
          type: string
          description: HTML content of the message
          example: <p>Hello World</p>
        message:
          type: string
          description: Text content of the message
          example: Hello, how can I help you today?
        subject:
          type: string
          description: Subject line for email messages
          example: Important Update
        replyMessageId:
          type: string
          description: ID of message being replied to
          example: msg123
        templateId:
          type: string
          description: ID of message template
          example: template123
        threadId:
          type: string
          description: >-
            ID of message thread. For email messages, this is the message ID
            that contains multiple email messages in the thread
          example: thread123
        scheduledTimestamp:
          type: number
          description: UTC Timestamp (in seconds) at which the message should be scheduled
          example: 1669287863
        conversationProviderId:
          type: string
          description: ID of conversation provider
          example: provider123
        emailTo:
          type: string
          description: >-
            Email address to send to, if different from contact's primary email.
            This should be a valid email address associated with the contact.
          example: recipient@company.com
        emailReplyMode:
          type: string
          enum:
            - reply
            - reply_all
          description: Mode for email replies
          example: reply_all
        fromNumber:
          type: string
          description: Phone number used as the sender number for outbound messages
          example: '+1499499299'
        toNumber:
          type: string
          description: Recipient phone number for outbound messages
          example: '+1439499299'
      required:
        - type
        - contactId
    SendMessageResponseDto:
      type: object
      properties:
        conversationId:
          type: string
          description: Conversation ID.
          example: ABC12h2F6uBrIkfXYazb
        emailMessageId:
          type: string
          description: >-
            This contains the email message id (only for Email type). Use this
            ID to send inbound replies to Hoop to create a threaded email.
          example: rnGyqh2F6uBrIkfhFo9A
        messageId:
          type: string
          description: This is the main Message ID
          example: t22c6DQcTDf3MjRhwf77
        messageIds:
          description: >-
            When sending via the GMB channel, we will be returning list of
            `messageIds` instead of single `messageId`.
          type: array
          items:
            type: string
        msg:
          type: string
          description: Additional response message when sending a workflow message
          example: Message queued successfully.
      required:
        - conversationId
        - messageId
    BadRequestDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 400
        message:
          type: string
          example: Bad Request
      required:
        - statusCode
        - message
    UnauthorizedDTO:
      type: object
      properties:
        statusCode:
          type: number
          example: 401
        message:
          type: string
          example: 'Invalid token: access token is invalid'
        error:
          type: string
          example: Unauthorized
      required:
        - statusCode
        - message
        - error
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      description: >-
        Use the Access Token generated with user type as Sub-Account (OR)
        Private Integration Token of Sub-Account.
      type: http

````