import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messages = await client.ai.conversations.messages.list('conversation_id');
console.log(messages.data);{
"data": [
{
"role": "user",
"text": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"created_at": "2025-04-15T13:07:28.764Z",
"sent_at": "2025-04-15T13:07:28.764Z"
}
],
"meta": {
"total_pages": 123,
"total_results": 123,
"page_number": 123,
"page_size": 123
}
}Retrieve messages for a specific conversation, including tool calls made by the assistant.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const messages = await client.ai.conversations.messages.list('conversation_id');
console.log(messages.data);{
"data": [
{
"role": "user",
"text": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
}
}
],
"created_at": "2025-04-15T13:07:28.764Z",
"sent_at": "2025-04-15T13:07:28.764Z"
}
],
"meta": {
"total_pages": 123,
"total_results": 123,
"page_number": 123,
"page_size": 123
}
}Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Successful Response
Show child attributes
The role of the message sender.
user, assistant, tool The message content. Can be null for tool calls.
Optional tool calls made by the assistant.
Show child attributes
Unique identifier for the tool call.
Type of the tool call.
function The datetime the message was created on the conversation. This does not necesarily correspond to the time the message was sent. The best field to use to determine the time the end user experienced the message is sent_at.
"2025-04-15T13:07:28.764Z"
The datetime the message was sent to the end user.
"2025-04-15T13:07:28.764Z"
Was this page helpful?