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

# Create Message

> Add a new message to the conversation. Used to insert a new messages to a conversation manually ( without using chat endpoint )



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/ai/analytics.yml post /ai/conversations/{conversation_id}/message
openapi: 3.1.0
info:
  title: Telnyx AI Analytics API
  version: 2.0.0
  description: API for AI conversations, insights, embeddings, and clusters.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/conversations/{conversation_id}/message:
    post:
      tags:
        - Conversations
      summary: Create Message
      description: >-
        Add a new message to the conversation. Used to insert a new messages to
        a conversation manually ( without using chat endpoint )
      operationId: add_new_message
      parameters:
        - name: conversation_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: The ID of the conversation
            title: Conversation Id
          description: The ID of the conversation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateMsgReq'
      responses:
        '200':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            await
            client.ai.conversations.addMessage('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
            { role: 'role' });
        - lang: Python
          source: |-
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            client.ai.conversations.add_message(
                conversation_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                role="role",
            )
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\terr := client.AI.Conversations.AddMessage(\n\t\tcontext.TODO(),\n\t\t\"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n\t\ttelnyx.AIConversationAddMessageParams{\n\t\t\tRole: \"role\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n}\n"
        - lang: Java
          source: >-
            package com.telnyx.sdk.example;


            import com.telnyx.sdk.client.TelnyxClient;

            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;

            import
            com.telnyx.sdk.models.ai.conversations.ConversationAddMessageParams;


            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    ConversationAddMessageParams params = ConversationAddMessageParams.builder()
                        .conversationId("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e")
                        .role("role")
                        .build();
                    client.ai().conversations().addMessage(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            result =
            telnyx.ai.conversations.add_message("182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            role: "role")


            puts(result)
        - lang: CLI
          source: |-
            telnyx ai:conversations add-message \
              --api-key 'My API Key' \
              --conversation-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
              --role role
components:
  schemas:
    CreateMsgReq:
      properties:
        role:
          type: string
          title: Role
        content:
          type: string
          title: Content
          default: ''
        name:
          type: string
          title: Name
        tool_choice:
          anyOf:
            - type: string
            - type: object
              title: ToolChoiceObject
          title: Tool Choice
        tool_calls:
          items:
            type: object
            additionalProperties: true
          type: array
          title: Tool Calls
        tool_call_id:
          type: string
          title: Tool Call Id
        sent_at:
          type: string
          format: date-time
          title: Sent At
        metadata:
          type: object
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: boolean
              - items:
                  anyOf:
                    - type: string
                    - type: integer
                    - type: boolean
                type: array
          title: Metadata
      type: object
      required:
        - role
      title: CreateMsgReq
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    ValidationError:
      title: ValidationError
      required:
        - loc
        - msg
        - type
      type: object
      properties:
        loc:
          title: Location
          type: array
          items:
            anyOf:
              - type: string
              - type: integer
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````