Skip to main content
POST
/
ai
/
assistants
/
{assistant_id}
/
chat
/
sms
JavaScript
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);
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)
package main

import (
"context"
"fmt"

"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)

func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
response, err := client.AI.Assistants.SendSMS(
context.TODO(),
"assistant_id",
telnyx.AIAssistantSendSMSParams{
From: "from",
To: "to",
},
)
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", response.ConversationID)
}
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);
}
}
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)
<?php

require_once dirname(__DIR__) . '/vendor/autoload.php';

use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;

$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');

try {
$response = $client->ai->assistants->sendSMS(
'assistant_id',
from: 'from',
to: 'to',
conversationMetadata: ['foo' => 'string'],
shouldCreateConversation: true,
text: 'text',
);

var_dump($response);
} catch (APIException $e) {
echo $e->getMessage();
}
telnyx ai:assistants send-sms \
--api-key 'My API Key' \
--assistant-id assistant_id \
--from from \
--to to
curl --request POST \
--url https://api.telnyx.com/v2/ai/assistants/{assistant_id}/chat/sms \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"from": "<string>",
"to": "<string>",
"text": "<string>",
"conversation_metadata": {},
"should_create_conversation": true
}
'
{
  "conversation_id": "<string>"
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path Parameters

assistant_id
string
required

Unique identifier of the assistant.

Body

application/json
from
string
required
to
string
required
text
string
conversation_metadata
Conversation Metadata · object
should_create_conversation
boolean

Response

Successful Response

conversation_id
string