> ## 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.

# Assistant Sms Chat

> Send an SMS message for an assistant. This endpoint: 
1. Validates the assistant exists and has messaging profile configured 
2. If should_create_conversation is true, creates a new conversation with metadata 
3. Sends the SMS message (If `text` is set, this will be sent. Otherwise, if this is the first message in the conversation and the assistant has a `greeting` configured, this will be sent. Otherwise the assistant will generate the text to send.) 
4. Updates conversation metadata if provided 
5. Returns the conversation ID



## OpenAPI

````yaml https://telnyx-openapi-ng.s3.us-east-1.amazonaws.com/ai/assistants.yml post /ai/assistants/{assistant_id}/chat/sms
openapi: 3.1.0
info:
  title: Telnyx AI Assistants API
  version: 2.0.0
  description: >-
    API for managing AI Assistants, including CRUD fields, versions, tags,
    integrations, MCP servers, and shared tools.
  contact:
    email: support@telnyx.com
servers:
  - url: https://api.telnyx.com/v2
security:
  - bearerAuth: []
paths:
  /ai/assistants/{assistant_id}/chat/sms:
    post:
      tags:
        - Assistants
      summary: Assistant Sms Chat
      description: >-
        Send an SMS message for an assistant. This endpoint: 

        1. Validates the assistant exists and has messaging profile configured 

        2. If should_create_conversation is true, creates a new conversation
        with metadata 

        3. Sends the SMS message (If `text` is set, this will be sent.
        Otherwise, if this is the first message in the conversation and the
        assistant has a `greeting` configured, this will be sent. Otherwise the
        assistant will generate the text to send.) 

        4. Updates conversation metadata if provided 

        5. Returns the conversation ID
      operationId: assistant_sms_chat_assistants__assistant_id__chat_sms_post
      parameters:
        - name: assistant_id
          in: path
          required: true
          schema:
            type: string
            title: Assistant Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssistantSmsChatReq'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssistantSmsChatResponse'
        '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
            });


            const response = await client.ai.assistants.sendSMS('assistant_id',
            { from: 'from', to: 'to' });


            console.log(response.conversation_id);
        - 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
            )
            response = client.ai.assistants.send_sms(
                assistant_id="assistant_id",
                from_="from",
                to="to",
            )
            print(response.conversation_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\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\tresponse, err := client.AI.Assistants.SendSMS(\n\t\tcontext.TODO(),\n\t\t\"assistant_id\",\n\t\ttelnyx.AIAssistantSendSMSParams{\n\t\t\tFrom: \"from\",\n\t\t\tTo:   \"to\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response.ConversationID)\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.assistants.AssistantSendSmsParams;
            import com.telnyx.sdk.models.ai.assistants.AssistantSendSmsResponse;

            public final class Main {
                private Main() {}

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

                    AssistantSendSmsParams params = AssistantSendSmsParams.builder()
                        .assistantId("assistant_id")
                        .from("from")
                        .to("to")
                        .build();
                    AssistantSendSmsResponse response = client.ai().assistants().sendSms(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


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


            response = telnyx.ai.assistants.send_sms("assistant_id", from:
            "from", to: "to")


            puts(response)
        - lang: CLI
          source: |-
            telnyx ai:assistants send-sms \
              --api-key 'My API Key' \
              --assistant-id assistant_id \
              --from from \
              --to to
components:
  schemas:
    AssistantSmsChatReq:
      properties:
        from:
          type: string
          title: From
        to:
          type: string
          title: To
        text:
          type: string
          title: Text
        conversation_metadata:
          title: Conversation Metadata
          additionalProperties:
            anyOf:
              - type: string
              - type: integer
              - type: boolean
          type: object
        should_create_conversation:
          title: Should Create Conversation
          type: boolean
      type: object
      required:
        - from
        - to
      title: AssistantSmsChatReq
    AssistantSmsChatResponse:
      properties:
        conversation_id:
          title: Conversation Id
          type: string
      type: object
      title: AssistantSmsChatResponse
    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

````