Skip to main content
POST
/
ai
/
assistants
/
{assistant_id}
/
chat
JavaScript
import Telnyx from 'telnyx';

const client = new Telnyx({
  apiKey: 'My API Key',
});

const response = await client.ai.assistants.chat('assistant_id', {
  content: 'Tell me a joke about cats',
  conversation_id: '42b20469-1215-4a9a-8964-c36f66b406f4',
});

console.log(response.content);
{
  "content": "Why did the cat sit on the computer? Because it wanted to keep an eye on the mouse!"
}

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

Body

application/json
content
string
required

The message content sent by the client to the assistant

Example:

"Tell me a joke about cats"

conversation_id
string
required

A unique identifier for the conversation thread, used to maintain context

Example:

"42b20469-1215-4a9a-8964-c36f66b406f4"

name
string

The optional display name of the user sending the message

Example:

"Charlie"

Response

Successful Response

content
string
required

The assistant's generated response based on the input message and context.

Example:

"Why did the cat sit on the computer? Because it wanted to keep an eye on the mouse!"