Check out our upcoming events and meetups! View events →
Create a scheduled event for an assistant
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const scheduledEventResponse = await client.ai.assistants.scheduledEvents.create('assistant_id', {
scheduled_at_fixed_datetime: '2025-04-15T13:07:28.764Z',
telnyx_agent_target: 'telnyx_agent_target',
telnyx_conversation_channel: 'phone_call',
telnyx_end_user_target: 'telnyx_end_user_target',
});
console.log(scheduledEventResponse);{
"telnyx_conversation_channel": "phone_call",
"telnyx_end_user_target": "<string>",
"telnyx_agent_target": "<string>",
"scheduled_at_fixed_datetime": "2023-11-07T05:31:56Z",
"assistant_id": "<string>",
"retry_count": 0,
"retry_attempts": 123,
"scheduled_event_id": "<string>",
"conversation_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"status": "pending",
"conversation_metadata": {},
"dynamic_variables": {},
"errors": [
"<string>"
],
"call_status": "<string>",
"call_duration": 123,
"max_retries_client_errors": 0,
"retry_interval_secs": 123,
"call_attempts": [
{
"attempt_number": 123,
"attempted_at": "2023-11-07T05:31:56Z",
"call_status": "<string>",
"call_duration": 123,
"telnyx_call_control_id": "<string>"
}
],
"dispatched_at": "2023-11-07T05:31:56Z"
}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.
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
phone_call, sms_chat The phone number, SIP URI, to schedule the call or text to.
The phone number, SIP URI, to schedule the call or text from.
The datetime at which the event should be scheduled. Formatted as ISO 8601.
"2025-04-15T13:07:28.764Z"
Required for sms scheduled events. The text to be sent to the end user.
Metadata associated with the conversation. Telnyx provides several pieces of metadata, but customers can also add their own.
Show child attributes
A map of dynamic variable names to values. These variables can be referenced in the assistant's instructions and messages using {{variable_name}} syntax.
Show child attributes
Configure number of retries on client errors: busy, no-answer, failed, canceled (caller hung up before the callee answered)
0 <= x <= 1060 <= x <= 86400Successful Response
Union type for different scheduled event response types
phone_call, sms_chat pending, in_progress, completed, failed Show child attributes
A map of dynamic variable names to values. These variables can be referenced in the assistant's instructions and messages using {{variable_name}} syntax.
Show child attributes
Values: busy, canceled, no-answer, ringing, completed, failed, in-progress
Duration of the call in seconds
Configure number of retries on client errors: busy, no-answer, failed, canceled (caller hung up before the callee answered)
Show child attributes
Date time at which call was sent
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const scheduledEventResponse = await client.ai.assistants.scheduledEvents.create('assistant_id', {
scheduled_at_fixed_datetime: '2025-04-15T13:07:28.764Z',
telnyx_agent_target: 'telnyx_agent_target',
telnyx_conversation_channel: 'phone_call',
telnyx_end_user_target: 'telnyx_end_user_target',
});
console.log(scheduledEventResponse);{
"telnyx_conversation_channel": "phone_call",
"telnyx_end_user_target": "<string>",
"telnyx_agent_target": "<string>",
"scheduled_at_fixed_datetime": "2023-11-07T05:31:56Z",
"assistant_id": "<string>",
"retry_count": 0,
"retry_attempts": 123,
"scheduled_event_id": "<string>",
"conversation_id": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"status": "pending",
"conversation_metadata": {},
"dynamic_variables": {},
"errors": [
"<string>"
],
"call_status": "<string>",
"call_duration": 123,
"max_retries_client_errors": 0,
"retry_interval_secs": 123,
"call_attempts": [
{
"attempt_number": 123,
"attempted_at": "2023-11-07T05:31:56Z",
"call_status": "<string>",
"call_duration": 123,
"telnyx_call_control_id": "<string>"
}
],
"dispatched_at": "2023-11-07T05:31:56Z"
}